[PATCH] module-tunnel-sink-new: add a max_latency option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---
 src/modules/module-tunnel-sink-new.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/modules/module-tunnel-sink-new.c b/src/modules/module-tunnel-sink-new.c
index 802e6a59a..cf0f7905a 100644
--- a/src/modules/module-tunnel-sink-new.c
+++ b/src/modules/module-tunnel-sink-new.c
@@ -55,9 +55,10 @@ PA_MODULE_USAGE(
         "rate=<sample rate> "
         "channel_map=<channel map> "
         "cookie=<cookie file path>"
+	"max_latency=<latency in ms>"
         );
 
-#define MAX_LATENCY_USEC (200 * PA_USEC_PER_MSEC)
+#define DEFAULT_MAX_LATENCY_MSEC 200
 #define TUNNEL_THREAD_FAILED_MAINLOOP 1
 
 static void stream_state_cb(pa_stream *stream, void *userdata);
@@ -97,6 +98,7 @@ static const char* const valid_modargs[] = {
     "rate",
     "channel_map",
     "cookie",
+    "max_latency",
    /* "reconnect", reconnect if server comes back again - unimplemented */
     NULL,
 };
@@ -476,6 +478,7 @@ int pa__init(pa_module *m) {
     const char *remote_server = NULL;
     const char *sink_name = NULL;
     char *default_sink_name = NULL;
+    uint32_t max_latency_msec = DEFAULT_MAX_LATENCY_MSEC;
 
     pa_assert(m);
 
@@ -497,6 +500,11 @@ int pa__init(pa_module *m) {
         goto fail;
     }
 
+    if (pa_modargs_get_value_u32(ma, "max_latency", &max_latency_msec) < 0) {
+      pa_log("Failed to parse max_latency value.");
+      goto fail;
+    }
+
     u = pa_xnew0(struct userdata, 1);
     u->module = m;
     m->userdata = u;
@@ -561,7 +569,7 @@ int pa__init(pa_module *m) {
     u->sink->parent.process_msg = sink_process_msg_cb;
     u->sink->set_state_in_io_thread = sink_set_state_in_io_thread_cb;
     u->sink->update_requested_latency = sink_update_requested_latency_cb;
-    pa_sink_set_latency_range(u->sink, 0, MAX_LATENCY_USEC);
+    pa_sink_set_latency_range(u->sink, 0, max_latency_msec * PA_USEC_PER_MSEC);
 
     /* set thread message queue */
     pa_sink_set_asyncmsgq(u->sink, u->thread_mq->inq);
-- 
2.11.0

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss




[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux