Message ID | 20191029094520.30679-1-onemda@gmail.com |
---|---|
State | New |
Headers | show |
On Tue, Oct 29, 2019 at 10:45:20AM +0100, Paul B Mahol wrote: > Fixes decoding of wav file which is wrongly recognized as mp1 audio. > > Signed-off-by: Paul B Mahol <onemda@gmail.com> > --- > libavformat/utils.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavformat/utils.c b/libavformat/utils.c > index cfb6d03397..bf27531ed0 100644 > --- a/libavformat/utils.c > +++ b/libavformat/utils.c > @@ -370,7 +370,7 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st, > if (fmt_id_type[i].type != AVMEDIA_TYPE_AUDIO && > st->codecpar->sample_rate) > continue; > - if (st->request_probe > score && > + if (st->request_probe > score || > st->codecpar->codec_id != fmt_id_type[i].id) > continue; this change is wrong and would break fate, the 2nd term could be removed if it causes problems but they cannot be run as "||" how can this issue be reproduced ? thx [...]
On 10/29/19, Michael Niedermayer <michael@niedermayer.cc> wrote: > On Tue, Oct 29, 2019 at 10:45:20AM +0100, Paul B Mahol wrote: >> Fixes decoding of wav file which is wrongly recognized as mp1 audio. >> >> Signed-off-by: Paul B Mahol <onemda@gmail.com> >> --- >> libavformat/utils.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavformat/utils.c b/libavformat/utils.c >> index cfb6d03397..bf27531ed0 100644 >> --- a/libavformat/utils.c >> +++ b/libavformat/utils.c >> @@ -370,7 +370,7 @@ static int set_codec_from_probe_data(AVFormatContext >> *s, AVStream *st, >> if (fmt_id_type[i].type != AVMEDIA_TYPE_AUDIO && >> st->codecpar->sample_rate) >> continue; >> - if (st->request_probe > score && >> + if (st->request_probe > score || >> st->codecpar->codec_id != fmt_id_type[i].id) >> continue; > > this change is wrong and would break fate, > the 2nd term could be removed if it causes problems but they cannot > be run as "||" > > how can this issue be reproduced ? > https://0x0.st/zYLx.wav > thx > > [...] > > -- > Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB > > Freedom in capitalist society always remains about the same as it was in > ancient Greek republics: Freedom for slave owners. -- Vladimir Lenin >
Am Di., 29. Okt. 2019 um 13:15 Uhr schrieb Paul B Mahol <onemda@gmail.com>: > > On 10/29/19, Michael Niedermayer <michael@niedermayer.cc> wrote: > > On Tue, Oct 29, 2019 at 10:45:20AM +0100, Paul B Mahol wrote: > >> Fixes decoding of wav file which is wrongly recognized as mp1 audio. > >> > >> Signed-off-by: Paul B Mahol <onemda@gmail.com> > >> --- > >> libavformat/utils.c | 2 +- > >> 1 file changed, 1 insertion(+), 1 deletion(-) > >> > >> diff --git a/libavformat/utils.c b/libavformat/utils.c > >> index cfb6d03397..bf27531ed0 100644 > >> --- a/libavformat/utils.c > >> +++ b/libavformat/utils.c > >> @@ -370,7 +370,7 @@ static int set_codec_from_probe_data(AVFormatContext > >> *s, AVStream *st, > >> if (fmt_id_type[i].type != AVMEDIA_TYPE_AUDIO && > >> st->codecpar->sample_rate) > >> continue; > >> - if (st->request_probe > score && > >> + if (st->request_probe > score || > >> st->codecpar->codec_id != fmt_id_type[i].id) > >> continue; > > > > this change is wrong and would break fate, > > the 2nd term could be removed if it causes problems but they cannot > > be run as "||" > > > > how can this issue be reproduced ? > > > > https://0x0.st/zYLx.wav This repeated pcm_s16le pattern triggers the mp3 misdetection (score 51 after 4096 bytes): 00000000 ff ff e8 ff ff ff e8 ff ff ff e8 ff ff ff e8 ff |................| * Carl Eugen
diff --git a/libavformat/utils.c b/libavformat/utils.c index cfb6d03397..bf27531ed0 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -370,7 +370,7 @@ static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st, if (fmt_id_type[i].type != AVMEDIA_TYPE_AUDIO && st->codecpar->sample_rate) continue; - if (st->request_probe > score && + if (st->request_probe > score || st->codecpar->codec_id != fmt_id_type[i].id) continue; st->codecpar->codec_id = fmt_id_type[i].id;
Fixes decoding of wav file which is wrongly recognized as mp1 audio. Signed-off-by: Paul B Mahol <onemda@gmail.com> --- libavformat/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)