Skip to content

Commit c205778

Browse files
committed
avformat/aacdec: enable probesize-sized resyncs mid-stream
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
1 parent 855014f commit c205778

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libavformat/aacdec.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,12 @@ static int adts_aac_probe(const AVProbeData *p)
8383
static int adts_aac_resync(AVFormatContext *s)
8484
{
8585
uint16_t state;
86+
int64_t start_pos = avio_tell(s->pb);
8687

8788
// skip data until an ADTS frame is found
8889
state = avio_r8(s->pb);
89-
while (!avio_feof(s->pb) && avio_tell(s->pb) < s->probesize) {
90+
while (!avio_feof(s->pb) &&
91+
(avio_tell(s->pb) - start_pos) < s->probesize) {
9092
state = (state << 8) | avio_r8(s->pb);
9193
if ((state >> 4) != 0xFFF)
9294
continue;

0 commit comments

Comments
 (0)