mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	send PA_SINK_MESSAGE_REMOVE_INPUT only when an asyncmsgq is available, reset resampler only when we really need to
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/glitch-free@2354 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									d2be471ed2
								
							
						
					
					
						commit
						d2da344fee
					
				
					 1 changed files with 8 additions and 7 deletions
				
			
		| 
						 | 
					@ -349,6 +349,7 @@ void pa_sink_input_unlink(pa_sink_input *i) {
 | 
				
			||||||
    i->state = PA_SINK_INPUT_UNLINKED;
 | 
					    i->state = PA_SINK_INPUT_UNLINKED;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (linked)
 | 
					    if (linked)
 | 
				
			||||||
 | 
					        if (i->sink->asyncmsgq)
 | 
				
			||||||
            pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i->sink), PA_SINK_MESSAGE_REMOVE_INPUT, i, 0, NULL);
 | 
					            pa_asyncmsgq_send(i->sink->asyncmsgq, PA_MSGOBJECT(i->sink), PA_SINK_MESSAGE_REMOVE_INPUT, i, 0, NULL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    reset_callbacks(i);
 | 
					    reset_callbacks(i);
 | 
				
			||||||
| 
						 | 
					@ -639,7 +640,7 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam
 | 
				
			||||||
                max_rewrite = pa_resampler_request(i->thread_info.resampler, max_rewrite);
 | 
					                max_rewrite = pa_resampler_request(i->thread_info.resampler, max_rewrite);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Calculate how much of the rewinded data should actually be rewritten */
 | 
					            /* Calculate how much of the rewinded data should actually be rewritten */
 | 
				
			||||||
            amount = PA_MIN(max_rewrite, i->thread_info.rewrite_nbytes);
 | 
					            amount = PA_MIN(i->thread_info.rewrite_nbytes, max_rewrite);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Convert back to to sink domain */
 | 
					            /* Convert back to to sink domain */
 | 
				
			||||||
            r = i->thread_info.resampler ? pa_resampler_result(i->thread_info.resampler, amount) : amount;
 | 
					            r = i->thread_info.resampler ? pa_resampler_result(i->thread_info.resampler, amount) : amount;
 | 
				
			||||||
| 
						 | 
					@ -648,18 +649,18 @@ void pa_sink_input_process_rewind(pa_sink_input *i, size_t nbytes /* in sink sam
 | 
				
			||||||
                /* Ok, now update the write pointer */
 | 
					                /* Ok, now update the write pointer */
 | 
				
			||||||
                pa_memblockq_seek(i->thread_info.render_memblockq, -r, PA_SEEK_RELATIVE);
 | 
					                pa_memblockq_seek(i->thread_info.render_memblockq, -r, PA_SEEK_RELATIVE);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (amount) {
 | 
					            if (amount > 0) {
 | 
				
			||||||
                pa_log_debug("Have to rewind %lu bytes on implementor.", (unsigned long) amount);
 | 
					                pa_log_debug("Have to rewind %lu bytes on implementor.", (unsigned long) amount);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                /* Tell the implementor */
 | 
					                /* Tell the implementor */
 | 
				
			||||||
                if (i->process_rewind)
 | 
					                if (i->process_rewind)
 | 
				
			||||||
                    i->process_rewind(i, amount);
 | 
					                    i->process_rewind(i, amount);
 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
                /* And reset the resampler */
 | 
					                /* And reset the resampler */
 | 
				
			||||||
                if (i->thread_info.resampler)
 | 
					                if (i->thread_info.resampler)
 | 
				
			||||||
                    pa_resampler_reset(i->thread_info.resampler);
 | 
					                    pa_resampler_reset(i->thread_info.resampler);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        i->thread_info.rewrite_nbytes = 0;
 | 
					        i->thread_info.rewrite_nbytes = 0;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue