rtspdec: Set the default port for listen mode, if none is specified

Message ID 1350029444-91564-1-git-send-email-martin@martin.st
State Committed
Commit 5a2cb78219168af7a0f446cd97dbac2d3c1868e6
Headers show

Commit Message

Martin Storsjö Oct. 12, 2012, 8:10 a.m.
---
 libavformat/rtspdec.c |    4 ++++
 1 file changed, 4 insertions(+)

Comments

Luca Barbato Oct. 12, 2012, 9:31 a.m. | #1
On 10/12/2012 10:10 AM, Martin Storsjö wrote:
> ---
>  libavformat/rtspdec.c |    4 ++++
>  1 file changed, 4 insertions(+)

OK.

Patch

diff --git a/libavformat/rtspdec.c b/libavformat/rtspdec.c
index 7476c45..c0797ad 100644
--- a/libavformat/rtspdec.c
+++ b/libavformat/rtspdec.c
@@ -621,6 +621,10 @@  static int rtsp_listen(AVFormatContext *s)
     /* ff_url_join. No authorization by now (NULL) */
     ff_url_join(rt->control_uri, sizeof(rt->control_uri), "rtsp", NULL, host,
                 port, "%s", path);
+
+    if (port < 0)
+        port = RTSP_DEFAULT_PORT;
+
     /* Create TCP connection */
     ff_url_join(tcpname, sizeof(tcpname), "tcp", NULL, host, port,
                 "?listen&listen_timeout=%d", rt->initial_timeout * 1000);