Documentation ¶
Overview ¶
Package samplebuilder provides functionality to reconstruct media frames from RTP packets.
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 WithPacketReleaseHandler ¶
WithPacketReleaseHandler set a callback when the builder is about to release some packet.
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, sampleRate uint32, 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) Insert ¶
func (s *SampleBuilder) Insert(p *rtp.Packet)
Insert adds an RTP Packet to s's round robin buffer.
Insert does not copy the input. If you wish to reuse this memory make sure to copy before calling Push
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.