Skip to content

Commit

Permalink
fix: stsc correct handling of multiple sample desription IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbee committed Jan 14, 2025
1 parent 3677740 commit b65ab88
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion mp4/stsc.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func DecodeStscSR(hdr BoxHeader, startPos uint64, sr bits.SliceReader) (Box, err
if b.singleSampleDescriptionID != 0 {
b.SampleDescriptionID = make([]uint32, entryCount)
for j := 0; j < i; j++ {
b.SampleDescriptionID[i] = sdi
b.SampleDescriptionID[j] = b.singleSampleDescriptionID
}
b.singleSampleDescriptionID = 0
}
Expand Down
8 changes: 8 additions & 0 deletions mp4/stsc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,3 +171,11 @@ func TestGetChunk(t *testing.T) {
}
}
}

func TestStscSampleDescriptionID(t *testing.T) {
box := StscBox{}
_ = box.AddEntry(1, 256, 1)
_ = box.AddEntry(2, 192, 1)
_ = box.AddEntry(3, 128, 2)
boxDiffAfterEncodeAndDecode(t, &box)
}

0 comments on commit b65ab88

Please sign in to comment.