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

Rémi Denis-Courmont remi at remlab.net
Mon Apr 30 17:53:59 CEST 2018


Le perjantaina 20. huhtikuuta 2018, 15.02.51 EEST Vityusha V. Vinokurov a 
écrit :
> Please review this patch
> 
> ---
>  modules/stream_out/rtsp.c | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/modules/stream_out/rtsp.c b/modules/stream_out/rtsp.c
> index 35ee7e7..5c7e6f5 100644
> --- a/modules/stream_out/rtsp.c
> +++ b/modules/stream_out/rtsp.c
> @@ -704,8 +704,9 @@ static int RtspHandler( rtsp_stream_t *rtsp,
> rtsp_stream_id_t *id, tpt != NULL;
>                   tpt = transport_next( tpt ) )
>              {
> -                bool b_multicast = true, b_unsupp = false;
> +                bool b_multicast = true, b_unsupp = false,
> 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 +733,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 +761,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 +785,13 @@ 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 && (dport != mloport || 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

Sorry for the delay.

I wonder if it would not be simpler to move getpeername() up.

-- 
雷米‧德尼-库尔蒙
http://www.remlab.net/





More information about the vlc-devel mailing list