update pion, export vp8munger header (#684)

* update pion, export vp8munger header

* fix test
This commit is contained in:
cnderrauber
2022-05-13 17:20:52 +08:00
committed by GitHub
parent 710e06b7da
commit fa53da18e7
7 changed files with 29 additions and 23 deletions

8
go.mod
View File

@@ -24,11 +24,11 @@ require (
github.com/pion/logging v0.2.2
github.com/pion/rtcp v1.2.9
github.com/pion/rtp v1.7.13
github.com/pion/sdp/v3 v3.0.4
github.com/pion/sdp/v3 v3.0.5
github.com/pion/stun v0.3.5
github.com/pion/transport v0.13.0
github.com/pion/turn/v2 v2.0.8
github.com/pion/webrtc/v3 v3.1.37
github.com/pion/webrtc/v3 v3.1.39
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.11.0
github.com/rs/cors v1.8.2
@@ -84,9 +84,9 @@ require (
github.com/d5/tengo/v2 v2.10.1
github.com/google/subcommands v1.2.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122 // indirect
golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect
golang.org/x/mod v0.5.1 // indirect
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 // indirect
golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect
)

10
go.sum
View File

@@ -193,6 +193,8 @@ github.com/pion/sctp v1.8.2 h1:yBBCIrUMJ4yFICL3RIvR4eh/H2BTTvlligmSTy+3kiA=
github.com/pion/sctp v1.8.2/go.mod h1:xFe9cLMZ5Vj6eOzpyiKjT9SwGM4KpK/8Jbw5//jc+0s=
github.com/pion/sdp/v3 v3.0.4 h1:2Kf+dgrzJflNCSw3TV5v2VLeI0s/qkzy2r5jlR0wzf8=
github.com/pion/sdp/v3 v3.0.4/go.mod h1:bNiSknmJE0HYBprTHXKPQ3+JjacTv5uap92ueJZKsRk=
github.com/pion/sdp/v3 v3.0.5 h1:ouvI7IgGl+V4CrqskVtr3AaTrPvPisEOxwgpdktctkU=
github.com/pion/sdp/v3 v3.0.5/go.mod h1:iiFWFpQO8Fy3S5ldclBkpXqmWy02ns78NOKoLLL0YQw=
github.com/pion/srtp/v2 v2.0.7 h1:1ODEFojQu3gVLmqOrTVVjzsrxfx1UHLk3LnKHjfWjS0=
github.com/pion/srtp/v2 v2.0.7/go.mod h1:5TtM9yw6lsH0ppNCehB/EjEUli7VkUgKSPJqWVqbhQ4=
github.com/pion/stun v0.3.5 h1:uLUCBCkQby4S1cf6CGuR9QrVOKcvUwFeemaC865QHDg=
@@ -207,6 +209,10 @@ github.com/pion/udp v0.1.1 h1:8UAPvyqmsxK8oOjloDk4wUt63TzFe9WEJkg5lChlj7o=
github.com/pion/udp v0.1.1/go.mod h1:6AFo+CMdKQm7UiA0eUPA8/eVCTx8jBIITLZHc9DWX5M=
github.com/pion/webrtc/v3 v3.1.37 h1:7iPJOw5ff0reL+ZP3U7fOmHOy2DaMD50HOj1lPYw3SE=
github.com/pion/webrtc/v3 v3.1.37/go.mod h1:W89PXYjE9L384RrhxSOjb2N6izQt5n4G9VF+2Kfy4Wc=
github.com/pion/webrtc/v3 v3.1.38 h1:LL1uVZhftJs0hy84hWT190h7Q9l93PUGiEm1TcGdc1Y=
github.com/pion/webrtc/v3 v3.1.38/go.mod h1:W89PXYjE9L384RrhxSOjb2N6izQt5n4G9VF+2Kfy4Wc=
github.com/pion/webrtc/v3 v3.1.39 h1:GoZKvuVgTE1ABQobqcHVHYwVLe5eBsjajMUuvOUQYEk=
github.com/pion/webrtc/v3 v3.1.39/go.mod h1:Dx0+s1a+05ARpZW7iNApOcUWyxOA/U2jqiT9WHFnbp8=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -291,6 +297,8 @@ golang.org/x/crypto v0.0.0-20220131195533-30dcbda58838/go.mod h1:IxCIyHEi3zRg3s0
golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122 h1:NvGWuYG8dkDHFSKksI1P9faiVJ9rayE6l0+ouWVIDs8=
golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw=
golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
@@ -367,6 +375,8 @@ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad h1:ntjMns5wyP/fN65tdBD4g8J5w8n015+iIIs9rtjXkY0=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

View File

@@ -55,13 +55,9 @@ func ToProtoParticipants(participants []types.LocalParticipant) []*livekit.Parti
}
func ToProtoSessionDescription(sd webrtc.SessionDescription) *livekit.SessionDescription {
sdp := sd.SDP
// enable mixed of one-byte and two-byte rtp extension
// TODO : should move this to pion's option
sdp = strings.Replace(sdp, "m=", "a=extmap-allow-mixed\r\nm=", 1)
return &livekit.SessionDescription{
Type: sd.Type.String(),
Sdp: sdp,
Sdp: sd.SDP,
}
}

View File

@@ -375,11 +375,11 @@ func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error {
incomingVP8, _ := extPkt.Payload.(buffer.VP8)
outbuf := &payload
if incomingVP8.HeaderSize != tp.vp8.header.HeaderSize {
if incomingVP8.HeaderSize != tp.vp8.Header.HeaderSize {
pool = PacketFactory.Get().(*[]byte)
outbuf = pool
}
payload, err = d.translateVP8PacketTo(extPkt.Packet, &incomingVP8, tp.vp8.header, outbuf)
payload, err = d.translateVP8PacketTo(extPkt.Packet, &incomingVP8, tp.vp8.Header, outbuf)
if err != nil {
d.pktsDropped.Inc()
return err
@@ -389,7 +389,7 @@ func (d *DownTrack) WriteRTP(extPkt *buffer.ExtPacket, layer int32) error {
if d.sequencer != nil {
meta := d.sequencer.push(extPkt.Packet.SequenceNumber, tp.rtp.sequenceNumber, tp.rtp.timestamp, int8(layer))
if meta != nil && tp.vp8 != nil {
meta.packVP8(tp.vp8.header)
meta.packVP8(tp.vp8.Header)
}
}

View File

@@ -1003,7 +1003,7 @@ func TestForwarderGetTranslationParamsVideo(t *testing.T) {
timestamp: 0xabcdef,
},
vp8: &TranslationParamsVP8{
header: &buffer.VP8{
Header: &buffer.VP8{
FirstByte: 25,
PictureIDPresent: 1,
PictureID: 13467,
@@ -1079,7 +1079,7 @@ func TestForwarderGetTranslationParamsVideo(t *testing.T) {
timestamp: 0xabcdef,
},
vp8: &TranslationParamsVP8{
header: &buffer.VP8{
Header: &buffer.VP8{
FirstByte: 25,
PictureIDPresent: 1,
PictureID: 13467,
@@ -1160,7 +1160,7 @@ func TestForwarderGetTranslationParamsVideo(t *testing.T) {
timestamp: 0xabcdef,
},
vp8: &TranslationParamsVP8{
header: &buffer.VP8{
Header: &buffer.VP8{
FirstByte: 25,
PictureIDPresent: 1,
PictureID: 13468,
@@ -1256,7 +1256,7 @@ func TestForwarderGetTranslationParamsVideo(t *testing.T) {
timestamp: 0xabcdf0,
},
vp8: &TranslationParamsVP8{
header: &buffer.VP8{
Header: &buffer.VP8{
FirstByte: 25,
PictureIDPresent: 1,
PictureID: 13469,

View File

@@ -12,7 +12,7 @@ import (
// VP8 munger
//
type TranslationParamsVP8 struct {
header *buffer.VP8
Header *buffer.VP8
}
type VP8MungerParams struct {
@@ -139,7 +139,7 @@ func (v *VP8Munger) UpdateAndGet(extPkt *buffer.ExtPacket, ordering SequenceNumb
HeaderSize: vp8.HeaderSize + buffer.VP8PictureIdSizeDiff(mungedPictureId > 127, vp8.MBit),
}
return &TranslationParamsVP8{
header: vp8Packet,
Header: vp8Packet,
}, nil
}
@@ -222,7 +222,7 @@ func (v *VP8Munger) UpdateAndGet(extPkt *buffer.ExtPacket, ordering SequenceNumb
HeaderSize: vp8.HeaderSize + buffer.VP8PictureIdSizeDiff(mungedPictureId > 127, vp8.MBit),
}
return &TranslationParamsVP8{
header: vp8Packet,
Header: vp8Packet,
}, nil
}

View File

@@ -197,7 +197,7 @@ func TestOutOfOrderPictureId(t *testing.T) {
extPkt, _ = testutils.GetTestExtPacketVP8(params, vp8)
tpExpected := TranslationParamsVP8{
header: &buffer.VP8{
Header: &buffer.VP8{
FirstByte: 25,
PictureIDPresent: 1,
PictureID: 13469,
@@ -236,7 +236,7 @@ func TestOutOfOrderPictureId(t *testing.T) {
extPkt, _ = testutils.GetTestExtPacketVP8(params, vp8)
tpExpected = TranslationParamsVP8{
header: &buffer.VP8{
Header: &buffer.VP8{
FirstByte: 25,
PictureIDPresent: 1,
PictureID: 13468,
@@ -345,7 +345,7 @@ func TestGapInSequenceNumberSamePicture(t *testing.T) {
v.SetLast(extPkt)
tpExpected := TranslationParamsVP8{
header: &buffer.VP8{
Header: &buffer.VP8{
FirstByte: 25,
PictureIDPresent: 1,
PictureID: 13467,
@@ -367,7 +367,7 @@ func TestGapInSequenceNumberSamePicture(t *testing.T) {
// telling there is a gap in sequence number will add pictures to missing picture cache
tpExpected = TranslationParamsVP8{
header: &buffer.VP8{
Header: &buffer.VP8{
FirstByte: 25,
PictureIDPresent: 1,
PictureID: 13467,