mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	always forward rewind requests to the sink, and don't abort on nbytes=0
This commit is contained in:
		
							parent
							
								
									d08cac0f85
								
							
						
					
					
						commit
						9f0afb391a
					
				
					 2 changed files with 6 additions and 9 deletions
				
			
		| 
						 | 
					@ -217,16 +217,16 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
 | 
				
			||||||
/* Called from I/O thread context */
 | 
					/* Called from I/O thread context */
 | 
				
			||||||
static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
 | 
					static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
 | 
				
			||||||
    struct userdata *u;
 | 
					    struct userdata *u;
 | 
				
			||||||
 | 
					    size_t amount = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_sink_input_assert_ref(i);
 | 
					    pa_sink_input_assert_ref(i);
 | 
				
			||||||
    pa_assert_se(u = i->userdata);
 | 
					    pa_assert_se(u = i->userdata);
 | 
				
			||||||
    pa_assert(nbytes > 0);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
 | 
					    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (u->sink->thread_info.rewind_nbytes > 0) {
 | 
					    if (u->sink->thread_info.rewind_nbytes > 0) {
 | 
				
			||||||
        size_t max_rewrite, amount;
 | 
					        size_t max_rewrite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        max_rewrite = nbytes + pa_memblockq_get_length(u->memblockq);
 | 
					        max_rewrite = nbytes + pa_memblockq_get_length(u->memblockq);
 | 
				
			||||||
        amount = PA_MIN(u->sink->thread_info.rewind_nbytes, max_rewrite);
 | 
					        amount = PA_MIN(u->sink->thread_info.rewind_nbytes, max_rewrite);
 | 
				
			||||||
| 
						 | 
					@ -236,7 +236,6 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
 | 
				
			||||||
            unsigned c;
 | 
					            unsigned c;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE);
 | 
					            pa_memblockq_seek(u->memblockq, - (int64_t) amount, PA_SEEK_RELATIVE);
 | 
				
			||||||
            pa_sink_process_rewind(u->sink, amount);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            pa_log_debug("Resetting plugin");
 | 
					            pa_log_debug("Resetting plugin");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -250,6 +249,7 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_sink_process_rewind(u->sink, amount);
 | 
				
			||||||
    pa_memblockq_rewind(u->memblockq, nbytes);
 | 
					    pa_memblockq_rewind(u->memblockq, nbytes);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -152,24 +152,21 @@ static int sink_input_pop_cb(pa_sink_input *i, size_t nbytes, pa_memchunk *chunk
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Called from I/O thread context */
 | 
					/* Called from I/O thread context */
 | 
				
			||||||
static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
 | 
					static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
 | 
				
			||||||
 | 
					    size_t amount = 0;
 | 
				
			||||||
    struct userdata *u;
 | 
					    struct userdata *u;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    pa_sink_input_assert_ref(i);
 | 
					    pa_sink_input_assert_ref(i);
 | 
				
			||||||
    pa_assert_se(u = i->userdata);
 | 
					    pa_assert_se(u = i->userdata);
 | 
				
			||||||
    pa_assert(nbytes > 0);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
 | 
					    if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
 | 
				
			||||||
        return;
 | 
					        return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (u->sink->thread_info.rewind_nbytes > 0) {
 | 
					    if (u->sink->thread_info.rewind_nbytes > 0) {
 | 
				
			||||||
        size_t amount;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        amount = PA_MIN(u->sink->thread_info.rewind_nbytes, nbytes);
 | 
					        amount = PA_MIN(u->sink->thread_info.rewind_nbytes, nbytes);
 | 
				
			||||||
        u->sink->thread_info.rewind_nbytes = 0;
 | 
					        u->sink->thread_info.rewind_nbytes = 0;
 | 
				
			||||||
 | 
					 | 
				
			||||||
        if (amount > 0)
 | 
					 | 
				
			||||||
            pa_sink_process_rewind(u->sink, amount);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_sink_process_rewind(u->sink, amount);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/* Called from I/O thread context */
 | 
					/* Called from I/O thread context */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue