detritus

MediaFramesnamespace

The MediaFrames namespace of detritus-client-socket.

On this page
import { MediaFrames } from 'detritus-client-socket';
1 enums · 3 classes · 5 interfaces · 1 variables · 12 functions

Classes

Classes you create or receive from the library.

Interfaces

Object shapes for options, payloads and events.

Enums

Named constants.

Functions

Standalone helpers.

depacketizeH264()

function src/mediaframes.ts:204
function depacketizeH264(payload: Buffer): DepacketizedPayload | null

RFC 6184 Section 5.6 - 5.8, single nal units, STAP-A and FU-A (the only modes discord uses) Returns the packet's nal units as annex b

isKeyframe()

function src/mediaframes.ts:285
function isKeyframe(codec: string, frame: Buffer): boolean

If an encoded frame is a keyframe, works on e2e encrypted frames too (DAVE leaves these bytes unencrypted)

isSequenceNewer()

function src/mediaframes.ts:79
function isSequenceNewer(a: number, b: number): boolean

If b comes after a, anything more than half the sequence space ahead is treated as behind

packetizeH264()

function src/mediaframes.ts:364
function packetizeH264(frame: Buffer): Buffer<ArrayBufferLike>[]

RFC 6184 Section 5.6/5.8, a single nal unit per packet when it fits, FU-A fragments when it doesn't. Takes annex b

packetizeVP8()

function src/mediaframes.ts:304
function packetizeVP8(frame: Buffer, options: PacketizeOptions): Buffer<ArrayBufferLike>[]

RFC 7741 Section 4.2, X=1 | S on a frame's first packet, I=1, then M=1 and a 15 bit picture id

packetizeVP9()

function src/mediaframes.ts:322
function packetizeVP9(frame: Buffer, options: PacketizeOptions): Buffer<ArrayBufferLike>[]

RFC 9628 Section 4.2, non-flexible mode without layers, I=1 | P on inter frames | B on the first packet | E on the last

sequenceDistance()

function src/mediaframes.ts:72
function sequenceDistance(a: number, b: number): number

How far b is ahead of a, 16-bit rtp sequence numbers wrap around

splitAnnexB()

function src/mediaframes.ts:339
function splitAnnexB(frame: Buffer): Buffer<ArrayBufferLike>[]

An annex b frame's nal units, without their start codes (3 or 4 bytes)

Variables

Exported values.