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

Hajime Fujita crisp.fujita at nifty.com
Sat Sep 7 09:35:11 PDT 2013


From: Martin Blanchard <tinram at gmx.fr>

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



More information about the pulseaudio-discuss mailing list