[pulseaudio-discuss] [PATCH] librtp: Accept both LF and CRLF after SDP header

Laurentiu Nicola lnicola at dend.ro
Thu Dec 26 06:02:19 PST 2013


---
 src/modules/rtp/sdp.c | 7 ++++++-
 src/modules/rtp/sdp.h | 2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/modules/rtp/sdp.c b/src/modules/rtp/sdp.c
index e47a41b..904c35f 100644
--- a/src/modules/rtp/sdp.c
+++ b/src/modules/rtp/sdp.c
@@ -66,7 +66,7 @@ char *pa_sdp_build(int af, const void *src, const void *dst, const char *name, u
     pa_assert_se(inet_ntop(af, dst, buf_dst, sizeof(buf_dst)));
 
     return pa_sprintf_malloc(
-            PA_SDP_HEADER
+            PA_SDP_HEADER "\n"
             "o=%s %lu 0 IN %s %s\n"
             "s=%s\n"
             "c=IN %s %s\n"
@@ -136,6 +136,11 @@ pa_sdp_info *pa_sdp_parse(const char *t, pa_sdp_info *i, int is_goodbye) {
 
     t += sizeof(PA_SDP_HEADER)-1;
 
+    if (*t == '\r')
+        t++;
+    if (*t == '\n')
+        t++;
+
     while (*t) {
         size_t l;
 
diff --git a/src/modules/rtp/sdp.h b/src/modules/rtp/sdp.h
index 4cb3b20..e13ca8a 100644
--- a/src/modules/rtp/sdp.h
+++ b/src/modules/rtp/sdp.h
@@ -28,7 +28,7 @@
 
 #include <pulse/sample.h>
 
-#define PA_SDP_HEADER "v=0\n"
+#define PA_SDP_HEADER "v=0"
 
 typedef struct pa_sdp_info {
     char *origin;
-- 
1.8.5.1



More information about the pulseaudio-discuss mailing list