changeset 5329:1ab113d6c45b libavformat

Use sdp c= line if the rtsp Transport line doesn't have a destination Transport:destination in rtsp is optional, c= line in sdp is compulsory Patch from Armand Bendanan (name.surnameATfreeDOTfr)
author lu_zero
date Sat, 24 Oct 2009 15:10:58 +0000
parents 2f2a94b37543
children 936a03bbd757
files rtsp.c
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/rtsp.c	Sat Oct 24 12:44:27 2009 +0000
+++ b/rtsp.c	Sat Oct 24 15:10:58 2009 +0000
@@ -1125,12 +1125,19 @@
             {
                 char url[1024];
                 struct in_addr in;
+                int port, ttl;
 
-                in.s_addr = htonl(reply->transports[0].destination);
+                if (reply->transports[0].destination) {
+                    in.s_addr = htonl(reply->transports[0].destination);
+                    port      = reply->transports[0].port_min;
+                    ttl       = reply->transports[0].ttl;
+                } else {
+                    in        = rtsp_st->sdp_ip;
+                    port      = rtsp_st->sdp_port;
+                    ttl       = rtsp_st->sdp_ttl;
+                }
                 snprintf(url, sizeof(url), "rtp://%s:%d?ttl=%d",
-                         inet_ntoa(in),
-                         reply->transports[0].port_min,
-                         reply->transports[0].ttl);
+                         inet_ntoa(in), port, ttl);
                 if (url_open(&rtsp_st->rtp_handle, url, URL_RDWR) < 0) {
                     err = AVERROR_INVALIDDATA;
                     goto fail;