[ogg-dev] Question regarding Ogg’s multiplexing process
Dai, Weijia
daiweiji at amazon.com
Fri Dec 13 01:15:14 UTC 2019
Hi,
I have a question regarding Ogg’s multiplexing process.
Let’s say we have two logical streams, S1 and S2, which need to be muxed together into one physical stream. On logical stream S1, we have a packet that’s too big and needs to be split into two pages, P1 and P2. On the other hand, logical stream S2 also has a page Px that needs to go out. When these 2 logical streams are muxed together, on the resulting physical stream, is there any chance that Px from S2 can go in between P1 and P2? This will result in a physical stream that looks like … P1, Px, P2 …
I found the following info from the Multiplexing section in this document: https://www.xiph.org/ogg/doc/ogg-multiplex.html:
Ogg bitstreams multiplex multiple logical streams into a single physical stream at the page level. Each page contains an abstract time stamp (the Granule Position) that represents an absolute time landmark within the stream. After the pages representing stream headers (all logical stream headers occur at the beginning of a physical bitstream section before any logical stream data), logical stream data pages are arranged in a physical bitstream in strict non-decreasing order by chronological absolute time as specified by the granule position.
The only exception to arranging pages in strictly ascending time order by granule position is those pages that do not set the granule position value. This is a special case when exceptionally large packets span multiple pages;
On my side, libogg is used to encode packets. The granule position is provided on a per packet bases. Based on the ogg documentation, I believe in the case I mentioned above, P1 from S1 will have a granule position T1, and P2 will be following P1 and will not have a granule position set on the page. Let’s assume Px from S2 has a granule position Tx.
If Tx < T1, then I believe the page order on the physical stream will be Px, P1, P2.
If Tx > T1, then I’m suspecting that the pages will be like P1, P2, Px (and never P1, Px, P2).
Can someone help me understand if P1, Px, P2 can ever happen?
Thank you,
WD
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xiph.org/pipermail/ogg-dev/attachments/20191213/1bdcb930/attachment.html>
More information about the ogg-dev
mailing list