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 ¶ added in v2.2.0
type Option func(o *SampleBuilder)
An Option configures a SampleBuilder.
func WithPartitionHeadChecker ¶ added in v2.2.0
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 ¶ added in v2.2.0
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.