[PATCH 22/25] raop: Support for devices capable with both TCP and UDP

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

 



From: Martin Blanchard <tinram@xxxxxx>

Some devices (e.g. AirPort Express 2nd gen?) support both TCP and
UDP protocol. This patch recognizes such a case.

Also, this patch prefers UDP. That is, if a device is announcing
both TCP and UDP capabilities, PulseAudio will connect to it via
UDP protocol.

Commit message written by Hajime Fujita.
---
 src/modules/raop/module-raop-discover.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/src/modules/raop/module-raop-discover.c b/src/modules/raop/module-raop-discover.c
index 6fec06c..0058410 100644
--- a/src/modules/raop/module-raop-discover.c
+++ b/src/modules/raop/module-raop-discover.c
@@ -173,9 +173,16 @@ static void resolver_cb(
         pa_log_debug("Found key: '%s' with value: '%s'", key, value);
 
         if (pa_streq(key, "tp")) {
-            /* Transport protocol */
-            tp = value;
-            value = NULL;
+            /* Transport protocol:
+             *  - TCP = only TCP,
+             *  - UDP = only UDP,
+             *  - TCP,UDP = both supported (UDP should be prefered) */
+             if (pa_str_in_list(value, ",", "UDP"))
+                 tp = strdup("UDP");
+            else if (pa_str_in_list(value, ",", "TCP"))
+                tp = strdup("TCP");
+            else
+                tp = strdup(value);
         } else if (pa_streq(key, "et")) {
             /* Supported encryption types:
              *  - 0 = none,
-- 
1.8.1.2



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

  Powered by Linux