Skip to content

Commit e8067d2

Browse files
committed
fix: don't enforce minimal esds size, issue #393
1 parent 17cd9fc commit e8067d2

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1717

1818
- mp4.SetUUID() can take base64 string as well as hex-encoded.
1919

20+
### Fixed
21+
22+
- support short ESDS without SLConfig descriptor (issue #393)
23+
2024
## [0.47.0] - 2024-11-12
2125

2226
### Changed

mp4/descriptors.go

-2
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ const (
2020
DecoderConfigDescrTag = 4
2121
DecSpecificInfoTag = 5
2222
SLConfigDescrTag = 6
23-
24-
minimalEsDescrSize = 25
2523
)
2624

2725
func TagType(tag byte) string {

mp4/esds.go

-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ func DecodeEsdsSR(hdr BoxHeader, startPos uint64, sr bits.SliceReader) (Box, err
4242
Version: version,
4343
Flags: versionAndFlags & flagsMask,
4444
}
45-
if hdr.Size < 12+minimalEsDescrSize {
46-
return nil, fmt.Errorf("too few bytes in esds box")
47-
}
4845
descSize := uint32(hdr.Size - 12)
4946
var err error
5047
e.ESDescriptor, err = DecodeESDescriptor(sr, descSize)

mp4/esds_test.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const (
1313
esdsMp4Box = `0000002a6573647300000000031c0000000414401500000000010d88000003f80505128856e500060102`
1414
esdsEncAudio = `0000003365736473000000000380808022000000048080801440150018000003eb100002710005808080021190068080800102`
1515
esdsLongEnd = `0000002f65736473000000000321000000041140150002440001ea940001ea94050212100680808080808080800102`
16+
esdsShort = `0000002365736473000000000315000000040d6b150001e00002850000027100060102`
1617
)
1718

1819
func TestEsdsEncodeAndDecode(t *testing.T) {
@@ -42,7 +43,7 @@ func TestEsdsEncodeAndDecode(t *testing.T) {
4243
boxDiffAfterEncodeAndDecode(t, esdsIn)
4344
}
4445
func TestDecodeEncodeEsds(t *testing.T) {
45-
inputs := []string{esdsProgIn, esdsMp4Box, esdsEncAudio, esdsLongEnd}
46+
inputs := []string{esdsShort, esdsProgIn, esdsMp4Box, esdsEncAudio, esdsLongEnd}
4647
for i, inp := range inputs {
4748
data, err := hex.DecodeString(inp)
4849
if err != nil {

0 commit comments

Comments
 (0)