[FFmpeg-devel,v2] avformat/utils: Fixes misdetection of zYLx.wav

Submitted by lance.lmwang@gmail.com on Nov. 7, 2019, 1:23 a.m.

Details

Message ID 20191107012317.23325-1-lance.lmwang@gmail.com
State New
Headers show

Commit Message

lance.lmwang@gmail.com Nov. 7, 2019, 1:23 a.m.
From: Limin Wang <lance.lmwang@gmail.com>

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
---
 libavformat/wavdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Carl Eugen Hoyos Nov. 7, 2019, 5:35 a.m.
> Am 07.11.2019 um 02:23 schrieb lance.lmwang@gmail.com:
> 
> From: Limin Wang <lance.lmwang@gmail.com>
> 
> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> ---
> libavformat/wavdec.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
> index 52194f54ef..109c931a22 100644
> --- a/libavformat/wavdec.c
> +++ b/libavformat/wavdec.c
> @@ -149,7 +149,8 @@ static int wav_probe(const AVProbeData *p)
> 
> static void handle_stream_probing(AVStream *st)
> {
> -    if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE) {
> +    if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE &&
> +        st->codecpar->sample_rate <= 0 && st->codecpar->channels <= 0) {

Doesn’t this break dca detection?

As said, you have to fix this issue in the mp3 probe function.

>         st->request_probe = AVPROBE_SCORE_EXTENSION;
>         st->probe_packets = FFMIN(st->probe_packets, 32);

Carl Eugen
lance.lmwang@gmail.com Nov. 7, 2019, 11:32 a.m.
On Thu, Nov 07, 2019 at 06:35:12AM +0100, Carl Eugen Hoyos wrote:
> 
> 
> > Am 07.11.2019 um 02:23 schrieb lance.lmwang@gmail.com:
> > 
> > From: Limin Wang <lance.lmwang@gmail.com>
> > 
> > Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
> > ---
> > libavformat/wavdec.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
> > index 52194f54ef..109c931a22 100644
> > --- a/libavformat/wavdec.c
> > +++ b/libavformat/wavdec.c
> > @@ -149,7 +149,8 @@ static int wav_probe(const AVProbeData *p)
> > 
> > static void handle_stream_probing(AVStream *st)
> > {
> > -    if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE) {
> > +    if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE &&
> > +        st->codecpar->sample_rate <= 0 && st->codecpar->channels <= 0) {
> 
> Doesn’t this break dca detection?
> 
> As said, you have to fix this issue in the mp3 probe function.

0000000 52 49 46 46 38 bd 7a 00 57 41 56 45 66 6d 74 20
0000010 10 00 00 00 01 00 02 00 44 ac 00 00 10 b1 02 00
0000020 04 00 10 00 64 61 74 61 38 bd 7a 00 ff ff e8 ff
0000030 ff ff e8 ff ff ff e8 ff ff ff e8 ff ff ff e8 ff


"ff ff e8 ff" is valid mp3 header and parse all of mp3 field, but the
pattern, we can observed the header repeat with "ff ff e8 ff", I think
this is invalid. So I can add one invalid check for the repeating 
condition which works for the sample only.  I can update the patch for 
review, it's change in the mp3 probe function.


> 
> >         st->request_probe = AVPROBE_SCORE_EXTENSION;
> >         st->probe_packets = FFMIN(st->probe_packets, 32);
> 
> Carl Eugen
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

Patch hide | download patch | download mbox

diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c
index 52194f54ef..109c931a22 100644
--- a/libavformat/wavdec.c
+++ b/libavformat/wavdec.c
@@ -149,7 +149,8 @@  static int wav_probe(const AVProbeData *p)
 
 static void handle_stream_probing(AVStream *st)
 {
-    if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE) {
+    if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16LE &&
+        st->codecpar->sample_rate <= 0 && st->codecpar->channels <= 0) {
         st->request_probe = AVPROBE_SCORE_EXTENSION;
         st->probe_packets = FFMIN(st->probe_packets, 32);
     }