[vlc-commits] rtsp: allow multicast port setting in transport section

Vityusha V. Vinokurov git at videolan.org
Wed May 23 20:36:28 CEST 2018


vlc/vlc-3.0 | branch: master | Vityusha V. Vinokurov <vit at trs-sut.ru> | Wed May 23 21:27:47 2018 +0300| [75aaaca3fd7dbb91d89c24d4c22df456d109dc49] | committer: Rémi Denis-Courmont

rtsp: allow multicast port setting in transport section

Modified-and-...
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>
(cherry picked from commit d2f16ee2a0a2e1588347ff23f0e3d8e32f45c4d9)
Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 modules/stream_out/rtsp.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c
index 35ee7e7776..52bc54fc9b 100644
--- a/modules/stream_out/rtsp.c
+++ b/modules/stream_out/rtsp.c
@@ -705,7 +705,9 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
                  tpt = transport_next( tpt ) )
             {
                 bool b_multicast = true, b_unsupp = false;
+                bool b_multicast_port_set = false;
                 unsigned loport = 5004, hiport; /* from RFC3551 */
+                unsigned mloport = 5004, mhiport = mloport + 1;
 
                 /* Check transport protocol. */
                 /* Currently, we only support RTP/AVP over UDP */
@@ -732,6 +734,10 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
                                 == 2 )
                         ;
                     else
+                    if( sscanf( opt, "port=%u-%u", &mloport, &mhiport )
+                                == 2 )
+                        b_multicast_port_set = true;
+                    else
                     if( strncmp( opt, "mode=", 5 ) == 0 )
                     {
                         if( strncasecmp( opt + 5, "play", 4 )
@@ -756,7 +762,7 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
                      * "source" and "append" are invalid (server-only);
                      * "ssrc" also (as clarified per RFC2326bis).
                      *
-                     * For multicast, "port", "layers", "ttl" are set by the
+                     * For multicast, "layers", "ttl" are set by the
                      * stream output configuration.
                      *
                      * For unicast, we want to decide "server_port" values.
@@ -780,6 +786,15 @@ static int RtspHandler( rtsp_stream_t *rtsp, rtsp_stream_id_t *id,
 
                     net_GetPeerAddress(id->mcast_fd, dst, &dport);
 
+                    /* Checking for multicast port override */
+                    if( b_multicast_port_set
+                     && ((unsigned)dport != mloport
+                      || (unsigned)dport + 1 != mhiport))
+                    {
+                        answer->i_status = 551;
+                        continue;
+                    }
+
                     ttl = var_InheritInteger(owner, "ttl");
                     if (ttl <= 0)
                     /* FIXME: the TTL is left to the OS default, we can



More information about the vlc-commits mailing list