always forward rewind requests to the sink, and don't abort on nbytes=0

This commit is contained in:
Lennart Poettering 2008-06-26 19:43:45 +02:00
parent d08cac0f85
commit 9f0afb391a
2 changed files with 6 additions and 9 deletions

View file

@ -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 */
static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
size_t amount = 0;
struct userdata *u;
pa_sink_input_assert_ref(i);
pa_assert_se(u = i->userdata);
pa_assert(nbytes > 0);
if (!u->sink || !PA_SINK_IS_OPENED(u->sink->thread_info.state))
return;
if (u->sink->thread_info.rewind_nbytes > 0) {
size_t amount;
amount = PA_MIN(u->sink->thread_info.rewind_nbytes, nbytes);
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 */