[ogg-dev] A question on ogg_packet->packetno for corrupted streams

Timothy B. Terriberry tterribe at xiph.org
Thu Dec 10 12:53:25 PST 2015

Daniel Armyr wrote:
> Is there something here I am misunderstanding with how packetno works?

Probably. packetno is not stored in the stream. The demuxer makes it up 
from whole cloth. Each _page_ has a sequence number that does get stored 
in the stream.

When the demuxer sees a gap in page sequence numbers, it knows that some 
data was lost, but not how many packets it was contained in. So it 
increments packetno an extra time to signal to applications that only 
looks at packetno and not page-level sequence numbers that there was a 
gap. But there's no guarantee that the numbers that are returned will 
match what would have been returned before the corruption.

In other words, the fact that the numbers in packetno are not 
consecutive is significant, but the actual value of those numbers is not.

More information about the ogg-dev mailing list