[FFmpeg-devel] [PATCH] libavformat/rtsp: Fix rtsps, do not force tcp transport

Yannick Poirier yannick.poirier at inverto.tv
Thu Jan 21 10:23:52 CET 2016


rtsp over ssl is not working. tls does not implement prot->url_get_file_handle so ffurl_get_file_handle() fails.
struct sockaddr_storage peer is initialized but not used, remove it.
rtsps lower transport was set to TCP. Transport could be UDP. It permits to use RTSPS + SRTP.

---
  libavformat/rtsp.c | 15 +--------------
  1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index 39539e9..25451fb 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1651,13 +1651,11 @@ int ff_rtsp_connect(AVFormatContext *s)
      char proto[128], host[1024], path[1024];
      char tcpname[1024], cmd[2048], auth[128];
      const char *lower_rtsp_proto = "tcp";
-    int port, err, tcp_fd;
+    int port, err;
      RTSPMessageHeader reply1 = {0}, *reply = &reply1;
      int lower_transport_mask = 0;
      int default_port = RTSP_DEFAULT_PORT;
      char real_challenge[64] = "";
-    struct sockaddr_storage peer;
-    socklen_t peer_len = sizeof(peer);
  
      if (rt->rtp_port_max < rt->rtp_port_min) {
          av_log(s, AV_LOG_ERROR, "Invalid UDP port range, max port %d less "
@@ -1688,7 +1686,6 @@ redirect:
      if (!strcmp(proto, "rtsps")) {
          lower_rtsp_proto         = "tls";
          default_port             = RTSPS_DEFAULT_PORT;
-        rt->lower_transport_mask = 1 << RTSP_LOWER_TRANSPORT_TCP;
      }
  
      if (*auth) {
@@ -1809,16 +1806,6 @@ redirect:
      }
      rt->seq = 0;
  
-    tcp_fd = ffurl_get_file_handle(rt->rtsp_hd);
-    if (tcp_fd < 0) {
-        err = tcp_fd;
-        goto fail;
-    }
-    if (!getpeername(tcp_fd, (struct sockaddr*) &peer, &peer_len)) {
-        getnameinfo((struct sockaddr*) &peer, peer_len, host, sizeof(host),
-                    NULL, 0, NI_NUMERICHOST);
-    }
-
      /* request options supported by the server; this also detects server
       * type */
      for (rt->server_type = RTSP_SERVER_RTP;;) {
-- 
2.6.4



More information about the ffmpeg-devel mailing list