[vlc-devel] [PATCH] srt: add streamid option

Alexandre Janniaux ajanni at videolabs.io
Wed Oct 28 11:53:49 CET 2020


On Wed, Oct 28, 2020 at 11:51:58AM +0100, Ÿnérant wrote:
> Hi,
>
> Le mer. 28 oct. 2020 à 10:35, Marvin Scholz <epirat07 at gmail.com> a écrit :
>
> > Hi,
> >
> > On 28 Oct 2020, at 0:57, Ÿnérant wrote:
> >
> > > diff --git a/modules/access/srt.c b/modules/access/srt.c
> > > index 499a300196..ae8ba2a84f 100644
> > > --- a/modules/access/srt.c
> > > +++ b/modules/access/srt.c
> > > @@ -97,6 +97,8 @@ static bool srt_schedule_reconnect(stream_t
> > > *p_stream)
> > >      int stat;
> > >      char *psz_passphrase = var_InheritString( p_stream,
> > > SRT_PARAM_PASSPHRASE );
> > >      bool passphrase_needs_free = true;
> > > +    char *psz_streamid = var_InheritString( p_stream,
> > > SRT_PARAM_STREAMID );
> > > +    bool streamid_needs_free = true;
> >
> > Instead of a separate bool for this, maybe just always strdup?
>
>
> I copied what was written for the passphrase, I don't know if we could
> write better. I am not a C programmer, so I don't know how to optimize
> memory, I'm sorry.
>
> >
> > >      char *url = NULL;
> > >      srt_params_t params;
> > >      struct addrinfo hints = {
> > > @@ -145,6 +147,11 @@ static bool srt_schedule_reconnect(stream_t
> > > *p_stream)
> > >                  passphrase_needs_free = false;
> > >                  psz_passphrase = (char *) params.passphrase;
> > >              }
> > > +    if (params.streamid != NULL ) {
> > > + free( psz_streamid );
> > > + streamid_needs_free = false;
> > > + psz_streamid = (char *) params.streamid;
> > > +    }
> > >          }
> > >      }
> > >
> > > @@ -164,7 +171,7 @@ static bool srt_schedule_reconnect(stream_t
> > > *p_stream)
> > >
> > >      /* Set latency */
> > >      srt_set_socket_option( strm_obj, SRT_PARAM_LATENCY, p_sys->sock,
> > > -            SRTO_TSBPDDELAY, &i_latency, sizeof(i_latency) );
> > > +            SRTO_LATENCY, &i_latency, sizeof(i_latency) );
> >
> > This change seems unrelated to this patch?
>
>
> Hum yeah, but without this change, the code is not compiling, since it uses
> deprecated SRT api. I left it since it is only one line...

I'll merge the already submitted patch fixing that right now. ;)

Regards,
--
Alexandre Janniaux
Videolabs


More information about the vlc-devel mailing list