[vlc-devel] commit: RTP: over UDP, assume we have the destination if there is no @ ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu Nov 26 18:35:02 CET 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu Nov 26 19:34:00 2009 +0200| [94f95f8faf07fab0f8757e18e984d3151fc7bbae] | committer: Rémi Denis-Courmont 

RTP: over UDP, assume we have the destination if there is no @

Previously, we'd assume we have the source address, which was confusing.

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

 modules/access/rtp/rtp.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/modules/access/rtp/rtp.c b/modules/access/rtp/rtp.c
index 2c28581..d29e26f 100644
--- a/modules/access/rtp/rtp.c
+++ b/modules/access/rtp/rtp.c
@@ -170,17 +170,26 @@ static int Open (vlc_object_t *obj)
         return VLC_EGENERIC;
 
     char *tmp = strdup (demux->psz_path);
-    char *shost = tmp;
-    if (shost == NULL)
+    if (tmp == NULL)
         return VLC_ENOMEM;
 
-    char *dhost = strchr (shost, '@');
-    if (dhost)
-        *dhost++ = '\0';
+    char *shost;
+    char *dhost = strchr (tmp, '@');
+    if (dhost != NULL)
+    {
+        *(dhost++) = '\0';
+        shost = tmp;
+    }
+    else
+    {
+        dhost = tmp;
+        shost = NULL;
+    }
 
     /* Parses the port numbers */
     int sport = 0, dport = 0;
-    sport = extract_port (&shost);
+    if (shost != NULL)
+        sport = extract_port (&shost);
     if (dhost != NULL)
         dport = extract_port (&dhost);
     if (dport == 0)
@@ -213,14 +222,14 @@ static int Open (vlc_object_t *obj)
 #ifdef SOCK_DCCP
             var_Create (obj, "dccp-service", VLC_VAR_STRING);
             var_SetString (obj, "dccp-service", "RTPV"); /* FIXME: RTPA? */
-            fd = net_Connect (obj, shost, sport, SOCK_DCCP, tp);
+            fd = net_Connect (obj, dhost, dport, SOCK_DCCP, tp);
 #else
             msg_Err (obj, "DCCP support not included");
 #endif
             break;
 
         case IPPROTO_TCP:
-            fd = net_Connect (obj, shost, sport, SOCK_STREAM, tp);
+            fd = net_Connect (obj, dhost, dport, SOCK_STREAM, tp);
             break;
     }
 




More information about the vlc-devel mailing list