loopback: Do not detect underruns during initial latency adjustments

Currently module-loopback detects underruns even if sink_input_pop_cb()
was not yet called twice and initial latency adjustments are active.
This leads to unnecessary rewind requests.

This patch delays detecting underruns until the initial adjustments
are done.

Part-of: <https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/56>
This commit is contained in:
Georg Chini 2020-01-27 19:09:40 +01:00
parent fa3b66d249
commit e7abd862b1

View file

@ -941,7 +941,8 @@ static int sink_input_process_msg_cb(pa_msgobject *obj, int code, void *data, in
* right-away */
if (u->sink_input->sink->thread_info.state != PA_SINK_SUSPENDED &&
u->sink_input->thread_info.underrun_for > 0 &&
pa_memblockq_is_readable(u->memblockq)) {
pa_memblockq_is_readable(u->memblockq) &&
u->output_thread_info.pop_called) {
pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(u->msg), LOOPBACK_MESSAGE_UNDERRUN, NULL, 0, NULL, NULL);
/* If called from within the pop callback skip the rewind */