[01/10] loopback: Do not detect underruns during initial latency adjustments

Submitted by Georg Chini on April 9, 2018, 5:16 p.m.

Details

Message ID 20180409171707.17696-2-georg@chini.tk
State New
Series "loopback: Optimize latency stabilization"
Headers show

Commit Message

Georg Chini April 9, 2018, 5:16 p.m.
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.
---
 src/modules/module-loopback.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 31702e32..32780380 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -906,7 +906,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 */