Opened 10 years ago

Closed 10 years ago

#3124 closed defect (fixed)

Wrong PTS when seeking in Opus file

Reported by: Tuukka Pasanen Owned by:
Priority: minor Component: avformat
Version: git-master Keywords: Opus, ogg
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no


Seeking in Opus file with ffprobe/ffplay everything seems work fine. PTS changes correctly and all works as expected.
Scenario when one wants to seek to X PTS in file and then read Y bytes after that jump Y bytes ahead to read next Y bytes one gets the same output as first readied Y bytes.
If you just keep doing that reading procedure after next Z times you just get new loop to read on. This bug somehow follows the OggS-headers and granule points in Ogg-container. It seems you always got Y bytes from start of the last header-point. On Ogg/Vorbis with or without libvorbis everything works with same code. have example application to demo this bug report.

Attachments (2)

ogg-seek.c (2.0 KB ) - added by Dale Curtis 10 years ago.
detodos.opus (6.1 KB ) - added by Dale Curtis 10 years ago.

Download all attachments as: .zip

Change History (4)

by Dale Curtis, 10 years ago

Attachment: ogg-seek.c added

by Dale Curtis, 10 years ago

Attachment: detodos.opus added

comment:1 by Dale Curtis, 10 years ago

I believe we're seeing the same issue in Chrome. Specifically, PTS values are going backwards on granule boundaries. There also appears to be issues with the oggopus_private data not being reset after seek (so cur_dts increases forever), but I'm not sure that matters.

I've attached a test case and test file which repro this issue. You can build it like so:

clang ogg-seek.c -lavformat -lavcodec -lavutil -lopus -lpthread -lz
./a.out detodos.opus​

You'll see some pts printouts followed by a seek, and then eventually the pts goes backwards in time:

pts: 134088 -- dts: 134088
pts: 95688 -- dts: 95688 <------------ BACKWARDS!

comment:2 by Michael Niedermayer, 10 years ago

Keywords: ogg added
Reproduced by developer: set
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.