diff mbox series

[FFmpeg-devel] lavf/img2dec: Return a low score for mjpeg when probing jpeg_pipe

Message ID CAB0OVGpQJHqt7YLsWKshzHLYjM7dHXM8GPXsjb1zMLDG9L_0_Q@mail.gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] lavf/img2dec: Return a low score for mjpeg when probing jpeg_pipe | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate warning Make fate failed

Commit Message

Carl Eugen Hoyos Dec. 9, 2020, 10:38 p.m. UTC
Hi!

Attached patch fixes ticket #9026.

Please comment, Carl Eugen
Subject: [PATCH] lavf/img2dec: Return a low score for mjpeg when probing
 jpeg_pipe.

Fixes ticket #9026.
---
 libavformat/img2dec.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Carl Eugen Hoyos Dec. 9, 2020, 10:43 p.m. UTC | #1
Am Mi., 9. Dez. 2020 um 23:38 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:

> Attached patch fixes ticket #9026.

Alternative patch attached.

Carl Eugen
Michael Niedermayer Dec. 10, 2020, 10:58 p.m. UTC | #2
On Wed, Dec 09, 2020 at 11:43:49PM +0100, Carl Eugen Hoyos wrote:
> Am Mi., 9. Dez. 2020 um 23:38 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> 
> > Attached patch fixes ticket #9026.
> 
> Alternative patch attached.
> 
> Carl Eugen

>  rawdec.c |    2 ++
>  1 file changed, 2 insertions(+)
> e23a6c24d563b05c5f5e7bb333dc882bf2bdc33a  0001-lavf-rawdec-Return-a-low-score-if-the-mjpeg-probe-fu.patch
> From eff71dca7111042cf696f47267ba311a5565629f Mon Sep 17 00:00:00 2001
> From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
> Date: Wed, 9 Dec 2020 23:42:33 +0100
> Subject: [PATCH] lavf/rawdec: Return a low score if the mjpeg probe function
>  detected one frame.
> 
> Fixes ticket #9026.
> ---
>  libavformat/rawdec.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
> index 10c37c5cb9..122afca1b6 100644
> --- a/libavformat/rawdec.c
> +++ b/libavformat/rawdec.c
> @@ -208,6 +208,8 @@ static int mjpeg_probe(const AVProbeData *p)
>              return AVPROBE_SCORE_EXTENSION / 2;
>          return AVPROBE_SCORE_EXTENSION / 4;
>      }
> +    if (!nb_invalid && nb_frames)
> +        return AVPROBE_SCORE_EXTENSION / 4;
>  

returnung a non zero score here seems reasonable

thx


>      return 0;

[...]
Carl Eugen Hoyos Dec. 10, 2020, 11:25 p.m. UTC | #3
Am Do., 10. Dez. 2020 um 23:59 Uhr schrieb Michael Niedermayer
<michael@niedermayer.cc>:
>
> On Wed, Dec 09, 2020 at 11:43:49PM +0100, Carl Eugen Hoyos wrote:
> > Am Mi., 9. Dez. 2020 um 23:38 Uhr schrieb Carl Eugen Hoyos <ceffmpeg@gmail.com>:
> >
> > > Attached patch fixes ticket #9026.
> >
> > Alternative patch attached.
> >
> > Carl Eugen
>
> >  rawdec.c |    2 ++
> >  1 file changed, 2 insertions(+)
> > e23a6c24d563b05c5f5e7bb333dc882bf2bdc33a  0001-lavf-rawdec-Return-a-low-score-if-the-mjpeg-probe-fu.patch
> > From eff71dca7111042cf696f47267ba311a5565629f Mon Sep 17 00:00:00 2001
> > From: Carl Eugen Hoyos <ceffmpeg@gmail.com>
> > Date: Wed, 9 Dec 2020 23:42:33 +0100
> > Subject: [PATCH] lavf/rawdec: Return a low score if the mjpeg probe function
> >  detected one frame.
> >
> > Fixes ticket #9026.
> > ---
> >  libavformat/rawdec.c | 2 ++
> >  1 file changed, 2 insertions(+)
> >
> > diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c
> > index 10c37c5cb9..122afca1b6 100644
> > --- a/libavformat/rawdec.c
> > +++ b/libavformat/rawdec.c
> > @@ -208,6 +208,8 @@ static int mjpeg_probe(const AVProbeData *p)
> >              return AVPROBE_SCORE_EXTENSION / 2;
> >          return AVPROBE_SCORE_EXTENSION / 4;
> >      }
> > +    if (!nb_invalid && nb_frames)
> > +        return AVPROBE_SCORE_EXTENSION / 4;
> >
>
> returnung a non zero score here seems reasonable

Patch applied.

Thank you, Carl Eugen
diff mbox series

Patch

diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
index 4f9bfc635a..faa67d0562 100644
--- a/libavformat/img2dec.c
+++ b/libavformat/img2dec.c
@@ -760,7 +760,11 @@  static int jpeg_probe(const AVProbeData *p)
         c = b[i + 1];
         switch (c) {
         case SOI:
-            return 0;
+            if (state == EOI) {
+                return AVPROBE_SCORE_EXTENSION / 8;
+            } else {
+                return 0;
+            }
         case SOF0:
         case SOF1:
         case SOF2: