[FFmpeg-devel] [PATCH 3/3] avformat/hls: Try to implement RFC8216 playlist refusal

Michael Niedermayer michael at niedermayer.cc
Mon May 15 22:44:54 EEST 2023


On Mon, May 15, 2023 at 11:58:16AM +0200, Kacper Michajlow wrote:
> On Mon, 15 May 2023 at 02:06, Michael Niedermayer
> <michael at niedermayer.cc> wrote:
> >
> > This is not well tested and can likely be improved, just a
> > hotfix for hls probe failures since 6b1f68ccb04d791f0250e05687c346a99ff47ea1
> >
> > Should fix Ticket10353 (please test and report cases that still fail)
> >
> > Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> > ---
> >  libavformat/hls.c | 11 ++++++++++-
> >  1 file changed, 10 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavformat/hls.c b/libavformat/hls.c
> > index df2442c376..790ae7a96a 100644
> > --- a/libavformat/hls.c
> > +++ b/libavformat/hls.c
> > @@ -2534,7 +2534,16 @@ static int hls_probe(const AVProbeData *p)
> >          strstr(p->buf, "#EXT-X-TARGETDURATION:") ||
> >          strstr(p->buf, "#EXT-X-MEDIA-SEQUENCE:")) {
> >
> > -        if (!av_match_ext(p->filename, "m3u8,hls,m3u")) {
> > +        int mime_ok = p->mime_type && !(
> > +            av_strcasecmp(p->mime_type, "application/vnd.apple.mpegurl") &&
> > +            av_strcasecmp(p->mime_type, "audio/mpegurl") &&
> > +            av_strcasecmp(p->mime_type, "audio/x-mpegurl") &&
> > +            av_strcasecmp(p->mime_type, "application/x-mpegurl")
> 
> How about we AV_LOG_WARNING when non-standard/deprecated mime type is
> used? If we want to be strict about rfc8216 only two first should be
> supported. Of course for compatibility reasons likely we need to
> support all of them, but warn about it would be nice touch.

ok

> 
> > +            );
> > +
> > +        if (!av_match_ext    (p->filename, "m3u8,hls,m3u") &&
> > +             ff_match_url_ext(p->filename, "m3u8,hls,m3u") <= 0 &&
> 
> Where '.hls' came from? I don't think those are in fact used in the
> wild? Maybe we can be strict and use only "m3u8,m3u"?

i was thinking of it but i left them in yesterday. Ill post a patch
that would remove them.
I have a few files ending in hls but none of them qualify as "in the wild"


> 
> > +            !mime_ok) {
> >              av_log(NULL, AV_LOG_ERROR, "Not detecting m3u8/hls with non standard extension\n");
> 
> This log wording is little bit off now, when there is no extension and
> only mime matching.

will post a patch

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

It is dangerous to be right in matters on which the established authorities
are wrong. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230515/d7cbe701/attachment.sig>


More information about the ffmpeg-devel mailing list