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

Michael Niedermayer michael at niedermayer.cc
Mon May 15 22:30:36 EEST 2023


On Sun, May 14, 2023 at 11:14:12PM -0400, Leo Izen wrote:
> 
> 
> On 5/14/23 20:05, Michael Niedermayer 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")
> > +            );
> > +
> > +        if (!av_match_ext    (p->filename, "m3u8,hls,m3u") &&
> > +             ff_match_url_ext(p->filename, "m3u8,hls,m3u") <= 0 &&
> What's the point of checking both av_match_ext and ff_match_url_ext here?
> Should only want one or the other.

is p->filename a URL ?


> > +            !mime_ok) {
> 
> Put !mime_ok first to take advantage of lazy &&, as it will usually be okay
> in practice.

ok, will reorder it

thx


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

Homeopathy is like voting while filling the ballot out with transparent ink.
Sometimes the outcome one wanted occurs. Rarely its worse than filling out
a ballot properly.
-------------- 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/05ce15c6/attachment.sig>


More information about the ffmpeg-devel mailing list