[vorbis] packetno, granulepos, streaming and framing

Peter Maersk-Moller Peter at maersk-moller.net
Mon Jun 24 03:57:37 PDT 2002



Hi

While implementing OSS Ogg/Vorbis encoding and streaming using RTP/RTCP
for both unicast and multicast, I have come across a few issues I need
to clear out regarding the numbering of ogg_packets and their granulepos
value. Below are the result for two different scenarios.

<p>In the first scenario, ogg_packets are generated using

        a) vorbis_analysis_headerout()
        b) while true
                vorbis_analysis_buffer()
                vorbis_analysis_wrote()

        c) while true
                vorbis_analysis_blockout()
                vorbis_analysis()
                vorbis_bitrate_addblock()
                vorbis_bitrate_flushpacket()

This generates ogg_packets with packetno and granulepos values as described
below

Case #1 : Generated ogg_packets

Packet #	packetno	granulepos
---------------------------------------------
1		Large		0
2		Large		0
3		Large		0
4		3		0
5		4		576

In the second scenario, ogg_packets has additional been processed through

        a) ogg_stream_packetin()
        b) ogg_stream_pageout()
        c) saved into an .ogg file.
        d) read from an .ogg file
        e) ogg_stream_pagein()
        f) ogg_stream_packetout()

This produces ogg_packets with packetno and granulepos as listed below.

Case #2 : Generated ogg_packets

Packet #	packetno	granulepos
---------------------------------------------
1		0		0
2		1		-1
3		2		0
4		3		-1
5		4		-1
..................................
44		43		16320

Now here comes my first set of questions.

In the first scenario (case #1) the packetno
variable for the 3 first packets are rather large (or uninitialized), but
for case #2, the variable is 0,1 and 2 for packet # 1, 2 and 3.

  a) Why is that the case ?
  b) Is that intended ?
  c) Can I safely set the packetno in case #1 to 0,1 and 2 for the 3 first
     packets before submitting them to a framer like ogg_stream_packetin() ?

Here comes my second set of questions.

        a) In the second scenario (case #2), the granulepos value of the
        second packet (the comnment) is set to -1. Shouldn't it be 0 ?

        b) Also in case #2, the granulepos for packet # 4-43 is -1 while
        packet #44 is 16320. Shouldn't the granulepos for the packets
        between packet # 4 and 44 have a more reasonable values like
        0, 576, 1600 etc. (or something similar) ?

I assume the granulepos value for packet #44 is the granulepos value
for the whole pacge that packet # 4-44 was part of. Is that correct ?
Not having access to the exact granulepos for the individual ogg_packets
makes it really really difficult to fit into existing OSS streaming
software. Is it possible to chaneg the code of ogg_stream_packetout()
so the ogg_packets will be assigned the exact granulepos rather than
the granulepos of the page they were once framed into ?

Kind regards

--PMM

PS, still don't see May and half of June Vorbis mail archive. Is that
the intention ?

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis mailing list