[vorbis-dev] timestamping / latency

John Ripley
Tue, 13 Jan 2004 07:18:07 -0000

> -----Original Message-----
> From: Olaf Matthes [mailto:olaf.matthes@gmx.de]
> Sent: 13 January 2004 14:30
> To: vorbis-dev@xiph.org
> Subject: Re: [vorbis-dev] timestamping / latency
>
> John Ripley wrote:
>
> >You could still use Ogg if you force a page out for each
> encoded packet.
> >That means you only have one packet per page, so the framing
> overhead will
> >be a lot higher (about 5-10%), but it will work without modifying the
> >decoder.
> >
> Thanks for that, but just to make shure I got it right:
>
> If ogg_stream_pageout() returns 0 I call ogg_stream_flush() and then
> ogg_stream_pageout() again to obtain the page that has been
> created on
> flushing? Or does ogg_stream_flush() by itself give me the page and I
> don't have to call ogg_stream_pageout() afterwards?

Have a look at how the comment and codebook packets are flushed out as a
single page in examples/encoder_example.c. It looks like you call
ogg_stream_flush() and write out bytes, until it returns 0. You probably
want to replace the ogg_stream_pageout() in the encoding loop with an
ogg_stream_flush(). Presumably ogg_stream_pageout() returns 0 until a page
is completely filled, whereas ogg_stream_flush() ensures the page goes out
even though it's not full.

- John Ripley.