Skip to content

OpusPacket

Reads the TOC byte that starts every Opus packet (RFC 6716 section 3.1) to tell how much audio the packet holds.

OpusPacket . opusSamples ( packet )  -> number

Returns how many 48 kHz samples (per channel) of audio packet holds: its frame count times its frame size, both read from the TOC byte. 960 is 20 ms. Raises for an empty packet, a code 3 packet without its frame count byte or with 0 frames, and a packet longer than 120 ms (5760 samples).

Parameters

packet: buffer

Returns

number