make sure to call process_rewind() under all circumstances before we do the next loop iteration

This commit is contained in:
Lennart Poettering 2008-06-26 02:56:00 +02:00
parent 1e36b57b13
commit eab1cb8df9
10 changed files with 69 additions and 39 deletions

View file

@ -882,7 +882,7 @@ static void sink_update_requested_latency_cb(pa_sink *s) {
if (u->hwbuf_unused_frames > before) {
pa_log_debug("Requesting rewind due to latency change.");
pa_sink_request_rewind(s, 0);
pa_sink_request_rewind(s, (size_t) -1);
}
}
@ -967,9 +967,12 @@ static void thread_func(void *userdata) {
int work_done;
pa_usec_t sleep_usec;
if (u->sink->thread_info.rewind_nbytes > 0)
if (process_rewind(u) < 0)
goto fail;
if (u->sink->thread_info.rewind_requested) {
if (u->sink->thread_info.rewind_nbytes <= 0)
pa_sink_process_rewind(u->sink, 0);
else if (process_rewind(u) < 0)
goto fail;
}
if (u->use_mmap)
work_done = mmap_write(u, &sleep_usec);

View file

@ -410,7 +410,6 @@ static void sink_input_process_rewind_cb(pa_sink_input *i, size_t nbytes) {
struct output *o;
pa_sink_input_assert_ref(i);
pa_assert(nbytes > 0);
pa_assert_se(o = i->userdata);
pa_memblockq_rewind(o->memblockq, nbytes);

View file

@ -204,6 +204,10 @@ static void thread_func(void *userdata) {
for (;;) {
int ret;
if (PA_SINK_IS_OPENED(u->sink->thread_info.state))
if (u->sink->thread_info.rewind_requested)
pa_sink_process_rewind(u->sink, 0);
if (u->rtpoll_item) {
struct pollfd *pollfd;
pollfd = pa_rtpoll_item_get_pollfd(u->rtpoll_item, NULL);

View file

@ -222,6 +222,10 @@ static void thread_func(void *userdata) {
for (;;) {
int ret;
if (PA_SINK_IS_OPENED(u->sink->thread_info.state))
if (u->sink->thread_info.rewind_requested)
pa_sink_process_rewind(u->sink, 0);
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0)
goto fail;

View file

@ -204,8 +204,12 @@ static void thread_func(void *userdata) {
now = pa_rtclock_usec();
if (u->sink->thread_info.rewind_nbytes > 0)
process_rewind(u, now);
if (u->sink->thread_info.rewind_requested) {
if (u->sink->thread_info.rewind_nbytes > 0)
process_rewind(u, now);
else
pa_sink_process_rewind(u->sink, 0);
}
if (u->timestamp <= now)
process_render(u, now);

View file

@ -184,8 +184,12 @@ static void thread_func(void *userdata) {
/* Render some data and write it to the fifo */
if (u->sink->thread_info.state == PA_SINK_RUNNING) {
if (u->sink->thread_info.rewind_nbytes > 0)
process_rewind(u);
if (u->sink->thread_info.rewind_requested) {
if (u->sink->thread_info.rewind_nbytes > 0)
process_rewind(u);
else
pa_sink_process_rewind(u->sink, 0);
}
if (pollfd->revents) {
if (process_render(u) < 0)

View file

@ -605,6 +605,12 @@ static void thread_func(void *userdata) {
for (;;) {
int ret;
#ifdef TUNNEL_SINK
if (PA_SINK_IS_OPENED(u->sink->thread_info.state))
if (u->sink->thread_info.rewind_requested)
pa_sink_process_rewind(u->sink, 0);
#endif
if ((ret = pa_rtpoll_run(u->rtpoll, TRUE)) < 0)
goto fail;