[PATCH] module-zeroconf-discovery: Add parameter for switching to new tunnel modules

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

 



Add boolean parameter 'use_new_tunnel' to add ability to use
module-tunnel-{sink,source}-new instead of old
module-tunnel-{sink,source} modules. This parameter is false by default
for maintain behaviour compatible.

The new tunnel module don't send 'early requests' flag to server and
allow to tune latency, by using adjust latency mode and by propagating of
tlength buffer attribute from stream to server. This can be useful
during of setting up networking audio via Wi-Fi.
---
 src/modules/module-zeroconf-discover.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/modules/module-zeroconf-discover.c b/src/modules/module-zeroconf-discover.c
index 612e2ed49..271beae32 100644
--- a/src/modules/module-zeroconf-discover.c
+++ b/src/modules/module-zeroconf-discover.c
@@ -46,11 +46,15 @@ PA_MODULE_AUTHOR("Lennart Poettering");
 PA_MODULE_DESCRIPTION("mDNS/DNS-SD Service Discovery");
 PA_MODULE_VERSION(PACKAGE_VERSION);
 PA_MODULE_LOAD_ONCE(true);
+PA_MODULE_USAGE(
+        "use_new_tunnel=<use module-tunnel-{sink,source}-new for tunnels?>"
+        );
 
 #define SERVICE_TYPE_SINK "_pulse-sink._tcp"
 #define SERVICE_TYPE_SOURCE "_non-monitor._sub._pulse-source._tcp"
 
 static const char* const valid_modargs[] = {
+    "use_new_tunnel",
     NULL
 };
 
@@ -67,6 +71,7 @@ struct userdata {
     AvahiPoll *avahi_poll;
     AvahiClient *client;
     AvahiServiceBrowser *source_browser, *sink_browser;
+    bool use_new_tunnel;
 
     pa_hashmap *tunnels;
 };
@@ -219,7 +224,8 @@ static void resolver_cb(
             (a->data.ipv6.address[1] & 0xc0) == 0x80)
             if_suffix = pa_sprintf_malloc("%%%d", interface);
 
-        module_name = pa_sprintf_malloc("module-tunnel-%s", t);
+        module_name = pa_sprintf_malloc("module-tunnel-%s%s", t,
+                                        u->use_new_tunnel ? "-new" : "");
         args = pa_sprintf_malloc("server=[%s%s]:%u "
                                  "%s=%s "
                                  "format=%s "
@@ -384,6 +390,7 @@ int pa__init(pa_module*m) {
 
     struct userdata *u;
     pa_modargs *ma = NULL;
+    bool use_new_tunnel = false;
     int error;
 
     if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
@@ -396,6 +403,12 @@ int pa__init(pa_module*m) {
     u->module = m;
     u->sink_browser = u->source_browser = NULL;
 
+    if (pa_modargs_get_value_boolean(ma, "use_new_tunnel", &use_new_tunnel) < 0) {
+        pa_log("Failed to parse use_new_tunnel= argument.");
+        goto fail;
+    }
+    u->use_new_tunnel = use_new_tunnel;
+
     u->tunnels = pa_hashmap_new(tunnel_hash, tunnel_compare);
 
     u->avahi_poll = pa_avahi_poll_new(m->core->mainloop);
-- 
2.20.1

_______________________________________________
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