mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
TEST: Upgrade pion to v3.2.9. (#3567)
------ Co-authored-by: chundonglinlin <chundonglinlin@163.com>
This commit is contained in:
parent
104cf14d68
commit
df854339ea
1383 changed files with 118469 additions and 41421 deletions
44
trunk/3rdparty/srs-bench/vendor/github.com/pion/rtp/pkg/frame/av1.go
generated
vendored
Normal file
44
trunk/3rdparty/srs-bench/vendor/github.com/pion/rtp/pkg/frame/av1.go
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Package frame provides code to construct complete media frames from packetized media
|
||||
package frame
|
||||
|
||||
import "github.com/pion/rtp/codecs"
|
||||
|
||||
// AV1 represents a collection of OBUs given a stream of AV1 Packets.
|
||||
// Each AV1 RTP Packet is a collection of OBU Elements. Each OBU Element may be a full OBU, or just a fragment of one.
|
||||
// AV1 provides the tools to construct a collection of OBUs from a collection of OBU Elements. This structure
|
||||
// contains an internal cache and should be used for the entire RTP Stream.
|
||||
type AV1 struct {
|
||||
// Buffer for fragmented OBU. If ReadFrames is called on a RTP Packet
|
||||
// that doesn't contain a fully formed OBU
|
||||
obuBuffer []byte
|
||||
}
|
||||
|
||||
func (f *AV1) pushOBUElement(isFirstOBUFragment *bool, obuElement []byte, obuList [][]byte) [][]byte {
|
||||
if *isFirstOBUFragment {
|
||||
*isFirstOBUFragment = false
|
||||
// Discard pushed because we don't have a fragment to combine it with
|
||||
if f.obuBuffer == nil {
|
||||
return obuList
|
||||
}
|
||||
obuElement = append(f.obuBuffer, obuElement...)
|
||||
f.obuBuffer = nil
|
||||
}
|
||||
return append(obuList, obuElement)
|
||||
}
|
||||
|
||||
// ReadFrames processes the codecs.AV1Packet and returns fully constructed frames
|
||||
func (f *AV1) ReadFrames(pkt *codecs.AV1Packet) ([][]byte, error) {
|
||||
OBUs := [][]byte{}
|
||||
isFirstOBUFragment := pkt.Z
|
||||
|
||||
for i := range pkt.OBUElements {
|
||||
OBUs = f.pushOBUElement(&isFirstOBUFragment, pkt.OBUElements[i], OBUs)
|
||||
}
|
||||
|
||||
if pkt.Y && len(OBUs) > 0 {
|
||||
// Take copy of OBUElement that is being cached
|
||||
f.obuBuffer = append(f.obuBuffer, append([]byte{}, OBUs[len(OBUs)-1]...)...)
|
||||
OBUs = OBUs[:len(OBUs)-1]
|
||||
}
|
||||
return OBUs, nil
|
||||
}
|
66
trunk/3rdparty/srs-bench/vendor/github.com/pion/rtp/pkg/obu/leb128.go
generated
vendored
Normal file
66
trunk/3rdparty/srs-bench/vendor/github.com/pion/rtp/pkg/obu/leb128.go
generated
vendored
Normal file
|
@ -0,0 +1,66 @@
|
|||
// Package obu implements tools for working with the "Open Bitstream Unit"
|
||||
package obu
|
||||
|
||||
import "errors"
|
||||
|
||||
const (
|
||||
sevenLsbBitmask = uint(0b01111111)
|
||||
msbBitmask = uint(0b10000000)
|
||||
)
|
||||
|
||||
// ErrFailedToReadLEB128 indicates that a buffer ended before a LEB128 value could be successfully read
|
||||
var ErrFailedToReadLEB128 = errors.New("payload ended before LEB128 was finished")
|
||||
|
||||
// EncodeLEB128 encodes a uint as LEB128
|
||||
func EncodeLEB128(in uint) (out uint) {
|
||||
for {
|
||||
// Copy seven bits from in and discard
|
||||
// what we have copied from in
|
||||
out |= (in & sevenLsbBitmask)
|
||||
in >>= 7
|
||||
|
||||
// If we have more bits to encode set MSB
|
||||
// otherwise we are done
|
||||
if in != 0 {
|
||||
out |= msbBitmask
|
||||
out <<= 8
|
||||
} else {
|
||||
return out
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func decodeLEB128(in uint) (out uint) {
|
||||
for {
|
||||
// Take 7 LSB from in
|
||||
out |= (in & sevenLsbBitmask)
|
||||
|
||||
// Discard the MSB
|
||||
in >>= 8
|
||||
if in == 0 {
|
||||
return out
|
||||
}
|
||||
|
||||
out <<= 7
|
||||
}
|
||||
}
|
||||
|
||||
// ReadLeb128 scans an buffer and decodes a Leb128 value.
|
||||
// If the end of the buffer is reached and all MSB are set
|
||||
// an error is returned
|
||||
func ReadLeb128(in []byte) (uint, uint, error) {
|
||||
var encodedLength uint
|
||||
|
||||
for i := range in {
|
||||
encodedLength |= uint(in[i])
|
||||
|
||||
if in[i]&byte(msbBitmask) == 0 {
|
||||
return decodeLEB128(encodedLength), uint(i + 1), nil
|
||||
}
|
||||
|
||||
// Make more room for next read
|
||||
encodedLength <<= 8
|
||||
}
|
||||
|
||||
return 0, 0, ErrFailedToReadLEB128
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue