This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

The following commit(s) were added to refs/heads/master by this push:
     new 0f3d20ebf6 avformat/cavsvideodec: reduce probe score for prefixed 
streams
0f3d20ebf6 is described below

commit 0f3d20ebf6f04a38fa83cee6189eec82e7e3fcba
Author:     Xiujun Wang <[email protected]>
AuthorDate: Thu Sep 24 20:15:18 2026 +0800
Commit:     Peter Ross <[email protected]>
CommitDate: Thu Nov 5 20:10:04 2026 +0000

    avformat/cavsvideodec: reduce probe score for prefixed streams
    
    cavsvideo_probe() returns a high score whenever it finds a valid
    sequence and picture start code, even when the sequence header appears
    only after unrelated leading data. This can make valid JPEG files probe
    as CAVS.
    
    Keep the high score when the sequence header is at the start of the
    probed stream. Otherwise return AVPROBE_SCORE_EXTENSION / 2 so stronger
    probes can win.
    
    Signed-off-by: Xiujun Wang <[email protected]>
---
 libavformat/cavsvideodec.c | 7 +++++--
 tests/fate/probe.mak       | 3 +++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavformat/cavsvideodec.c b/libavformat/cavsvideodec.c
index 5c2ed4a94f..0028b7dcb1 100644
--- a/libavformat/cavsvideodec.c
+++ b/libavformat/cavsvideodec.c
@@ -33,7 +33,7 @@
 static int cavsvideo_probe(const AVProbeData *p)
 {
     uint32_t code= -1;
-    int pic=0, seq=0, slice_pos = 0;
+    int pic=0, seq=0, slice_pos = 0, seq_at_start = 0;
     const uint8_t *ptr = p->buf, *end = p->buf + p->buf_size;
 
     while (ptr < end) {
@@ -49,6 +49,8 @@ static int cavsvideo_probe(const AVProbeData *p)
             }
             if (code == CAVS_SEQ_START_CODE) {
                 seq++;
+                if (ptr == p->buf + 4)
+                    seq_at_start = 1;
                 if (*ptr != AV_PROFILE_CAVS_JIZHUN &&
                     *ptr != AV_PROFILE_CAVS_BROADCASTING)
                     return 0;
@@ -62,7 +64,8 @@ static int cavsvideo_probe(const AVProbeData *p)
         }
     }
     if(seq && seq*9<=pic*10)
-        return AVPROBE_SCORE_EXTENSION+1;
+        return seq_at_start ? AVPROBE_SCORE_EXTENSION + 1 :
+                              AVPROBE_SCORE_EXTENSION / 2;
     return 0;
 }
 
diff --git a/tests/fate/probe.mak b/tests/fate/probe.mak
index 55a8729888..1bde37b0ab 100644
--- a/tests/fate/probe.mak
+++ b/tests/fate/probe.mak
@@ -32,6 +32,9 @@ fate-probe-format-png-concat: CMD = probefmt 
$(TARGET_SAMPLES)/png1/feed_4x_conc
 FATE_PROBE_FORMAT-$(call ALLYES, IMAGE_TIFF_PIPE_DEMUXER MPEGTS_DEMUXER) += 
fate-probe-format-tiff-not-mpegts
 fate-probe-format-tiff-not-mpegts: REF = tiff_pipe
 
+FATE_PROBE_FORMAT-$(call ALLYES, IMAGE_JPEG_PIPE_DEMUXER CAVSVIDEO_DEMUXER) += 
fate-probe-format-jpeg-not-cavsvideo
+fate-probe-format-jpeg-not-cavsvideo: REF = jpeg_pipe
+
 FATE_PROBE_FORMAT = $(FATE_PROBE_FORMAT-yes)
 
 FATE_SAMPLES_FFPROBE += $(FATE_PROBE_FORMAT)

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to