Message ID | 20210927224715.29476-1-jeebjp@gmail.com |
---|---|
State | Accepted |
Commit | c20577806f0a161c6867e72f884d020a253de10a |
Headers | show |
Series | [FFmpeg-devel,v2] avformat/aacdec: enable probesize-sized resyncs mid-stream | expand |
Context | Check | Description |
---|---|---|
andriy/make_x86 | success | Make finished |
andriy/make_fate_x86 | success | Make fate finished |
andriy/make_ppc | success | Make finished |
andriy/make_fate_ppc | success | Make fate finished |
On 9/27/2021 7:47 PM, Jan Ekström wrote: > Before adts_aac_resync would always bail out after probesize amount > of bytes had been progressed from the start of the input. > > Now just query the current position when entering resync, and at most > advance probesize amount of data from that start position. > > Fixes #9433 > --- > libavformat/aacdec.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c > index ab97be60b5..a476640904 100644 > --- a/libavformat/aacdec.c > +++ b/libavformat/aacdec.c > @@ -83,10 +83,12 @@ static int adts_aac_probe(const AVProbeData *p) > static int adts_aac_resync(AVFormatContext *s) > { > uint16_t state; > + int64_t start_pos = avio_tell(s->pb); > > // skip data until an ADTS frame is found > state = avio_r8(s->pb); > - while (!avio_feof(s->pb) && avio_tell(s->pb) < s->probesize) { > + while (!avio_feof(s->pb) && > + (avio_tell(s->pb) - start_pos) < s->probesize) { > state = (state << 8) | avio_r8(s->pb); > if ((state >> 4) != 0xFFF) > continue; LGTM.
On Tue, Sep 28, 2021 at 10:55 PM James Almer <jamrial@gmail.com> wrote: > > On 9/27/2021 7:47 PM, Jan Ekström wrote: > > Before adts_aac_resync would always bail out after probesize amount > > of bytes had been progressed from the start of the input. > > > > Now just query the current position when entering resync, and at most > > advance probesize amount of data from that start position. > > > > Fixes #9433 > > --- > > libavformat/aacdec.c | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c > > index ab97be60b5..a476640904 100644 > > --- a/libavformat/aacdec.c > > +++ b/libavformat/aacdec.c > > @@ -83,10 +83,12 @@ static int adts_aac_probe(const AVProbeData *p) > > static int adts_aac_resync(AVFormatContext *s) > > { > > uint16_t state; > > + int64_t start_pos = avio_tell(s->pb); > > > > // skip data until an ADTS frame is found > > state = avio_r8(s->pb); > > - while (!avio_feof(s->pb) && avio_tell(s->pb) < s->probesize) { > > + while (!avio_feof(s->pb) && > > + (avio_tell(s->pb) - start_pos) < s->probesize) { > > state = (state << 8) | avio_r8(s->pb); > > if ((state >> 4) != 0xFFF) > > continue; > > LGTM. Thanks. Applied as c20577806f0a161c6867e72f884d020a253de10a . Jan
diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c index ab97be60b5..a476640904 100644 --- a/libavformat/aacdec.c +++ b/libavformat/aacdec.c @@ -83,10 +83,12 @@ static int adts_aac_probe(const AVProbeData *p) static int adts_aac_resync(AVFormatContext *s) { uint16_t state; + int64_t start_pos = avio_tell(s->pb); // skip data until an ADTS frame is found state = avio_r8(s->pb); - while (!avio_feof(s->pb) && avio_tell(s->pb) < s->probesize) { + while (!avio_feof(s->pb) && + (avio_tell(s->pb) - start_pos) < s->probesize) { state = (state << 8) | avio_r8(s->pb); if ((state >> 4) != 0xFFF) continue;