Documentation ¶
Index ¶
- Constants
- Variables
- func AggregateRTPStats(statses []*livekit.RTPStats) *livekit.RTPStats
- func IsH264Keyframe(payload []byte) bool
- func VP8PictureIdSizeDiff(mBit1 bool, mBit2 bool) int
- type Bucket
- type Buffer
- func (b *Buffer) Bind(params webrtc.RTPParameters, codec webrtc.RTPCodecCapability, o Options)
- func (b *Buffer) Close() error
- func (b *Buffer) GetClockRate() uint32
- func (b *Buffer) GetMediaSSRC() uint32
- func (b *Buffer) GetPacket(buff []byte, sn uint16) (int, error)
- func (b *Buffer) GetQualityInfo() *RTPSnapshotInfo
- func (b *Buffer) GetStats() *StreamStatsWithLayers
- func (b *Buffer) OnAudioLevel(fn func(level uint8, durationMs uint32))
- func (b *Buffer) OnClose(fn func())
- func (b *Buffer) OnFeedback(fn func(fb []rtcp.Packet))
- func (b *Buffer) OnTransportWideCC(fn func(sn uint16, timeNS int64, marker bool))
- func (b *Buffer) Read(buff []byte) (n int, err error)
- func (b *Buffer) ReadExtended() (*ExtPacket, error)
- func (b *Buffer) SendPLI()
- func (b *Buffer) SetLastFractionLostReport(lost uint8)
- func (b *Buffer) SetLogger(logger logger.Logger)
- func (b *Buffer) SetPLIThrottle(duration int64)
- func (b *Buffer) SetRTT(rtt uint32)
- func (b *Buffer) SetSenderReportData(rtpTime uint32, ntpTime uint64)
- func (b *Buffer) Write(pkt []byte) (n int, err error)
- type ConnectionQualityParams
- type DataStats
- type DataStatsParam
- type ExtPacket
- type Factory
- type LayerStats
- type NackQueue
- type NtpTime
- type Options
- type RTCPReader
- type RTPFlowState
- type RTPSnapshotInfo
- type RTPStats
- func (r *RTPStats) GetRtcpSenderReport(ssrc uint32) *rtcp.SenderReport
- func (r *RTPStats) GetRtt() uint32
- func (r *RTPStats) GetTotalBytes() uint64
- func (r *RTPStats) GetTotalBytesSansDuplicate() uint64
- func (r *RTPStats) GetTotalPackets() uint32
- func (r *RTPStats) GetTotalPacketsSansDuplicate() uint32
- func (r *RTPStats) IsActive() bool
- func (r *RTPStats) LastPli() time.Time
- func (r *RTPStats) NewSnapshotId() uint32
- func (r *RTPStats) SetRtcpSenderReportData(rtpTS uint32, ntpTS NtpTime, arrival time.Time)
- func (r *RTPStats) SnapshotInfo(snapshotId uint32) *RTPSnapshotInfo
- func (r *RTPStats) SnapshotRtcpReceptionReport(ssrc uint32, proxyFracLost uint8, snapshotId uint32) *rtcp.ReceptionReport
- func (r *RTPStats) Stop()
- func (r *RTPStats) TimeSinceLastPli() int64
- func (r *RTPStats) ToProto() *livekit.RTPStats
- func (r *RTPStats) ToString() string
- func (r *RTPStats) Update(rtph *rtp.Header, payloadSize int, paddingSize int, packetTime int64) (flowState RTPFlowState)
- func (r *RTPStats) UpdateFir(firCount uint32)
- func (r *RTPStats) UpdateFirTime()
- func (r *RTPStats) UpdateJitter(jitter float64)
- func (r *RTPStats) UpdateKeyFrame(kfCount uint32)
- func (r *RTPStats) UpdateLayerLockPliAndTime(pliCount uint32)
- func (r *RTPStats) UpdateNack(nackCount uint32)
- func (r *RTPStats) UpdateNackAndMiss(nackCount uint32, nackMissCount uint32)
- func (r *RTPStats) UpdateNackMiss(nackMissCount uint32)
- func (r *RTPStats) UpdatePacketsLost(packetsLost uint32)
- func (r *RTPStats) UpdatePli(pliCount uint32)
- func (r *RTPStats) UpdatePliAndTime(pliCount uint32)
- func (r *RTPStats) UpdatePliTime()
- func (r *RTPStats) UpdateRtt(rtt uint32)
- type RTPStatsParams
- type Snapshot
- type StreamStatsWithLayers
- type VP8
Constants ¶
View Source
const ( GapHistogramNumBins = 101 SequenceNumberMin = uint16(0) SequenceNumberMax = uint16(65535) NumSequenceNumbers = 65536 )
View Source
const (
ReportDelta = 1e9
)
Variables ¶
Functions ¶
func IsH264Keyframe ¶
IsH264Keyframe detects if h264 payload is a keyframe this code was taken from https://github.com/jech/galene/blob/codecs/rtpconn/rtpreader.go#L45 all credits belongs to Juliusz Chroboczek @jech and the awesome Galene SFU
func VP8PictureIdSizeDiff ¶
Types ¶
type Buffer ¶
Buffer contains all packets
func (*Buffer) GetClockRate ¶
GetClockRate returns the RTP clock rate
func (*Buffer) GetMediaSSRC ¶
GetMediaSSRC returns the associated SSRC of the RTP stream
func (*Buffer) GetQualityInfo ¶
func (b *Buffer) GetQualityInfo() *RTPSnapshotInfo
func (*Buffer) GetStats ¶
func (b *Buffer) GetStats() *StreamStatsWithLayers
func (*Buffer) OnAudioLevel ¶
func (*Buffer) OnFeedback ¶
func (*Buffer) OnTransportWideCC ¶
func (*Buffer) ReadExtended ¶
func (*Buffer) SetLastFractionLostReport ¶
func (*Buffer) SetPLIThrottle ¶
func (*Buffer) SetSenderReportData ¶
type ConnectionQualityParams ¶
type DataStats ¶
type DataStats struct {
// contains filtered or unexported fields
}
func NewDataStats ¶
func NewDataStats(params DataStatsParam) *DataStats
func (*DataStats) ToProtoActive ¶
func (*DataStats) ToProtoAggregateOnly ¶
type DataStatsParam ¶
type Factory ¶
func NewBufferFactory ¶
func (*Factory) GetBufferPair ¶
func (f *Factory) GetBufferPair(ssrc uint32) (*Buffer, *RTCPReader)
func (*Factory) GetOrNew ¶
func (f *Factory) GetOrNew(packetType packetio.BufferPacketType, ssrc uint32) io.ReadWriteCloser
func (*Factory) GetRTCPReader ¶
func (f *Factory) GetRTCPReader(ssrc uint32) *RTCPReader
type LayerStats ¶
type NackQueue ¶
type NackQueue struct {
// contains filtered or unexported fields
}
func NewNACKQueue ¶
func NewNACKQueue() *NackQueue
type Options ¶
type Options struct {
MaxBitRate uint64
}
BufferOptions provides configuration options for the buffer
type RTCPReader ¶
type RTCPReader struct {
// contains filtered or unexported fields
}
func NewRTCPReader ¶
func NewRTCPReader(ssrc uint32) *RTCPReader
func (*RTCPReader) Close ¶
func (r *RTCPReader) Close() error
func (*RTCPReader) OnClose ¶
func (r *RTCPReader) OnClose(fn func())
func (*RTCPReader) OnPacket ¶
func (r *RTCPReader) OnPacket(f func([]byte))
type RTPFlowState ¶
type RTPSnapshotInfo ¶
type RTPStats ¶
type RTPStats struct {
// contains filtered or unexported fields
}
func NewRTPStats ¶
func NewRTPStats(params RTPStatsParams) *RTPStats
func (*RTPStats) GetRtcpSenderReport ¶
func (r *RTPStats) GetRtcpSenderReport(ssrc uint32) *rtcp.SenderReport
func (*RTPStats) GetTotalBytes ¶
func (*RTPStats) GetTotalBytesSansDuplicate ¶
func (*RTPStats) GetTotalPackets ¶
func (*RTPStats) GetTotalPacketsSansDuplicate ¶
func (*RTPStats) NewSnapshotId ¶
func (*RTPStats) SetRtcpSenderReportData ¶
func (*RTPStats) SnapshotInfo ¶
func (r *RTPStats) SnapshotInfo(snapshotId uint32) *RTPSnapshotInfo
func (*RTPStats) SnapshotRtcpReceptionReport ¶
func (*RTPStats) TimeSinceLastPli ¶
func (*RTPStats) UpdateFirTime ¶
func (r *RTPStats) UpdateFirTime()
func (*RTPStats) UpdateJitter ¶
func (*RTPStats) UpdateKeyFrame ¶
func (*RTPStats) UpdateLayerLockPliAndTime ¶
func (*RTPStats) UpdateNack ¶
func (*RTPStats) UpdateNackAndMiss ¶
func (*RTPStats) UpdateNackMiss ¶
func (*RTPStats) UpdatePacketsLost ¶
func (*RTPStats) UpdatePliAndTime ¶
func (*RTPStats) UpdatePliTime ¶
func (r *RTPStats) UpdatePliTime()
type RTPStatsParams ¶
type RTPStatsParams struct {
ClockRate uint32
}
type StreamStatsWithLayers ¶
type StreamStatsWithLayers struct { RTPStats *livekit.RTPStats Layers map[int]LayerStats }
type VP8 ¶
type VP8 struct { FirstByte byte PictureIDPresent int PictureID uint16 /* 8 or 16 bits, picture ID */ MBit bool TL0PICIDXPresent int TL0PICIDX uint8 /* 8 bits temporal level zero index */ // Optional Header If either of the T or K bits are set to 1, // the TID/Y/KEYIDX extension field MUST be present. TIDPresent int TID uint8 /* 2 bits temporal layer idx */ Y uint8 KEYIDXPresent int KEYIDX uint8 /* 5 bits of key frame idx */ HeaderSize int // IsKeyFrame is a helper to detect if current packet is a keyframe IsKeyFrame bool }
VP8 is a helper to get temporal data from VP8 packet header
VP8 Payload Descriptor 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ |X|R|N|S|R| PID | (REQUIRED) |X|R|N|S|R| PID | (REQUIRED) +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ X: |I|L|T|K| RSV | (OPTIONAL) X: |I|L|T|K| RSV | (OPTIONAL) +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ I: |M| PictureID | (OPTIONAL) I: |M| PictureID | (OPTIONAL) +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ L: | TL0PICIDX | (OPTIONAL) | PictureID | +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ T/K:|TID|Y| KEYIDX | (OPTIONAL) L: | TL0PICIDX | (OPTIONAL) +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ T/K:|TID|Y| KEYIDX | (OPTIONAL) +-+-+-+-+-+-+-+-+
Click to show internal directories.
Click to hide internal directories.