[FFmpeg-devel] [PATCH 2/3] lavf/hls: don't copy empty options; silences HTTP CRLF warnings

wm4 nfxjfg at googlemail.com
Mon Sep 21 10:44:02 CEST 2015


On Mon, 21 Sep 2015 03:37:46 -0500
Rodger Combs <rodger.combs at gmail.com> wrote:

> 
> > On Sep 21, 2015, at 02:39, wm4 <nfxjfg at googlemail.com> wrote:
> > 
> > On Sun, 20 Sep 2015 21:55:34 -0500
> > Rodger Combs <rodger.combs at gmail.com <mailto:rodger.combs at gmail.com>> wrote:
> > 
> >> ---
> >> libavformat/hls.c | 12 ++++++++----
> >> 1 file changed, 8 insertions(+), 4 deletions(-)
> >> 
> >> diff --git a/libavformat/hls.c b/libavformat/hls.c
> >> index c16c770..a5073ff 100644
> >> --- a/libavformat/hls.c
> >> +++ b/libavformat/hls.c
> >> @@ -1317,10 +1317,14 @@ static int save_avio_options(AVFormatContext *s)
> >> 
> >>     while (*opt) {
> >>         if (av_opt_get(s->pb, *opt, AV_OPT_SEARCH_CHILDREN, &buf) >= 0) {
> >> -            ret = av_dict_set(&c->avio_opts, *opt, buf,
> >> -                              AV_DICT_DONT_STRDUP_VAL);
> >> -            if (ret < 0)
> >> -                return ret;
> >> +            if (strlen(buf)) {
> >> +                ret = av_dict_set(&c->avio_opts, *opt, buf,
> >> +                                  AV_DICT_DONT_STRDUP_VAL);
> >> +                if (ret < 0)
> >> +                    return ret;
> >> +            } else {
> >> +                av_free(buf);
> >> +            }
> >>         }
> >>         opt++;
> >>     }
> > 
> > I guess this looks good, but I don't understand why it's needed.
> 
> av_opt_get returns av_strdup("") when it finds a string value of NULL.

Oh, that's odd. Makes sense then.


More information about the ffmpeg-devel mailing list