mirror of
https://github.com/aler9/gortsplib
synced 2025-10-15 03:30:47 +08:00
move AUD logic into mediacommon (#577)
This commit is contained in:
@@ -52,10 +52,7 @@ func (e *mpegtsMuxer) close() {
|
|||||||
|
|
||||||
// writeH264 writes a H264 access unit into MPEG-TS.
|
// writeH264 writes a H264 access unit into MPEG-TS.
|
||||||
func (e *mpegtsMuxer) writeH264(au [][]byte, pts time.Duration) error {
|
func (e *mpegtsMuxer) writeH264(au [][]byte, pts time.Duration) error {
|
||||||
// prepend an AUD. This is required by some players
|
var filteredAU [][]byte
|
||||||
filteredAU := [][]byte{
|
|
||||||
{byte(h264.NALUTypeAccessUnitDelimiter), 240},
|
|
||||||
}
|
|
||||||
|
|
||||||
nonIDRPresent := false
|
nonIDRPresent := false
|
||||||
idrPresent := false
|
idrPresent := false
|
||||||
@@ -86,7 +83,7 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts time.Duration) error {
|
|||||||
|
|
||||||
au = filteredAU
|
au = filteredAU
|
||||||
|
|
||||||
if len(au) <= 1 || (!nonIDRPresent && !idrPresent) {
|
if au == nil || (!nonIDRPresent && !idrPresent) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -53,10 +53,7 @@ func (e *mpegtsMuxer) close() {
|
|||||||
|
|
||||||
// writeH265 writes a H265 access unit into MPEG-TS.
|
// writeH265 writes a H265 access unit into MPEG-TS.
|
||||||
func (e *mpegtsMuxer) writeH265(au [][]byte, pts time.Duration) error {
|
func (e *mpegtsMuxer) writeH265(au [][]byte, pts time.Duration) error {
|
||||||
// prepend an AUD. This is required by some players
|
var filteredAU [][]byte
|
||||||
filteredAU := [][]byte{
|
|
||||||
{byte(h265.NALUType_AUD_NUT) << 1, 1, 0x50},
|
|
||||||
}
|
|
||||||
|
|
||||||
isRandomAccess := false
|
isRandomAccess := false
|
||||||
|
|
||||||
@@ -87,7 +84,7 @@ func (e *mpegtsMuxer) writeH265(au [][]byte, pts time.Duration) error {
|
|||||||
|
|
||||||
au = filteredAU
|
au = filteredAU
|
||||||
|
|
||||||
if len(au) <= 1 {
|
if au == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -52,10 +52,7 @@ func (e *mpegtsMuxer) close() {
|
|||||||
|
|
||||||
// writeH264 writes a H264 access unit into MPEG-TS.
|
// writeH264 writes a H264 access unit into MPEG-TS.
|
||||||
func (e *mpegtsMuxer) writeH264(au [][]byte, pts time.Duration) error {
|
func (e *mpegtsMuxer) writeH264(au [][]byte, pts time.Duration) error {
|
||||||
// prepend an AUD. This is required by some players
|
var filteredAU [][]byte
|
||||||
filteredAU := [][]byte{
|
|
||||||
{byte(h264.NALUTypeAccessUnitDelimiter), 240},
|
|
||||||
}
|
|
||||||
|
|
||||||
nonIDRPresent := false
|
nonIDRPresent := false
|
||||||
idrPresent := false
|
idrPresent := false
|
||||||
@@ -86,7 +83,7 @@ func (e *mpegtsMuxer) writeH264(au [][]byte, pts time.Duration) error {
|
|||||||
|
|
||||||
au = filteredAU
|
au = filteredAU
|
||||||
|
|
||||||
if len(au) <= 1 || (!nonIDRPresent && !idrPresent) {
|
if au == nil || (!nonIDRPresent && !idrPresent) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
go.mod
2
go.mod
@@ -3,7 +3,7 @@ module github.com/bluenviron/gortsplib/v4
|
|||||||
go 1.20
|
go 1.20
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/bluenviron/mediacommon v1.11.0
|
github.com/bluenviron/mediacommon v1.11.1-0.20240525122142-20163863aa75
|
||||||
github.com/google/uuid v1.6.0
|
github.com/google/uuid v1.6.0
|
||||||
github.com/pion/rtcp v1.2.14
|
github.com/pion/rtcp v1.2.14
|
||||||
github.com/pion/rtp v1.8.7-0.20240429002300-bc5124c9d0d0
|
github.com/pion/rtp v1.8.7-0.20240429002300-bc5124c9d0d0
|
||||||
|
4
go.sum
4
go.sum
@@ -2,8 +2,8 @@ github.com/asticode/go-astikit v0.30.0 h1:DkBkRQRIxYcknlaU7W7ksNfn4gMFsB0tqMJflx
|
|||||||
github.com/asticode/go-astikit v0.30.0/go.mod h1:h4ly7idim1tNhaVkdVBeXQZEE3L0xblP7fCWbgwipF0=
|
github.com/asticode/go-astikit v0.30.0/go.mod h1:h4ly7idim1tNhaVkdVBeXQZEE3L0xblP7fCWbgwipF0=
|
||||||
github.com/asticode/go-astits v1.13.0 h1:XOgkaadfZODnyZRR5Y0/DWkA9vrkLLPLeeOvDwfKZ1c=
|
github.com/asticode/go-astits v1.13.0 h1:XOgkaadfZODnyZRR5Y0/DWkA9vrkLLPLeeOvDwfKZ1c=
|
||||||
github.com/asticode/go-astits v1.13.0/go.mod h1:QSHmknZ51pf6KJdHKZHJTLlMegIrhega3LPWz3ND/iI=
|
github.com/asticode/go-astits v1.13.0/go.mod h1:QSHmknZ51pf6KJdHKZHJTLlMegIrhega3LPWz3ND/iI=
|
||||||
github.com/bluenviron/mediacommon v1.11.0 h1:1xY4QGYz7da9tsV2Xvd+ol+Ul5qq2g7ADJtIlVkQSRI=
|
github.com/bluenviron/mediacommon v1.11.1-0.20240525122142-20163863aa75 h1:5P8Um+ySuwZApuVS9gI6U0MnrIFybTfLrZSqV2ie5lA=
|
||||||
github.com/bluenviron/mediacommon v1.11.0/go.mod h1:HDyW2CzjvhYJXtdxstdFPio3G0qSocPhqkhUt/qffec=
|
github.com/bluenviron/mediacommon v1.11.1-0.20240525122142-20163863aa75/go.mod h1:HDyW2CzjvhYJXtdxstdFPio3G0qSocPhqkhUt/qffec=
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||||
|
Reference in New Issue
Block a user