Documentation ¶
Index ¶
- Constants
- Variables
- func CompareSeq(a, b uint16) int
- func MSWLSW2NTP(msw, lsw uint64) uint64
- func MSWLSW2UnixNano(msw, lsw uint64) uint64
- func NTP2UnixNano(v uint64) uint64
- func SubSeq(a, b uint16) int
- type OnAVPacket
- type RR
- type RRProducer
- type RTCPHeader
- type RTPHeader
- type RTPPacket
- type RTPPacketList
- type RTPPacketListItem
- type RTPUnpacker
- type SR
Constants ¶
View Source
const ( RTCPPacketTypeSR = 200 // 0xc8 Sender Report RTCPPacketTypeRR = 201 // 0xc9 Receiver Report RTCPVersion = 2 )
View Source
const ( NALUTypeAVCSingleMax = 23 NALUTypeAVCSTAPA = 24 // one packet, multiple nals NALUTypeAVCFUA = 28 )
View Source
const ( PositionTypeSingle uint8 = 1 PositionTypeFUAStart uint8 = 2 PositionTypeFUAMiddle uint8 = 3 PositionTypeFUAEnd uint8 = 4 PositionTypeSTAPA uint8 = 5 )
View Source
const MaxRTPRTCPPacketSize = 1500
View Source
const (
NALUTypeHEVCFUA = 49
)
View Source
const (
RTPFixedHeaderLength = 12
)
Variables ¶
View Source
var ErrRTCP = errors.New("lal.rtcp: fxxk")
View Source
var ErrRTP = errors.New("lal.rtp: fxxk")
Functions ¶
func MSWLSW2UnixNano ¶
将ntp时间戳(高32位低32位分开的形式)转换为Unix时间戳
Types ¶
type OnAVPacket ¶
pkt: pkt.Timestamp RTP包头中的时间戳(pts)经过clockrate换算后的时间戳,单位毫秒
注意,不支持带B帧的视频流,pts和dts永远相同 pkt.PayloadType base.AVPacketPTXXX pkt.Payload 如果是AAC,返回的是raw frame,一个AVPacket只包含一帧 如果是AVC或HEVC,一个AVPacket可能包含多个NAL(受STAP-A影响),所以NAL前包含4字节的长度信息 AAC引用的是接收到的RTP包中的内存块 AVC或者HEVC是新申请的内存块,回调结束后,内部不再使用该内存块
type RRProducer ¶
type RRProducer struct {
// contains filtered or unexported fields
}
func NewRRProducer ¶
func NewRRProducer(clockRate int) *RRProducer
func (*RRProducer) FeedRTPPacket ¶
func (r *RRProducer) FeedRTPPacket(seq uint16)
每次收到rtp包,都将seq序号传入这个函数
func (*RRProducer) Produce ¶
func (r *RRProducer) Produce(lsr uint32) []byte
收到sr包时,产生rr包
lsr: 从sr包中获取,见func SR.GetMiddleNTP @return: rr包的二进制数据
type RTCPHeader ¶
type RTCPHeader struct { Version uint8 // 2b Padding uint8 // 1b CountOrFormat uint8 // 5b PacketType uint8 // 8b Length uint16 // 16b, byte length = (length+1) * 4 }
func ParseRTCPHeader ¶
func ParseRTCPHeader(b []byte) RTCPHeader
type RTPHeader ¶
type RTPHeader struct { Version uint8 // 2b * Padding uint8 // 1b Extension uint8 // 1 CsrcCount uint8 // 4b Mark uint8 // 1b * PacketType uint8 // 7b Seq uint16 // 16b ** Timestamp uint32 // 32b **** SSRC uint32 // 32b **** Synchronization source // contains filtered or unexported fields }
func ParseRTPPacket ¶
type RTPPacketList ¶
type RTPPacketList struct {
// contains filtered or unexported fields
}
type RTPPacketListItem ¶
type RTPPacketListItem struct {
// contains filtered or unexported fields
}
type RTPUnpacker ¶
type RTPUnpacker struct {
// contains filtered or unexported fields
}
func NewRTPUnpacker ¶
func NewRTPUnpacker(payloadType base.AVPacketPT, clockRate int, maxSize int, onAVPacket OnAVPacket) *RTPUnpacker
Click to show internal directories.
Click to hide internal directories.