[FFmpeg-devel] [PATCH 01/10] avformat/hls: fix repeated requests for media init section

"zhilizhao(赵志立)" quinkblack at foxmail.com
Tue Apr 12 16:26:32 EEST 2022



> On Apr 12, 2022, at 7:45 PM, mypopy at gmail.com wrote:
> 
> On Tue, Apr 12, 2022 at 4:15 PM Zhao Zhili <quinkblack at foxmail.com> wrote:
>> 
>> ---
>> libavformat/hls.c | 59 ++++++++++++++++++++++++++++++++---------------
>> 1 file changed, 40 insertions(+), 19 deletions(-)
>> 
> Can these patches handle multiple instances of the media init sections?

Before and after the patch, struct playlist do take multiple media
initialization sections into consideration. However, I think it doesn’t
work for HLS as a whole. To support multiple media init sections, it
needs to handle EXT-X-DISCONTINUITY and recreate mp4 demuxer.

So even if new media init section is show up, it will be downloaded and
then dropped by mp4 muxer:
```
    if (c->found_moov) {
        av_log(c->fc, AV_LOG_WARNING, "Found duplicated MOOV Atom. Skipped it\n");
        avio_skip(pb, atom.size);
        return 0;
    }
```

What the patch does is to avoid downloading the same init sections again
and again, and then dropped by mp4 muxer. It’s common to have init section
repeat in live mode.

Just for reference, hls.js had the same issue, and have been fixed by

https://github.com/video-dev/hls.js/pull/4452

> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



More information about the ffmpeg-devel mailing list