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

Vityusha V. Vinokurov vit at trs-sut.ru
Fri Apr 6 12:52:36 CEST 2018


Good day!

>> ---
>>   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..135af74 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;
> 
> This seems needlessly convoluted. Why don't you check immediately that the
> requested ports pair matches the configuration?

No. Coz to check ports matching we need to call 
net_GetPeerAddress(id->mcast_fd, dst, &dport)
At first to call of this function (here and later) more expensive then 
setting one boolean variable. And at second we not sure about multicast 
at this place, so id->mcast_fd may be undefined here.

>> +                    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.
> 
> Err, no. VLC does not allow the client to override the multicast port.
> This is done on purpose for safety/security reasons.
> 
> Changing this comment is wrong and misleading IMO.

I remove "port" word only because my patch checked this one.

Plz see that my patch don't allow to override the multicast port, so 
behavior of VLC stay unchanged.

-- 
Best Regards!
---
Victor V. Vinokurov
http://projectn.spb.ru


More information about the vlc-devel mailing list