diff mbox series

[FFmpeg-devel,2/4] avformat/hls: Check mime_ok first

Message ID 20230516004918.13505-2-michael@niedermayer.cc
State Accepted
Commit a0cb5722fda9bd03b7be31a83b043966f0fd71b8
Headers show
Series [FFmpeg-devel,1/4] avformat/format: Remove redundant FFMIN() in ff_match_url_ext() | expand

Commit Message

Michael Niedermayer May 16, 2023, 12:49 a.m. UTC
This should be a few nano seconds faster (not measureable)
But Collectively the whole humankind watching hls will safe a minute

Found-by: Leo Izen

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/hls.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/hls.c b/libavformat/hls.c
index 425df3b26b..fc29ef0ca9 100644
--- a/libavformat/hls.c
+++ b/libavformat/hls.c
@@ -2541,9 +2541,9 @@  static int hls_probe(const AVProbeData *p)
             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 &&
-            !mime_ok) {
+        if (!mime_ok &&
+            !av_match_ext    (p->filename, "m3u8,hls,m3u") &&
+             ff_match_url_ext(p->filename, "m3u8,hls,m3u") <= 0) {
             av_log(NULL, AV_LOG_ERROR, "Not detecting m3u8/hls with non standard extension\n");
             return 0;
         }