samplebuilder

package
v3.0.0-beta.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2020 License: MIT Imports: 2 Imported by: 43

Documentation

Overview

Package samplebuilder provides functionality to reconstruct media frames from RTP packets.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(o *SampleBuilder)

An Option configures a SampleBuilder.

func WithPartitionHeadChecker

func WithPartitionHeadChecker(checker rtp.PartitionHeadChecker) Option

WithPartitionHeadChecker assigns a codec-specific PartitionHeadChecker to SampleBuilder. Several PartitionHeadCheckers are available in package github.com/pion/rtp/codecs.

type SampleBuilder

type SampleBuilder struct {
	// contains filtered or unexported fields
}

SampleBuilder buffers packets until media frames are complete.

func New

func New(maxLate uint16, depacketizer rtp.Depacketizer, opts ...Option) *SampleBuilder

New constructs a new SampleBuilder. maxLate is how long to wait until we can construct a completed media.Sample. maxLate is measured in RTP packet sequence numbers. A large maxLate will result in less packet loss but higher latency. The depacketizer extracts media samples from RTP packets. Several depacketizers are available in package github.com/pion/rtp/codecs.

func (*SampleBuilder) Pop

func (s *SampleBuilder) Pop() *media.Sample

Pop scans s's buffer for a valid sample. It returns nil if no valid samples have been found.

func (*SampleBuilder) PopWithTimestamp

func (s *SampleBuilder) PopWithTimestamp() (*media.Sample, uint32)

PopWithTimestamp scans s's buffer for a valid sample and its RTP timestamp. It returns nil, 0 when no valid samples have been found.

func (*SampleBuilder) Push

func (s *SampleBuilder) Push(p *rtp.Packet)

Push adds an RTP Packet to s's buffer.

Push does not copy the input. If you wish to reuse this memory make sure to copy before calling Push

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL