Version: v3.0.0-...-844a0a3 Latest Latest

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

Go to latest
Published: Jul 24, 2020 License: MIT Imports: 2 Imported by: 0



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



This section is empty.


This section is empty.


This section is empty.


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

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

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL