mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	echo-cancel: Fix assert with webrtc's built-in drift compensation
The webrtc canceller seems to have changed to require that the set_stream_drift_samples() method be called before every call of ProcessStream(). So we now call ec->set_stream_drift_samples() before calling ec->record() by: 1. Always calling do_push_drift_comp() instead of only when the sink is running 2. Calling set_stream_drift_samples() in the loop with record() instead of outside We do kind of leak this quirk of the webrtc canceller into the generic bits of module-echo-cancel, but this should not be harmful in the general case either.
This commit is contained in:
		
							parent
							
								
									2530eb8d1b
								
							
						
					
					
						commit
						2de5fc222e
					
				
					 1 changed files with 3 additions and 5 deletions
				
			
		| 
						 | 
					@ -731,9 +731,6 @@ static void do_push_drift_comp(struct userdata *u) {
 | 
				
			||||||
    u->sink_rem = plen % u->sink_blocksize;
 | 
					    u->sink_rem = plen % u->sink_blocksize;
 | 
				
			||||||
    u->source_rem = rlen % u->source_output_blocksize;
 | 
					    u->source_rem = rlen % u->source_output_blocksize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* Now let the canceller work its drift compensation magic */
 | 
					 | 
				
			||||||
    u->ec->set_drift(u->ec, drift);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    if (u->save_aec) {
 | 
					    if (u->save_aec) {
 | 
				
			||||||
        if (u->drift_file)
 | 
					        if (u->drift_file)
 | 
				
			||||||
            fprintf(u->drift_file, "d %a\n", drift);
 | 
					            fprintf(u->drift_file, "d %a\n", drift);
 | 
				
			||||||
| 
						 | 
					@ -773,6 +770,7 @@ static void do_push_drift_comp(struct userdata *u) {
 | 
				
			||||||
        cchunk.memblock = pa_memblock_new(u->source->core->mempool, cchunk.length);
 | 
					        cchunk.memblock = pa_memblock_new(u->source->core->mempool, cchunk.length);
 | 
				
			||||||
        cdata = pa_memblock_acquire(cchunk.memblock);
 | 
					        cdata = pa_memblock_acquire(cchunk.memblock);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        u->ec->set_drift(u->ec, drift);
 | 
				
			||||||
        u->ec->record(u->ec, rdata, cdata);
 | 
					        u->ec->record(u->ec, rdata, cdata);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (u->save_aec) {
 | 
					        if (u->save_aec) {
 | 
				
			||||||
| 
						 | 
					@ -941,8 +939,8 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk)
 | 
				
			||||||
        u->sink_skip -= to_skip;
 | 
					        u->sink_skip -= to_skip;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /* process and push out samples, do drift compensation only if the sink is actually running */
 | 
					    /* process and push out samples */
 | 
				
			||||||
    if (u->ec->params.drift_compensation && u->sink->thread_info.state == PA_SINK_RUNNING)
 | 
					    if (u->ec->params.drift_compensation)
 | 
				
			||||||
        do_push_drift_comp(u);
 | 
					        do_push_drift_comp(u);
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        do_push(u);
 | 
					        do_push(u);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue