YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.multiroom.codec.OggPacketReader Class Reference

Cuts a stream of Ogg pages (RFC 3533) into packets. More...

Collaboration diagram for de.yaacc.multiroom.codec.OggPacketReader:
Collaboration graph

Public Member Functions

List< byte[]> feed (byte[] data)
 Takes the next bytes and gives the packets that are complete now (possibly none).
 
void reset ()
 Forgets everything: the next bytes start a new stream.
 
long droppedPages ()
 
long droppedBytes ()
 
int bufferedBytes ()
 The bytes of an incomplete page that are being kept.
 

Static Public Attributes

static final int MAX_PACKET_BYTES = 64 * 1024
 A Vorbis packet is a few KB at most; the limit is far above any real packet.
 
static final int MAX_BUFFER_BYTES = 2 * MAX_PAGE_BYTES
 

Detailed Description

Cuts a stream of Ogg pages (RFC 3533) into packets.

The input may come in any slices (the chunks of the codec ogg are not required to be whole pages); a page is used only when it is complete and its checksum fits. What the input does to it:

  • bytes in front of a page, or a page with a wrong checksum, are skipped up to the next capture pattern;
  • a lost page (the sequence number jumps) drops the packet that was in progress, and so does a page that continues a packet nobody started: the part of it up to the end of the packet is dropped, the packets after it are kept;
  • a page with a start flag adopts its serial number and starts over; pages of another serial number are ignored;
  • a packet above MAX_PACKET_BYTES is dropped when it ends, never held in memory;
  • the buffer never holds more than one incomplete page and the slice that is being added (MAX_BUFFER_BYTES).

One instance is for one stream and one thread.


The documentation for this class was generated from the following file: