mirror of
https://github.com/aler9/gortsplib
synced 2025-10-01 05:22:22 +08:00
bump Golang to 1.23 (#610)
This commit is contained in:
9
.github/workflows/lint.yml
vendored
9
.github/workflows/lint.yml
vendored
@@ -10,16 +10,19 @@ jobs:
|
|||||||
golangci-lint:
|
golangci-lint:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
|
||||||
|
env:
|
||||||
|
CGO_ENABLED: '0'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: "1.22"
|
go-version: "1.23"
|
||||||
|
|
||||||
- uses: golangci/golangci-lint-action@v3
|
- uses: golangci/golangci-lint-action@v3
|
||||||
with:
|
with:
|
||||||
version: v1.59.1
|
version: v1.61.0
|
||||||
|
|
||||||
go-mod-tidy:
|
go-mod-tidy:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
@@ -29,7 +32,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: "1.22"
|
go-version: "1.23"
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
go mod tidy
|
go mod tidy
|
||||||
|
6
.github/workflows/test.yml
vendored
6
.github/workflows/test.yml
vendored
@@ -11,7 +11,7 @@ jobs:
|
|||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go: ["1.20", "1.21", "1.22"]
|
go: ["1.21", "1.22", "1.23"]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -24,7 +24,7 @@ jobs:
|
|||||||
|
|
||||||
- run: make test-nodocker
|
- run: make test-nodocker
|
||||||
|
|
||||||
- if: matrix.go == '1.22'
|
- if: matrix.go == '1.23'
|
||||||
uses: codecov/codecov-action@v3
|
uses: codecov/codecov-action@v3
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CODECOV_TOKEN }}
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-go@v3
|
- uses: actions/setup-go@v3
|
||||||
with:
|
with:
|
||||||
go-version: "1.22"
|
go-version: "1.23"
|
||||||
|
|
||||||
- run: make test-highlevel-nodocker
|
- run: make test-highlevel-nodocker
|
||||||
|
|
||||||
|
4
Makefile
4
Makefile
@@ -1,5 +1,5 @@
|
|||||||
BASE_IMAGE = golang:1.22-alpine3.18
|
BASE_IMAGE = golang:1.23-alpine3.20
|
||||||
LINT_IMAGE = golangci/golangci-lint:v1.59.1
|
LINT_IMAGE = golangci/golangci-lint:v1.61.0
|
||||||
|
|
||||||
.PHONY: $(shell ls)
|
.PHONY: $(shell ls)
|
||||||
|
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
RTSP 1.0 client and server library for the Go programming language, written for [MediaMTX](https://github.com/bluenviron/mediamtx).
|
RTSP 1.0 client and server library for the Go programming language, written for [MediaMTX](https://github.com/bluenviron/mediamtx).
|
||||||
|
|
||||||
Go ≥ 1.20 is required.
|
Go ≥ 1.21 is required.
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
|
|
||||||
|
@@ -1914,7 +1914,7 @@ func (c *Client) PacketPTS(medi *description.Media, pkt *rtp.Packet) (time.Durat
|
|||||||
return multiplyAndDivide(time.Duration(v), time.Second, time.Duration(ct.format.ClockRate())), true
|
return multiplyAndDivide(time.Duration(v), time.Second, time.Duration(ct.format.ClockRate())), true
|
||||||
}
|
}
|
||||||
|
|
||||||
// PacketPTS returns the PTS of an incoming RTP packet.
|
// PacketPTS2 returns the PTS of an incoming RTP packet.
|
||||||
// It is computed by decoding the packet timestamp and sychronizing it with other tracks.
|
// It is computed by decoding the packet timestamp and sychronizing it with other tracks.
|
||||||
func (c *Client) PacketPTS2(medi *description.Media, pkt *rtp.Packet) (int64, bool) {
|
func (c *Client) PacketPTS2(medi *description.Media, pkt *rtp.Packet) (int64, bool) {
|
||||||
cm := c.medias[medi]
|
cm := c.medias[medi]
|
||||||
|
@@ -15,8 +15,8 @@ func int64Ptr(v int64) *int64 {
|
|||||||
return &v
|
return &v
|
||||||
}
|
}
|
||||||
|
|
||||||
func randInRange(max int) (int, error) {
|
func randInRange(maxVal int) (int, error) {
|
||||||
b := big.NewInt(int64(max + 1))
|
b := big.NewInt(int64(maxVal + 1))
|
||||||
n, err := rand.Int(rand.Reader, b)
|
n, err := rand.Int(rand.Reader, b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, err
|
return 0, err
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
|
//go:build cgo
|
||||||
|
// +build cgo
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
|
//go:build cgo
|
||||||
|
// +build cgo
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
|
//go:build cgo
|
||||||
|
// +build cgo
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
@@ -1,3 +1,6 @@
|
|||||||
|
//go:build cgo
|
||||||
|
// +build cgo
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
|||||||
module github.com/bluenviron/gortsplib/v4
|
module github.com/bluenviron/gortsplib/v4
|
||||||
|
|
||||||
go 1.20
|
go 1.21
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bluenviron/mediacommon v1.13.1
|
github.com/bluenviron/mediacommon v1.13.1
|
||||||
|
@@ -743,7 +743,8 @@ var casesFormat = []struct {
|
|||||||
"s=\n" +
|
"s=\n" +
|
||||||
"m=video 0 RTP/AVP 96\n" +
|
"m=video 0 RTP/AVP 96\n" +
|
||||||
"a=rtpmap:96 MP4V-ES/90000\n" +
|
"a=rtpmap:96 MP4V-ES/90000\n" +
|
||||||
"a=fmtp:96 profile-level-id=1; config=000001B001000001B58913000001000000012000C48D8AEE053C04641443000001B24C61766335382E3133342E313030\n",
|
"a=fmtp:96 profile-level-id=1; " +
|
||||||
|
"config=000001B001000001B58913000001000000012000C48D8AEE053C04641443000001B24C61766335382E3133342E313030\n",
|
||||||
&MPEG4Video{
|
&MPEG4Video{
|
||||||
PayloadTyp: 96,
|
PayloadTyp: 96,
|
||||||
ProfileLevelID: 1,
|
ProfileLevelID: 1,
|
||||||
@@ -770,7 +771,8 @@ var casesFormat = []struct {
|
|||||||
"s=\n" +
|
"s=\n" +
|
||||||
"m=video 0 RTP/AVP 96\n" +
|
"m=video 0 RTP/AVP 96\n" +
|
||||||
"a=rtpmap:96 H264/90000\n" +
|
"a=rtpmap:96 H264/90000\n" +
|
||||||
"a=fmtp:96 packetization-mode=1; profile-level-id=64000C; sprop-parameter-sets=Z2QADKw7ULBLQgAAAwACAAADAD0I,aO48gA==\n",
|
"a=fmtp:96 packetization-mode=1; profile-level-id=64000C; " +
|
||||||
|
"sprop-parameter-sets=Z2QADKw7ULBLQgAAAwACAAADAD0I,aO48gA==\n",
|
||||||
&H264{
|
&H264{
|
||||||
PayloadTyp: 96,
|
PayloadTyp: 96,
|
||||||
SPS: []byte{
|
SPS: []byte{
|
||||||
@@ -797,7 +799,8 @@ var casesFormat = []struct {
|
|||||||
"s=\n" +
|
"s=\n" +
|
||||||
"m=video 0 RTP/AVP 96\n" +
|
"m=video 0 RTP/AVP 96\n" +
|
||||||
"a=rtpmap:96 H264/90000\n" +
|
"a=rtpmap:96 H264/90000\n" +
|
||||||
"a=fmtp:96 packetization-mode=1; profile-level-id=64001f; sprop-parameter-sets=Z2QAH6zZQFAFuwFsgAAAAwCAAAAeB4wYyw==,aOvjyyLA\n",
|
"a=fmtp:96 packetization-mode=1; profile-level-id=64001f; " +
|
||||||
|
"sprop-parameter-sets=Z2QAH6zZQFAFuwFsgAAAAwCAAAAeB4wYyw==,aOvjyyLA\n",
|
||||||
&H264{
|
&H264{
|
||||||
PayloadTyp: 96,
|
PayloadTyp: 96,
|
||||||
SPS: []byte{
|
SPS: []byte{
|
||||||
@@ -825,7 +828,8 @@ var casesFormat = []struct {
|
|||||||
"s=\n" +
|
"s=\n" +
|
||||||
"m=video 0 RTP/AVP 96\n" +
|
"m=video 0 RTP/AVP 96\n" +
|
||||||
"a=rtpmap:96 H264/90000\n" +
|
"a=rtpmap:96 H264/90000\n" +
|
||||||
"a=fmtp:96 packetization-mode=1; profile-level-id=640029; sprop-parameter-sets=Z2QAKawTMUB4BEfeA+oCAgPgAAADACAAAAZSgA==,aPqPLA==,aF6jzAMA\n",
|
"a=fmtp:96 packetization-mode=1; profile-level-id=640029; " +
|
||||||
|
"sprop-parameter-sets=Z2QAKawTMUB4BEfeA+oCAgPgAAADACAAAAZSgA==,aPqPLA==,aF6jzAMA\n",
|
||||||
&H264{
|
&H264{
|
||||||
PayloadTyp: 96,
|
PayloadTyp: 96,
|
||||||
SPS: []byte{
|
SPS: []byte{
|
||||||
@@ -870,7 +874,8 @@ var casesFormat = []struct {
|
|||||||
"s=\n" +
|
"s=\n" +
|
||||||
"m=video 0 RTP/AVP 96\n" +
|
"m=video 0 RTP/AVP 96\n" +
|
||||||
"a=rtpmap:96 H264/90000\n" +
|
"a=rtpmap:96 H264/90000\n" +
|
||||||
"a=fmtp:96 packetization-mode=1; profile-level-id=4DE028; sprop-parameter-sets=AAAAAWdNAB6NjUBaHtCAAAOEAACvyAI=,AAAAAWjuOIA=\n",
|
"a=fmtp:96 packetization-mode=1; profile-level-id=4DE028; " +
|
||||||
|
"sprop-parameter-sets=AAAAAWdNAB6NjUBaHtCAAAOEAACvyAI=,AAAAAWjuOIA=\n",
|
||||||
&H264{
|
&H264{
|
||||||
PayloadTyp: 96,
|
PayloadTyp: 96,
|
||||||
SPS: []byte{
|
SPS: []byte{
|
||||||
@@ -897,7 +902,8 @@ var casesFormat = []struct {
|
|||||||
"s=\n" +
|
"s=\n" +
|
||||||
"m=video 0 RTP/AVP 96\n" +
|
"m=video 0 RTP/AVP 96\n" +
|
||||||
"a=rtpmap:96 H264/90000\n" +
|
"a=rtpmap:96 H264/90000\n" +
|
||||||
"a=fmtp:96 packetization-mode=1; profile-level-id=010101; sprop-parameter-sets=QgEBAWAAAAMAAAMAAAMAAAMAlqADwIAQ5Y2uSTJrlnAIAAADAAgAAAMAyEA=,RAHgdrAmQA==\n",
|
"a=fmtp:96 packetization-mode=1; profile-level-id=010101; " +
|
||||||
|
"sprop-parameter-sets=QgEBAWAAAAMAAAMAAAMAAAMAlqADwIAQ5Y2uSTJrlnAIAAADAAgAAAMAyEA=,RAHgdrAmQA==\n",
|
||||||
&H264{
|
&H264{
|
||||||
PayloadTyp: 96,
|
PayloadTyp: 96,
|
||||||
PacketizationMode: 1,
|
PacketizationMode: 1,
|
||||||
@@ -966,7 +972,8 @@ var casesFormat = []struct {
|
|||||||
"s=\n" +
|
"s=\n" +
|
||||||
"m=video 0 RTP/AVP 96\n" +
|
"m=video 0 RTP/AVP 96\n" +
|
||||||
"a=rtpmap:96 H265/90000\n" +
|
"a=rtpmap:96 H265/90000\n" +
|
||||||
"a=fmtp:96 sprop-vps=QAEMAf//AWAAAAMAkAAAAwAAAwB4mZgJ; sprop-sps=QgEBAWAAAAMAkAAAAwAAAwB4oAPAgBDllmZpJMrgEAAAAwAQAAADAeCA; " +
|
"a=fmtp:96 sprop-vps=QAEMAf//AWAAAAMAkAAAAwAAAwB4mZgJ; " +
|
||||||
|
"sprop-sps=QgEBAWAAAAMAkAAAAwAAAwB4oAPAgBDllmZpJMrgEAAAAwAQAAADAeCA; " +
|
||||||
"sprop-pps=RAHBcrRiQA==; sprop-max-don-diff=2\n",
|
"sprop-pps=RAHBcrRiQA==; sprop-max-don-diff=2\n",
|
||||||
&H265{
|
&H265{
|
||||||
PayloadTyp: 96,
|
PayloadTyp: 96,
|
||||||
@@ -1003,7 +1010,8 @@ var casesFormat = []struct {
|
|||||||
"s=\n" +
|
"s=\n" +
|
||||||
"m=video 0 RTP/AVP 96\n" +
|
"m=video 0 RTP/AVP 96\n" +
|
||||||
"a=rtpmap:96 H265/90000\n" +
|
"a=rtpmap:96 H265/90000\n" +
|
||||||
"a=fmtp:96 sprop-vps=AAAAAUABDAH//wFgAAADAAADAAADAAADAJasCQ==; sprop-sps=AAAAAUIBAQFgAAADAAADAAADAAADAJagBaIB4WNrkkya5Zk=; " +
|
"a=fmtp:96 sprop-vps=AAAAAUABDAH//wFgAAADAAADAAADAAADAJasCQ==; " +
|
||||||
|
"sprop-sps=AAAAAUIBAQFgAAADAAADAAADAAADAJagBaIB4WNrkkya5Zk=; " +
|
||||||
"sprop-pps=AAAAAUQB4HawJkA=\n",
|
"sprop-pps=AAAAAUQB4HawJkA=\n",
|
||||||
&H265{
|
&H265{
|
||||||
PayloadTyp: 96,
|
PayloadTyp: 96,
|
||||||
@@ -1224,7 +1232,7 @@ func FuzzUnmarshal(f *testing.F) {
|
|||||||
err := desc.Unmarshal([]byte(in))
|
err := desc.Unmarshal([]byte(in))
|
||||||
|
|
||||||
if err == nil && len(desc.MediaDescriptions) == 1 && len(desc.MediaDescriptions[0].MediaName.Formats) == 1 {
|
if err == nil && len(desc.MediaDescriptions) == 1 && len(desc.MediaDescriptions[0].MediaName.Formats) == 1 {
|
||||||
Unmarshal(desc.MediaDescriptions[0], desc.MediaDescriptions[0].MediaName.Formats[0])
|
Unmarshal(desc.MediaDescriptions[0], desc.MediaDescriptions[0].MediaName.Formats[0]) //nolint:errcheck
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -63,7 +63,7 @@ func TestH264DecEncoder(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func FuzzH264PTSEqualsDTS(f *testing.F) {
|
func FuzzH264PTSEqualsDTS(f *testing.F) {
|
||||||
f.Fuzz(func(t *testing.T, b []byte) {
|
f.Fuzz(func(_ *testing.T, b []byte) {
|
||||||
(&H264{}).PTSEqualsDTS(&rtp.Packet{Payload: b})
|
(&H264{}).PTSEqualsDTS(&rtp.Packet{Payload: b})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -72,7 +72,7 @@ func TestH265DecEncoder(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func FuzzH265PTSEqualsDTS(f *testing.F) {
|
func FuzzH265PTSEqualsDTS(f *testing.F) {
|
||||||
f.Fuzz(func(t *testing.T, b []byte) {
|
f.Fuzz(func(_ *testing.T, b []byte) {
|
||||||
(&H265{}).PTSEqualsDTS(&rtp.Packet{Payload: b})
|
(&H265{}).PTSEqualsDTS(&rtp.Packet{Payload: b})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,8 @@ func (d *Decoder) decodeOBUs(pkt *rtp.Packet) ([][]byte, error) {
|
|||||||
|
|
||||||
if d.fragmentsSize > av1.MaxTemporalUnitSize {
|
if d.fragmentsSize > av1.MaxTemporalUnitSize {
|
||||||
d.resetFragments()
|
d.resetFragments()
|
||||||
return nil, fmt.Errorf("temporal unit size (%d) is too big, maximum is %d", d.fragmentsSize, av1.MaxTemporalUnitSize)
|
return nil, fmt.Errorf("temporal unit size (%d) is too big, maximum is %d",
|
||||||
|
d.fragmentsSize, av1.MaxTemporalUnitSize)
|
||||||
}
|
}
|
||||||
|
|
||||||
d.fragments = append(d.fragments, av1header.OBUElements[elementCount-1])
|
d.fragments = append(d.fragments, av1header.OBUElements[elementCount-1])
|
||||||
|
@@ -68,7 +68,7 @@ func TestDecodeErrorMissingPacket(t *testing.T) {
|
|||||||
SequenceNumber: 17645,
|
SequenceNumber: 17645,
|
||||||
SSRC: 0x9dbb7812,
|
SSRC: 0x9dbb7812,
|
||||||
},
|
},
|
||||||
Payload: []byte{
|
Payload: []byte{ //nolint:dupl
|
||||||
0x40, 0xb1, 0x0b, 0x30, 0x30, 0xca, 0x08, 0x12,
|
0x40, 0xb1, 0x0b, 0x30, 0x30, 0xca, 0x08, 0x12,
|
||||||
0xfd, 0xfd, 0x78, 0x89, 0xe5, 0x3e, 0xa3, 0x80,
|
0xfd, 0xfd, 0x78, 0x89, 0xe5, 0x3e, 0xa3, 0x80,
|
||||||
0x08, 0x20, 0x82, 0x08, 0x54, 0x50, 0x00, 0x30,
|
0x08, 0x20, 0x82, 0x08, 0x54, 0x50, 0x00, 0x30,
|
||||||
|
@@ -266,7 +266,7 @@ var cases = []struct {
|
|||||||
SequenceNumber: 17645,
|
SequenceNumber: 17645,
|
||||||
SSRC: 0x9dbb7812,
|
SSRC: 0x9dbb7812,
|
||||||
},
|
},
|
||||||
Payload: []byte{
|
Payload: []byte{ //nolint:dupl
|
||||||
0x40, 0xb1, 0x0b, 0x30, 0x30, 0xca, 0x08, 0x12,
|
0x40, 0xb1, 0x0b, 0x30, 0x30, 0xca, 0x08, 0x12,
|
||||||
0xfd, 0xfd, 0x78, 0x89, 0xe5, 0x3e, 0xa3, 0x80,
|
0xfd, 0xfd, 0x78, 0x89, 0xe5, 0x3e, 0xa3, 0x80,
|
||||||
0x08, 0x20, 0x82, 0x08, 0x54, 0x50, 0x00, 0x30,
|
0x08, 0x20, 0x82, 0x08, 0x54, 0x50, 0x00, 0x30,
|
||||||
@@ -523,7 +523,7 @@ var cases = []struct {
|
|||||||
SequenceNumber: 17645,
|
SequenceNumber: 17645,
|
||||||
SSRC: 0x9dbb7812,
|
SSRC: 0x9dbb7812,
|
||||||
},
|
},
|
||||||
Payload: []byte{
|
Payload: []byte{ //nolint:dupl
|
||||||
0x48, 0x10, 0x0a, 0x0e, 0x00, 0x00, 0x00, 0x4a,
|
0x48, 0x10, 0x0a, 0x0e, 0x00, 0x00, 0x00, 0x4a,
|
||||||
0xab, 0xbf, 0xc3, 0x77, 0x6b, 0xe4, 0x40, 0x40,
|
0xab, 0xbf, 0xc3, 0x77, 0x6b, 0xe4, 0x40, 0x40,
|
||||||
0x40, 0x41, 0xa0, 0x0b, 0x30, 0x30, 0xca, 0x08,
|
0x40, 0x41, 0xa0, 0x0b, 0x30, 0x30, 0xca, 0x08,
|
||||||
@@ -717,7 +717,7 @@ var cases = []struct {
|
|||||||
SequenceNumber: 17646,
|
SequenceNumber: 17646,
|
||||||
SSRC: 0x9dbb7812,
|
SSRC: 0x9dbb7812,
|
||||||
},
|
},
|
||||||
Payload: []byte{
|
Payload: []byte{ //nolint:dupl
|
||||||
0xc0, 0xcc, 0x01, 0x9c, 0x6e, 0x5f, 0x2f, 0x20,
|
0xc0, 0xcc, 0x01, 0x9c, 0x6e, 0x5f, 0x2f, 0x20,
|
||||||
0x78, 0x58, 0x59, 0x92, 0x15, 0xfe, 0x13, 0x07,
|
0x78, 0x58, 0x59, 0x92, 0x15, 0xfe, 0x13, 0x07,
|
||||||
0x87, 0xc7, 0x3e, 0x21, 0x04, 0x24, 0x33, 0x60,
|
0x87, 0xc7, 0x3e, 0x21, 0x04, 0x24, 0x33, 0x60,
|
||||||
|
@@ -86,8 +86,8 @@ func (e *Encoder) writeGenericFragmented(au []byte, timestamp uint32) ([]*rtp.Pa
|
|||||||
|
|
||||||
// AU-headers
|
// AU-headers
|
||||||
pos := 0
|
pos := 0
|
||||||
bits.WriteBits(payload[2:], &pos, uint64(le), e.SizeLength)
|
bits.WriteBitsUnsafe(payload[2:], &pos, uint64(le), e.SizeLength)
|
||||||
bits.WriteBits(payload[2:], &pos, 0, e.IndexLength)
|
bits.WriteBitsUnsafe(payload[2:], &pos, 0, e.IndexLength)
|
||||||
|
|
||||||
// AU
|
// AU
|
||||||
copy(payload[2+auHeadersLenBytes:], au)
|
copy(payload[2+auHeadersLenBytes:], au)
|
||||||
@@ -153,13 +153,13 @@ func (e *Encoder) writeGenericAggregated(aus [][]byte, timestamp uint32) ([]*rtp
|
|||||||
written := 0
|
written := 0
|
||||||
pos := 0
|
pos := 0
|
||||||
for i, au := range aus {
|
for i, au := range aus {
|
||||||
bits.WriteBits(payload[2:], &pos, uint64(len(au)), e.SizeLength)
|
bits.WriteBitsUnsafe(payload[2:], &pos, uint64(len(au)), e.SizeLength)
|
||||||
written += e.SizeLength
|
written += e.SizeLength
|
||||||
if i == 0 {
|
if i == 0 {
|
||||||
bits.WriteBits(payload[2:], &pos, 0, e.IndexLength)
|
bits.WriteBitsUnsafe(payload[2:], &pos, 0, e.IndexLength)
|
||||||
written += e.IndexLength
|
written += e.IndexLength
|
||||||
} else {
|
} else {
|
||||||
bits.WriteBits(payload[2:], &pos, 0, e.IndexDeltaLength)
|
bits.WriteBitsUnsafe(payload[2:], &pos, 0, e.IndexDeltaLength)
|
||||||
written += e.IndexDeltaLength
|
written += e.IndexDeltaLength
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -189,8 +189,8 @@ func (h *Transport) Unmarshal(v base.HeaderValue) error {
|
|||||||
if v != "" {
|
if v != "" {
|
||||||
ip := net.ParseIP(v)
|
ip := net.ParseIP(v)
|
||||||
if ip == nil {
|
if ip == nil {
|
||||||
addrs, err := net.LookupHost(v)
|
addrs, err2 := net.LookupHost(v)
|
||||||
if err != nil {
|
if err2 != nil {
|
||||||
return fmt.Errorf("invalid source (%v)", v)
|
return fmt.Errorf("invalid source (%v)", v)
|
||||||
}
|
}
|
||||||
ip = net.ParseIP(addrs[0])
|
ip = net.ParseIP(addrs[0])
|
||||||
@@ -211,38 +211,38 @@ func (h *Transport) Unmarshal(v base.HeaderValue) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case "interleaved":
|
case "interleaved":
|
||||||
ports, err := parsePorts(v)
|
ports, err2 := parsePorts(v)
|
||||||
if err != nil {
|
if err2 != nil {
|
||||||
return err
|
return err2
|
||||||
}
|
}
|
||||||
h.InterleavedIDs = ports
|
h.InterleavedIDs = ports
|
||||||
|
|
||||||
case "ttl":
|
case "ttl":
|
||||||
tmp, err := strconv.ParseUint(v, 10, 32)
|
tmp, err2 := strconv.ParseUint(v, 10, 32)
|
||||||
if err != nil {
|
if err2 != nil {
|
||||||
return err
|
return err2
|
||||||
}
|
}
|
||||||
vu := uint(tmp)
|
vu := uint(tmp)
|
||||||
h.TTL = &vu
|
h.TTL = &vu
|
||||||
|
|
||||||
case "port":
|
case "port":
|
||||||
ports, err := parsePorts(v)
|
ports, err2 := parsePorts(v)
|
||||||
if err != nil {
|
if err2 != nil {
|
||||||
return err
|
return err2
|
||||||
}
|
}
|
||||||
h.Ports = ports
|
h.Ports = ports
|
||||||
|
|
||||||
case "client_port":
|
case "client_port":
|
||||||
ports, err := parsePorts(v)
|
ports, err2 := parsePorts(v)
|
||||||
if err != nil {
|
if err2 != nil {
|
||||||
return err
|
return err2
|
||||||
}
|
}
|
||||||
h.ClientPorts = ports
|
h.ClientPorts = ports
|
||||||
|
|
||||||
case "server_port":
|
case "server_port":
|
||||||
ports, err := parsePorts(v)
|
ports, err2 := parsePorts(v)
|
||||||
if err != nil {
|
if err2 != nil {
|
||||||
return err
|
return err2
|
||||||
}
|
}
|
||||||
h.ServerPorts = ports
|
h.ServerPorts = ports
|
||||||
|
|
||||||
@@ -253,7 +253,7 @@ func (h *Transport) Unmarshal(v base.HeaderValue) error {
|
|||||||
v = "0" + v
|
v = "0" + v
|
||||||
}
|
}
|
||||||
|
|
||||||
if tmp, err := hex.DecodeString(v); err == nil && len(tmp) <= 4 {
|
if tmp, err2 := hex.DecodeString(v); err2 == nil && len(tmp) <= 4 {
|
||||||
var ssrc [4]byte
|
var ssrc [4]byte
|
||||||
copy(ssrc[4-len(tmp):], tmp)
|
copy(ssrc[4-len(tmp):], tmp)
|
||||||
v := uint32(ssrc[0])<<24 | uint32(ssrc[1])<<16 | uint32(ssrc[2])<<8 | uint32(ssrc[3])
|
v := uint32(ssrc[0])<<24 | uint32(ssrc[1])<<16 | uint32(ssrc[2])<<8 | uint32(ssrc[3])
|
||||||
|
@@ -3010,7 +3010,8 @@ var cases = []struct {
|
|||||||
"m=video 0 RTP/AVP 96\r\n" +
|
"m=video 0 RTP/AVP 96\r\n" +
|
||||||
"a=control:trackID=0\r\n" +
|
"a=control:trackID=0\r\n" +
|
||||||
"a=rtpmap:96 H264/90000\r\n" +
|
"a=rtpmap:96 H264/90000\r\n" +
|
||||||
"a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z00AMpY1QFEBf03AQEBAgA==,aO4xsg==; profile-level-id=4D0032\r\n" +
|
"a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z00AMpY1QFEBf03AQEBAgA==,aO4xsg==; " +
|
||||||
|
"profile-level-id=4D0032\r\n" +
|
||||||
"m=audio 0 RTP/AVP 14\r\n" +
|
"m=audio 0 RTP/AVP 14\r\n" +
|
||||||
"a=control:trackID=1\r\n" +
|
"a=control:trackID=1\r\n" +
|
||||||
"m=text 0 RTP/AVP 103\r\n" +
|
"m=text 0 RTP/AVP 103\r\n" +
|
||||||
@@ -3023,7 +3024,8 @@ var cases = []struct {
|
|||||||
"m=video 0 RTP/AVP 96\r\n" +
|
"m=video 0 RTP/AVP 96\r\n" +
|
||||||
"a=control:trackID=0\r\n" +
|
"a=control:trackID=0\r\n" +
|
||||||
"a=rtpmap:96 H264/90000\r\n" +
|
"a=rtpmap:96 H264/90000\r\n" +
|
||||||
"a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z00AMpY1QFEBf03AQEBAgA==,aO4xsg==; profile-level-id=4D0032\r\n" +
|
"a=fmtp:96 packetization-mode=1; sprop-parameter-sets=Z00AMpY1QFEBf03AQEBAgA==,aO4xsg==; " +
|
||||||
|
"profile-level-id=4D0032\r\n" +
|
||||||
"m=audio 0 RTP/AVP 14\r\n" +
|
"m=audio 0 RTP/AVP 14\r\n" +
|
||||||
"a=control:trackID=1\r\n" +
|
"a=control:trackID=1\r\n" +
|
||||||
"m=text 0 RTP/AVP 103\r\n" +
|
"m=text 0 RTP/AVP 103\r\n" +
|
||||||
@@ -3060,8 +3062,9 @@ var cases = []struct {
|
|||||||
Value: "96 H264/90000",
|
Value: "96 H264/90000",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Key: "fmtp",
|
Key: "fmtp",
|
||||||
Value: "96 packetization-mode=1; sprop-parameter-sets=Z00AMpY1QFEBf03AQEBAgA==,aO4xsg==; profile-level-id=4D0032",
|
Value: "96 packetization-mode=1; sprop-parameter-sets=Z00AMpY1QFEBf03AQEBAgA==,aO4xsg==; " +
|
||||||
|
"profile-level-id=4D0032",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
lint:
|
lint:
|
||||||
docker run --rm -v $(PWD):/app -w /app \
|
docker run --rm -v $(PWD):/app -w /app \
|
||||||
|
-e CGO_ENABLED=0 \
|
||||||
$(LINT_IMAGE) \
|
$(LINT_IMAGE) \
|
||||||
golangci-lint run -v
|
golangci-lint run -v
|
||||||
|
@@ -206,8 +206,7 @@ func TestServerRecordErrorSetup(t *testing.T) {
|
|||||||
|
|
||||||
var inTH *headers.Transport
|
var inTH *headers.Transport
|
||||||
|
|
||||||
switch ca.name {
|
if ca.name == "invalid transport" {
|
||||||
case "invalid transport":
|
|
||||||
inTH = &headers.Transport{
|
inTH = &headers.Transport{
|
||||||
Delivery: deliveryPtr(headers.TransportDeliveryUnicast),
|
Delivery: deliveryPtr(headers.TransportDeliveryUnicast),
|
||||||
Mode: nil,
|
Mode: nil,
|
||||||
|
Reference in New Issue
Block a user