mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	tests: Adjust latency test calibration
This makes the test more robust by: 1. Decreasing the '1' threshold during calibration - the RMS value for the sine wave will be 0.5, so the previous code was making us take the ALSA mixer past 0dB. 2. Using the difference rather than absolute value for 0->1 transitions, so that we're somewhat independent noise in our calculations.
This commit is contained in:
		
							parent
							
								
									3f16c7100b
								
							
						
					
					
						commit
						36bdd720aa
					
				
					 1 changed files with 3 additions and 3 deletions
				
			
		| 
						 | 
					@ -158,7 +158,7 @@ static void read_cb(pa_stream *s, size_t nbytes, void *userdata) {
 | 
				
			||||||
         * straddle the 0->1 transition, raising the average power. We keep the
 | 
					         * straddle the 0->1 transition, raising the average power. We keep the
 | 
				
			||||||
         * definition of 1 tight in this case and detect the transition in the
 | 
					         * definition of 1 tight in this case and detect the transition in the
 | 
				
			||||||
         * next round. */
 | 
					         * next round. */
 | 
				
			||||||
        if (last < 0.5f && cur > 0.8f) {
 | 
					        if (cur - last > 0.4f) {
 | 
				
			||||||
            pa_gettimeofday(&tv_in);
 | 
					            pa_gettimeofday(&tv_in);
 | 
				
			||||||
            fprintf(stderr, "Latency %llu\n", (unsigned long long) pa_timeval_diff(&tv_in, &tv_out));
 | 
					            fprintf(stderr, "Latency %llu\n", (unsigned long long) pa_timeval_diff(&tv_in, &tv_out));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					@ -234,8 +234,8 @@ static void calibrate_read_cb(pa_stream *s, size_t nbytes, void *userdata) {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    switch (cal_state) {
 | 
					    switch (cal_state) {
 | 
				
			||||||
        case CALIBRATION_ONE:
 | 
					        case CALIBRATION_ONE:
 | 
				
			||||||
            /* Try to detect the sine wave */
 | 
					            /* Try to detect the sine wave. RMS is 0.5, */
 | 
				
			||||||
            if (rms(in, nsamp) < 0.8f) {
 | 
					            if (rms(in, nsamp) < 0.40f) {
 | 
				
			||||||
                confirm = 0;
 | 
					                confirm = 0;
 | 
				
			||||||
                v += 0.02f;
 | 
					                v += 0.02f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue