[vlc-devel] [PATCH] input: Fill psz_location
Hugo Beauzée-Luyssen
hugo at beauzee.fr
Mon Feb 11 16:42:16 CET 2019
Hi,
On Mon, Feb 11, 2019, at 4:29 PM, Rémi Denis-Courmont wrote:
> Le maanantaina 11. helmikuuta 2019, 17.08.27 EET Hugo Beauzée-Luyssen a écrit
> :
> > While I'm not sure if psz_location being NULL when using
> > vlc_stream_NewURL is by design, I can't find logic relying on it.
> > ---
> > src/input/access.c | 3 +++
> > src/input/stream_filter.c | 4 ++++
> > 2 files changed, 7 insertions(+)
> >
> > diff --git a/src/input/access.c b/src/input/access.c
> > index b4f1531ff6..1ddf82ec0c 100644
> > --- a/src/input/access.c
> > +++ b/src/input/access.c
> > @@ -319,6 +319,9 @@ stream_t *stream_AccessNew(vlc_object_t *parent,
> > input_thread_t *input, vlc_stream_Delete(access);
> > return NULL;
> > }
> > + const char *p = strstr(s->psz_url, "://");
> > + assert(p != NULL);
> > + s->psz_location = p + 3;
>
> I don't think that the assertion is valid. And that's kind of the problem with
> psz_location.
>
AFAICS access_New will return NULL if the url doesn't contain "://", so at this point strstr shouldn't return NULL.
> > if (access->pf_block != NULL)
> > s->pf_block = AStreamReadBlock;
> > diff --git a/src/input/stream_filter.c b/src/input/stream_filter.c
> > index b18eefa4ad..65f243fe31 100644
> > --- a/src/input/stream_filter.c
> > +++ b/src/input/stream_filter.c
> > @@ -69,6 +69,10 @@ stream_t *vlc_stream_FilterNew( stream_t *p_source,
> >
> > if( p_source->psz_filepath != NULL )
> > s->psz_filepath = strdup( p_source->psz_filepath );
> > +
> > + const char *p = strstr(s->psz_url, "://");
> > + assert(p != NULL);
> > + s->psz_location = p + 3;
However I'm less sure about this one. My understanding is that we assume that an MRL will contain a scheme, but if that doesn't hold, I can definitely remove the assert here.
Regards,
--
Hugo Beauzée-Luyssen
hugo at beauzee.fr
More information about the vlc-devel
mailing list