detritus

MediaFrameAssemblerclass

Puts one video stream's (ssrc's) rtp packets back together into frames Packets of a frame share a timestamp and the last one has the marker bit set, a frame is complete once every sequence number from its first packet to its marker packet is here. Frames come out in order, a complete frame waits for older incomplete ones (packets get reordered) until they finish or are given up on. After a loss, frames that depend on the lost one would only decode as garbage, so they're held back until a keyframe

On this page

Puts one video stream's (ssrc's) rtp packets back together into frames Packets of a frame share a timestamp and the last one has the marker bit set, a frame is complete once every sequence number from its first packet to its marker packet is here. Frames come out in order, a complete frame waits for older incomplete ones (packets get reordered) until they finish or are given up on. After a loss, frames that depend on the lost one would only decode as garbage, so they're held back until a keyframe

import { MediaFrames } from 'detritus-client-socket';

MediaFrames.MediaFrameAssembler;
5 properties10 methodssrc/mediaframes.ts:406

Constructor

Properties

codec
frames
Map<number, PendingFrame>
lastSequence
number | null
Default null
paddingSequences
Set<number>
waitingForKeyframe
boolean
Default true

Methods

drain()

protected src/mediaframes.ts:515
drain(now: number, result: AssemblerResult): void

Hands out complete frames from the oldest one on, stops at an incomplete frame unless we've given up on it

hasGap()

protected src/mediaframes.ts:633
hasGap(from: number, to: number): boolean

If any packet between from and to (exclusive) is missing, padding doesn't count

hasKeyframeQueued()

protected src/mediaframes.ts:596
hasKeyframeQueued(): boolean

If a complete keyframe is already waiting its turn, asking the sender for another one would be pointless

isFrameBoundary()

protected src/mediaframes.ts:608
isFrameBoundary(sequence: number, timestamp: number): boolean

If the packet before sequence ended an earlier frame (or there's nothing before it to compare with)