[pulseaudio-discuss] [PATCH v6 10/25] loopback: Do not skip audio at startup

Georg Chini georg at chini.tk
Sun Jun 5 19:05:13 UTC 2016


This is no longer necessary because the previous patch drops audio
until pop() is called the first time.

---
 src/modules/module-loopback.c | 36 ------------------------------------
 1 file changed, 36 deletions(-)

diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index aafe41b..23ef7ac 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -82,8 +82,6 @@ struct userdata {
     int64_t recv_counter;
     int64_t send_counter;
 
-    size_t skip;
-
     /* Values from command line configuration */
     pa_usec_t latency;
     pa_usec_t adjust_time;
@@ -339,26 +337,11 @@ static void memblockq_adjust(struct userdata *u, int32_t offset, bool allow_push
 /* Called from input thread context */
 static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk) {
     struct userdata *u;
-    pa_memchunk copy;
 
     pa_source_output_assert_ref(o);
     pa_source_output_assert_io_context(o);
     pa_assert_se(u = o->userdata);
 
-    if (u->skip >= chunk->length) {
-        u->skip -= chunk->length;
-        return;
-    }
-
-    if (u->skip > 0) {
-        copy = *chunk;
-        copy.index += u->skip;
-        copy.length -= u->skip;
-        u->skip = 0;
-
-        chunk = ©
-    }
-
     pa_asyncmsgq_post(u->asyncmsgq, PA_MSGOBJECT(u->sink_input), SINK_INPUT_MESSAGE_POST, NULL, 0, chunk, NULL);
     u->send_counter += (int64_t) chunk->length;
 }
@@ -478,24 +461,6 @@ static void source_output_detach_cb(pa_source_output *o) {
     }
 }
 
-/* Called from output thread context */
-static void source_output_state_change_cb(pa_source_output *o, pa_source_output_state_t state) {
-    struct userdata *u;
-
-    pa_source_output_assert_ref(o);
-    pa_source_output_assert_io_context(o);
-    pa_assert_se(u = o->userdata);
-
-    if (PA_SOURCE_OUTPUT_IS_LINKED(state) && o->thread_info.state == PA_SOURCE_OUTPUT_INIT) {
-
-        u->skip = pa_usec_to_bytes(PA_CLIP_SUB(pa_source_get_latency_within_thread(o->source),
-                                               u->latency),
-                                   &o->sample_spec);
-
-        pa_log_info("Skipping %lu bytes", (unsigned long) u->skip);
-    }
-}
-
 /* Called from main thread */
 static void source_output_kill_cb(pa_source_output *o) {
     struct userdata *u;
@@ -1096,7 +1061,6 @@ int pa__init(pa_module *m) {
     u->source_output->kill = source_output_kill_cb;
     u->source_output->attach = source_output_attach_cb;
     u->source_output->detach = source_output_detach_cb;
-    u->source_output->state_change = source_output_state_change_cb;
     u->source_output->may_move_to = source_output_may_move_to_cb;
     u->source_output->moving = source_output_moving_cb;
     u->source_output->suspend = source_output_suspend_cb;
-- 
2.8.1



More information about the pulseaudio-discuss mailing list