[ogg-dev] Storing RTP in Ogg

Andrew Donkin andrew.donkin.ogg at gmail.com
Wed Jan 10 18:30:59 PST 2007

Ralph Giles wrote:

> That's fine. SSRC as stream serialno?

Probably not - in the absence of a skeleton stream I'll abuse the serial 
number to identify the streams: audio, video, etc.

> Note that by using arrival time as the granulepos you're making seeking 
> for playback harder on other implementors.

Do you mean because granulepos will not reference the previous key frame?

I should have been more specific there: I was going to use the timestamp 
in the RTP packet for granulepos, rather than arrival time, which is a 
bit ropey.  But now I'm having second thoughts.

> The idea is that you read and write packets and let libogg worry about 
> the pages. Writers set a granulepos on each packet they creat, readers 
> don't panic if some packets have an unset (-1) granulepos.

I don't quite get that.  If I'm reading it correctly, pageout() gobbles 
4K of data or 255+ packets before spitting out a page.  At speech rates, 
4096 bytes is half a second and five(ish) packets, which is way too long 
between "granules" I would have thought.

How would a reader seek to within that half second?  Would it find the 
packet with the granulepos it was after, being the last in the page with 
that granulepos, then use codec-specific timing inside the preceding 
packets to find the accurate starting point?  This is a genuine 
question, by the way, for my information.

It seems (please correct me) that my options are

- flush one packet per page, use granulepos for accurate time stamping,
- let libogg handle the paging and, well, to hell with granulepos
- or a combination, flush after each RTP packet with its marker bit set.
   Which is every audio packet, I believe.

Thanks for your reply, and thank in advance for your next :-)

More information about the ogg-dev mailing list