[vlc-devel] commit: SAP: don't try to parse media subtype for now, should fix #1467 ( Rémi Denis-Courmont )

git version control git at videolan.org
Wed Mar 19 18:55:38 CET 2008


vlc | branch: 0.8.6-bugfix | Rémi Denis-Courmont <rdenis at simphalempin.com> | Wed Mar 19 19:36:32 2008 +0200| [29a99a61010ec44c61ca6c1614c116e4436e8b12]

SAP: don't try to parse media subtype for now, should fix #1467

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=29a99a61010ec44c61ca6c1614c116e4436e8b12
---

 modules/services_discovery/sap.c |   41 +++++++++++++++++++------------------
 1 files changed, 21 insertions(+), 20 deletions(-)

diff --git a/modules/services_discovery/sap.c b/modules/services_discovery/sap.c
index 8bda3cb..797099e 100644
--- a/modules/services_discovery/sap.c
+++ b/modules/services_discovery/sap.c
@@ -910,7 +910,7 @@ static int ParseConnection( vlc_object_t *p_obj, sdp_t *p_sdp )
     char *psz_eof = NULL;
     char *psz_parse = NULL;
     char *psz_uri = NULL;
-    char *psz_proto = NULL;
+    const char *psz_proto = NULL;
     char psz_source[258] = "";
     int i_port = 0;
 
@@ -1041,31 +1041,33 @@ static int ParseConnection( vlc_object_t *p_obj, sdp_t *p_sdp )
         if( psz_eof )
         {
             *psz_eof = '\0';
-            psz_proto = strdup( psz_parse );
-
-            psz_parse = psz_eof + 1;
-            p_sdp->i_media_type = atoi( psz_parse );
 
+            if( !strcmp( psz_parse, "RTP/AVP" ) )
+            {
+                psz_proto = "rtp";
+                p_sdp->i_media_type = atoi( psz_parse );
+            }
+            else
+            if( !strcasecmp( psz_parse, "udp" ) )
+            {
+                psz_proto = "udp";
+                p_sdp->i_media_type = 33;
+            }
+            else
+            {
+                msg_Warn( p_obj, "unknown transport protocol %s", psz_parse );
+                FREE( psz_uri );
+                return VLC_EGENERIC;
+            }
         }
         else
         {
-            msg_Dbg( p_obj, "incorrect m field, %s", p_sdp->psz_media );
-            p_sdp->i_media_type = 33;
-            psz_proto = strdup( psz_parse );
+            msg_Warn( p_obj, "unknown top parse m field (3)" );
+            FREE( psz_uri );
+            return VLC_EGENERIC;
         }
     }
 
-    if( psz_proto && !strncmp( psz_proto, "RTP/AVP", 7 ) )
-    {
-        free( psz_proto );
-        psz_proto = strdup( "rtp" );
-    }
-    if( psz_proto && !strncasecmp( psz_proto, "UDP", 3 ) )
-    {
-        free( psz_proto );
-        psz_proto = strdup( "udp" );
-    }
-
     /* FIXME: HTTP support */
 
     if( i_port == 0 )
@@ -1092,7 +1094,6 @@ static int ParseConnection( vlc_object_t *p_obj, sdp_t *p_sdp )
               psz_uri, i_port );
 
     FREE( psz_uri );
-    FREE( psz_proto );
     return VLC_SUCCESS;
 }
 




More information about the vlc-devel mailing list