nsOggReader should always capture Theora granulepos

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
9 years ago
8 years ago

People

(Reporter: cpearce, Unassigned)

Tracking

Trunk
x86
All
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

I discovered a bug in OggIndex's decoder, and the same bug exists in nsOggReader.

When nsOggReader starts decoding Theora, it finds the first packet with a granulepos, and we increment that granulepos every time we read a subsequent packet, and use that as the packet's granulepos. If a packet already has a granulepos (because it's the last packet in the page) we overwrite the running granulepos with the incoming granulepos, since I found they can be different when there are gaps in the media.

This is wrong, it produces inconsistent results. When we seek to the "gap" page and capture granulepos there, we'll assign granulepos to the packets different to how we assign them when decoding the gap page from the previous granulepos capture.

In the "seek to the gap" case, we (correctly) assume the gap is before the first packet on the page, whereas with the "decoding from previous capture" case we'll assume the gap is before the last packet in the page.

ffmpeg output files with these gaps sometimes.

When we decode Theora, we should always read ahead until the packet with a non -1 granulepos, and propagate that backwards to assign granulepos to packets. We already have this code, we should just always use it and not try to keep a running granulepos for Theora.
Reporter

Updated

8 years ago
Depends on: 650994
Fixed by bug 650994.
Status: NEW → RESOLVED
Last Resolved: 8 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.