hls client: add limit on AU size

This commit is contained in:
aler9 2022-04-29 12:02:11 +02:00
parent 095b90b7ef
commit 35b3541e4f
8 changed files with 11 additions and 11 deletions

2
go.mod
View File

@ -4,7 +4,7 @@ go 1.17
require (
code.cloudfoundry.org/bytefmt v0.0.0-20211005130812-5bb3c17173e5
github.com/aler9/gortsplib v0.0.0-20220421115218-aa09a71cf4b1
github.com/aler9/gortsplib v0.0.0-20220429092609-4a4cc67128f1
github.com/asticode/go-astits v1.10.1-0.20220319093903-4abe66a9b757
github.com/fsnotify/fsnotify v1.4.9
github.com/gin-gonic/gin v1.7.2

4
go.sum
View File

@ -4,8 +4,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/aler9/gortsplib v0.0.0-20220421115218-aa09a71cf4b1 h1:reXoDO1Ew8q6Kfm/5dcOrhGIkSPoJ81e/wY05nyIxVM=
github.com/aler9/gortsplib v0.0.0-20220421115218-aa09a71cf4b1/go.mod h1:Mezkz7Jb5zrIWP6MxJ2uBgt5xwywZkcdmuQZ2QrFYsM=
github.com/aler9/gortsplib v0.0.0-20220429092609-4a4cc67128f1 h1:UrUPMao/+e88YSA2lvySPesQ7tbzExxcMkHVbGU0rZg=
github.com/aler9/gortsplib v0.0.0-20220429092609-4a4cc67128f1/go.mod h1:Mezkz7Jb5zrIWP6MxJ2uBgt5xwywZkcdmuQZ2QrFYsM=
github.com/aler9/rtmp v0.0.0-20210403095203-3be4a5535927 h1:95mXJ5fUCYpBRdSOnLAQAdJHHKxxxJrVCiaqDi965YQ=
github.com/aler9/rtmp v0.0.0-20210403095203-3be4a5535927/go.mod h1:vzuE21rowz+lT1NGsWbreIvYulgBpCGnQyeTyFblUHc=
github.com/asticode/go-astikit v0.20.0 h1:+7N+J4E4lWx2QOkRdOf6DafWJMv6O4RRfgClwQokrH8=

View File

@ -70,7 +70,7 @@ func (ts *testHLSServer) onSegment(ctx *gin.Context) {
mux.WriteTables()
enc, _ := h264.EncodeAnnexB([][]byte{
enc, _ := h264.AnnexBEncode([][]byte{
{7, 1, 2, 3}, // SPS
{8}, // PPS
})
@ -94,7 +94,7 @@ func (ts *testHLSServer) onSegment(ctx *gin.Context) {
time.Sleep(1 * time.Second)
enc, _ = h264.EncodeAnnexB([][]byte{
enc, _ = h264.AnnexBEncode([][]byte{
{5}, // IDR
})

View File

@ -386,7 +386,7 @@ func (c *rtmpConn) runRead(ctx context.Context) error {
}
}
avcc, err := h264.EncodeAVCC(data.h264NALUs)
avcc, err := h264.AVCCEncode(data.h264NALUs)
if err != nil {
return err
}
@ -565,7 +565,7 @@ func (c *rtmpConn) runPublish(ctx context.Context) error {
return fmt.Errorf("received an H264 packet, but track is not set up")
}
nalus, err := h264.DecodeAVCC(pkt.Data)
nalus, err := h264.AVCCDecode(pkt.Data)
if err != nil {
return err
}

View File

@ -182,7 +182,7 @@ func (s *rtmpSource) runInner() bool {
return fmt.Errorf("received an H264 packet, but track is not set up")
}
nalus, err := h264.DecodeAVCC(pkt.Data)
nalus, err := h264.AVCCDecode(pkt.Data)
if err != nil {
return err
}

View File

@ -142,7 +142,7 @@ func newTestHLSServer(ca string) (*testHLSServer, error) {
mux.SetPCRPID(256)
mux.WriteTables()
enc, _ := h264.EncodeAnnexB([][]byte{
enc, _ := h264.AnnexBEncode([][]byte{
{7, 1, 2, 3}, // SPS
{8}, // PPS
{5}, // IDR

View File

@ -83,7 +83,7 @@ func (p *clientVideoProcessor) doProcess(
}
}
nalus, err := h264.DecodeAnnexB(data)
nalus, err := h264.AnnexBDecode(data)
if err != nil {
p.logger.Log(logger.Warn, "unable to decode Annex-B: %s", err)
return nil

View File

@ -117,7 +117,7 @@ func (m *muxerTSGenerator) writeH264(pts time.Duration, nalus [][]byte) error {
// prepend an AUD. This is required by video.js and iOS
nalus = append([][]byte{{byte(h264.NALUTypeAccessUnitDelimiter), 240}}, nalus...)
enc, err := h264.EncodeAnnexB(nalus)
enc, err := h264.AnnexBEncode(nalus)
if err != nil {
if m.currentSegment.buf.Len() > 0 {
m.streamPlaylist.pushSegment(m.currentSegment)