Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#10837 closed defect (fixed)

mp3_read_header might break seekback

Reported by: noseglid Owned by:
Priority: important Component: avformat
Version: 6.1 Keywords: mp3 regression
Cc: Marton Balint Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I've found an issue in ffmpeg 6.x.x and greater - and I've tracked it down to this commit: ​https://git.ffmpeg.org/gitweb/ffmpeg.git/commitdiff/0d17f5228f4d3854066ec1001f69c7d1714b0df9

What happens here is that it tries to minimize the amount of seeks - but this breaks the ffio_ensure_seekback calls.

ffio_ensure_seekback ensures seekback from the current position in the buffer.

As the loop no longer seeks back to the beginning of the buffer every iteration of, it might move the buffer ahead of off.

Before returning, it tries to reset the position to off or off+i depending if there's junk or not. If the buffer has moved ahead of this it will either;

  • Invoke a real seek if there is a seek function
  • Fail with AVERROR(EPIPE) if there is not.

I think either this commit has to be reversed - or it must ensure seekback for the maximum bytes it might read (64*1024+4) before the loop starts.

Attachments (1)

0001-avformat-mp3dec-only-call-ffio_ensure_seekback-once.patch​ (1.3 KB ) - added by Marton Balint 3 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 by noseglid, 3 years ago

Priority: normal → important
Version: unspecified → 6.1

comment:2 by noseglid, 3 years ago

Any chance we can get some eyes on this? It's stopping us from upgrading to the latest ffmpeg version.

comment:3 by Marton Balint, 3 years ago

Cc: Marton Balint added
Keywords: regression added

Can you try the attached patch?

comment:4 by noseglid, 3 years ago

Yes, the suggested fix works well! Thank you

comment:5 by Marton Balint, 2 years ago

Resolution: → fixed
Status: new → closed
Note: See TracTickets for help on using tickets.