[vlc-devel] commit: RTP: implement separate option for RTCP receive port ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Jan 11 19:10:21 CET 2009


vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sun Jan 11 20:02:55 2009 +0200| [f0969553a4ae3a00d3ba5f1201e6d4e1733dfff4] | committer: Rémi Denis-Courmont 

RTP: implement separate option for RTCP receive port

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

 modules/access/rtp/rtp.c |   21 +++++++++++++++------
 1 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/modules/access/rtp/rtp.c b/modules/access/rtp/rtp.c
index f9a39d0..88fab06 100644
--- a/modules/access/rtp/rtp.c
+++ b/modules/access/rtp/rtp.c
@@ -4,7 +4,7 @@
  */
 /*****************************************************************************
  * Copyright (C) 2001-2005 the VideoLAN team
- * Copyright © 2007-2008 Rémi Denis-Courmont
+ * Copyright © 2007-2009 Rémi Denis-Courmont
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License
@@ -42,6 +42,11 @@
 #define RTP_CACHING_LONGTEXT N_( \
     "How long to wait for late RTP packets (and delay the performance)." )
 
+#define RTCP_PORT_TEXT N_("RTCP (local) port")
+#define RTCP_PORT_LONGTEXT N_( \
+    "RTCP packets will be received on this transport protocol port. " \
+    "If zero, multiplexed RTP/RTCP is used.")
+
 #define SRTP_KEY_TEXT N_("SRTP key (hexadecimal)")
 #define SRTP_KEY_LONGTEXT N_( \
     "RTP packets will be authenticated and deciphered "\
@@ -86,6 +91,10 @@ vlc_module_begin ()
     add_integer ("rtp-caching", 1000, NULL, RTP_CACHING_TEXT,
                  RTP_CACHING_LONGTEXT, true)
         change_integer_range (0, 65535)
+    add_integer ("rtcp-port", 0, NULL, RTCP_PORT_TEXT,
+                 RTCP_PORT_LONGTEXT, false)
+        change_integer_range (0, 65535)
+        change_safe ()
     add_string ("srtp-key", "", NULL,
                 SRTP_KEY_TEXT, SRTP_KEY_LONGTEXT, false)
     add_string ("srtp-salt", "", NULL,
@@ -172,6 +181,8 @@ static int Open (vlc_object_t *obj)
     if (dport == 0)
         dport = 5004; /* avt-profile-1 port */
 
+    int rtcp_dport = var_CreateGetInteger (obj, "rtcp-port");
+
     /* Try to connect */
     int fd = -1, rtcp_fd = -1;
 
@@ -179,15 +190,13 @@ static int Open (vlc_object_t *obj)
     {
         case IPPROTO_UDP:
         case IPPROTO_UDPLITE:
-            if ((dport & 1) != 0 || (sport & 1) != 0)
-                msg_Err (obj, "Using odd port number is higly discouraged");
-
             fd = net_OpenDgram (obj, dhost, dport,
                                 shost, sport, AF_UNSPEC, tp);
             if (fd == -1)
                 break;
-            rtcp_fd = net_OpenDgram (obj, dhost, dport + 1, shost,
-                                     sport ? (sport + 1) : 0, AF_UNSPEC, tp);
+            if (rtcp_dport > 0) /* XXX: source port is unknown */
+                rtcp_fd = net_OpenDgram (obj, dhost, rtcp_dport, shost, 0,
+                                         AF_UNSPEC, tp);
             break;
 
          case IPPROTO_DCCP:




More information about the vlc-devel mailing list