Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrEmptyPayload = errors.New("empty payload")
Functions ¶
func ParseVP9PayloadDescriptor ¶
func ParseVP9PayloadDescriptor(payload []byte, desc *PayloadDescriptor) error
ParseVP9PayloadDescriptor parses the VP9 payload descriptor from RTP payload
Types ¶
type IvfSegmenter ¶
type IvfSegmenter struct {
// contains filtered or unexported fields
}
IvfSegmenter pushes VP9 packet payloads belonging to a single logical video stream into IVF files.
func NewIvfSegmenter ¶
func NewIvfSegmenter(outputDir string) (*IvfSegmenter, error)
func (*IvfSegmenter) Close ¶
func (s *IvfSegmenter) Close() error
Close flushes any buffered frame and closes the current IVF file.
func (*IvfSegmenter) Enable ¶
func (s *IvfSegmenter) Enable()
func (*IvfSegmenter) Push ¶
func (s *IvfSegmenter) Push(payload []byte, timestamp uint32, desc *PayloadDescriptor) error
Push ingests a single RTP payload (VP9 payload descriptor + VP9 payload). timestamp is the RTP timestamp associated with this packet.
type IvfWriter ¶
type IvfWriter struct {
// contains filtered or unexported fields
}
func NewIvfWriter ¶
func (*IvfWriter) WriteFrame ¶
type PayloadDescriptor ¶
type PayloadDescriptor struct {
I uint8
P uint8
L uint8
F uint8
B uint8
E uint8
V uint8
Z uint8
M uint8
PictureID uint16
TID uint8
UBit uint8
SID uint8
DBit uint8
TL0PicIdx uint8
SSPresent uint8
// ByteLength total VP9 payload descriptor size in bytes
ByteLength int
}
func (*PayloadDescriptor) IsKeyframe ¶
func (desc *PayloadDescriptor) IsKeyframe() bool
type SVCFrameInfo ¶
SVCFrameInfo describes a single VP9 frame (or sub-frame) with SVC metadata.
type SVCLayerConfig ¶
type SVCLayerConfig struct {
NumSpatialLayers int
NumTemporalLayers int
Widths []uint16 // resolution per spatial layer (len == NumSpatialLayers)
Heights []uint16 // resolution per spatial layer (len == NumSpatialLayers)
}
SVCLayerConfig describes the SVC layer structure for the payloader.
type SVCPayloader ¶
type SVCPayloader struct {
Config SVCLayerConfig
// contains filtered or unexported fields
}
SVCPayloader creates VP9 RTP payloads with SVC layer indices (L=1). It uses non-flexible mode (F=0) to match Chrome's behavior.
func (*SVCPayloader) AdvancePicture ¶
func (p *SVCPayloader) AdvancePicture(tid uint8)
AdvancePicture increments the picture ID and (if TID==0) TL0PICIDX. Call once per access unit (after all spatial layers are payloaded).
func (*SVCPayloader) PayloadSVC ¶
func (p *SVCPayloader) PayloadSVC(mtu uint16, data []byte, info SVCFrameInfo) [][]byte
PayloadSVC fragments a VP9 frame into RTP payload chunks with SVC layer indices in every packet's VP9 payload descriptor.
Header format per packet (non-flexible, L=1):
Byte 0: [I=1 | P | L=1 | F=0 | B | E | V | Z] Byte 1-2: [M=1 | PictureID (15-bit)] Byte 3: [TID(3) | U(1) | SID(3) | D(1)] Byte 4: [TL0PICIDX] Byte 5+: [SS data if V=1] [VP9 frame data]
Call AdvancePicture() after all spatial layers of an access unit are payloaded.
type SubFrame ¶
type SubFrame struct {
Data []byte
Index int // 0-based position within superframe (corresponds to SID for SVC)
}
SubFrame is a single VP9 frame extracted from a superframe.
func ParseSuperframe ¶
ParseSuperframe splits a VP9 superframe into its constituent sub-frames. If the data is not a superframe (no valid superframe index), it returns a single SubFrame containing the entire data.
VP9 superframe layout:
[frame_0][frame_1]...[frame_N][marker][size_0][size_1]...[size_N][marker]
Marker byte: bits[7:5]=110, bits[4:2]=frames_minus_1, bits[1:0]=mag_minus_1