[FFmpeg-devel] [PATCH] Consistent use of user_agent in hls.c

Jan Berkel jan at berkel.fr
Fri Feb 17 17:16:14 EET 2017


> 2017-02-17 12:00 GMT+01:00 Jan Berkel <jan at berkel.fr>:
> > This came up while debugging a problem with mpv:
> > https://github.com/mpv-player/mpv/issues/4155
> > ---
> >  libavformat/hls.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/libavformat/hls.c b/libavformat/hls.c
> > index 3ae3c7cc5c..e1163a7927 100644
> > --- a/libavformat/hls.c
> > +++ b/libavformat/hls.c
> > @@ -670,7 +670,7 @@ static int parse_playlist(HLSContext *c, const char *url,
> >          av_dict_set(&opts, "seekable", "0", 0);
> >
> >          // broker prior HTTP options that should be consistent across requests
> > -        av_dict_set(&opts, "user-agent", c->user_agent, 0);
> > +        av_dict_set(&opts, "user_agent", c->user_agent, 0);
> 
> Why is the code in http.c line 1048 not triggered that
> should use the "user-agent" in case it was defined?. 

In my case the user_agent_* properties on HTTPContext never got set.

The problem is that there is some client  code (mpv in this case) 
which uses "user_agent":

https://github.com/mpv-player/mpv/blob/master/stream/stream_lavf.c#L205
 av_dict_set(dict, "user_agent", opts->useragent, 0);

This value should then be read from hls.c:1626

update_options(&c->user_agent, "user-agent", u);

I'm new to both mpv and ffmeg development so not exactly sure 
how this should be fixed. The result of the discussion on the mpv
github issue was that ffmpeg needs to be changed, since user-agent
is deprecated. 

         Jan


More information about the ffmpeg-devel mailing list