[FFmpeg-cvslog] rtpproto: Allow specifying a separate rtcp port in ff_rtp_set_remote_url

Martin Storsjö git at videolan.org
Thu Aug 1 13:59:15 CEST 2013


ffmpeg | branch: master | Martin Storsjö <martin at martin.st> | Wed Jul 31 11:48:28 2013 +0300| [ee37d5811caa8f4ad125a37fe6ce3f9e66cd72f2] | committer: Martin Storsjö

rtpproto: Allow specifying a separate rtcp port in ff_rtp_set_remote_url

A separate rtcp port can already be set when opening the rtp
protocol normally, but when doing port setup as in RTSP (where
we first need to open the local ports and pass them to the peer,
and only then receive the remote peer port numbers), we didn't
check the same url parameter as in the normal open routine.

Signed-off-by: Martin Storsjö <martin at martin.st>

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

 libavformat/rtpproto.c |   13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index b21c121..974aa35 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -61,18 +61,27 @@ int ff_rtp_set_remote_url(URLContext *h, const char *uri)
 {
     RTPContext *s = h->priv_data;
     char hostname[256];
-    int port;
+    int port, rtcp_port;
+    const char *p;
 
     char buf[1024];
     char path[1024];
 
     av_url_split(NULL, 0, NULL, 0, hostname, sizeof(hostname), &port,
                  path, sizeof(path), uri);
+    rtcp_port = port + 1;
+
+    p = strchr(uri, '?');
+    if (p) {
+        if (av_find_info_tag(buf, sizeof(buf), "rtcpport", p)) {
+            rtcp_port = strtol(buf, NULL, 10);
+        }
+    }
 
     ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port, "%s", path);
     ff_udp_set_remote_url(s->rtp_hd, buf);
 
-    ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, port + 1, "%s", path);
+    ff_url_join(buf, sizeof(buf), "udp", NULL, hostname, rtcp_port, "%s", path);
     ff_udp_set_remote_url(s->rtcp_hd, buf);
     return 0;
 }



More information about the ffmpeg-cvslog mailing list