Skip to content

Commit

Permalink
Merge pull request #199 from Dash-Industry-Forum/hevc-and-ac3
Browse files Browse the repository at this point in the history
HEVC and AC-3 test asset and bug fix
  • Loading branch information
tobbee authored Jun 14, 2024
2 parents 7452fb8 + 9443fb6 commit b67f629
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Added

- Short HEVC + AC-3 test content

### Fixed

- Will now set contentType from mimeType on AdaptationSet or Representation level.
- If contentType and mimedType is not present, contentType will be set from codecs string.
- Issue with audio resegmentation.

## [1.4.1] - 2024-05-28

Expand Down
5 changes: 4 additions & 1 deletion cmd/livesim2/app/audiosegmentation.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,14 @@ func createAudioSeg(vodFS fs.FS, a *asset, cfg *ResponseConfig, rec audioRecipe)
itvl := sampleItvl{i, startSampleIdx, 0, 0}
sampleItvls = append(sampleItvls, itvl)
}
if rec.audioInEnd > s.EndTime {
if rec.audioInEnd >= s.EndTime {
endSampleIdx = uint32((s.EndTime - s.StartTime) / sampleDur)
sampleItvls[len(sampleItvls)-1].endIdx = endSampleIdx
timeCollected += sampleItvls[len(sampleItvls)-1].dur(sampleDur)
nextAudioStart = s.EndTime
if nextAudioStart == rec.audioInEnd {
break
}
if i < lastIdx {
sampleItvls = append(sampleItvls, sampleItvl{i + 1, 0, 0, 0})
continue
Expand Down
23 changes: 23 additions & 0 deletions cmd/livesim2/app/livesegment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,29 @@ func TestLiveSegment(t *testing.T) {
}
}

// TestAc3Timing checks that the generated segments end within one frame from nominal segment duration.
func TestAc3Timing(t *testing.T) {
vodFS := os.DirFS("testdata/assets")
am := newAssetMgr(vodFS, "", false)
err := am.discoverAssets()
require.NoError(t, err)

asset, ok := am.findAsset("bbb_hevc_ac3_8s")
require.True(t, ok)
cfg := NewResponseConfig()
nowMS := 20_000
for sNr := 0; sNr <= 5; sNr++ {
media := "audio_$NrOrTime$.m4s"
media = strings.Replace(media, "$NrOrTime$", fmt.Sprintf("%d", sNr), -1)
so, err := genLiveSegment(vodFS, asset, cfg, media, nowMS)
require.NoError(t, err)
bmdt := int(so.seg.Fragments[0].Moof.Traf.Tfdt.BaseMediaDecodeTime())
overShoot := bmdt - (2 * sNr * 48000)
require.Less(t, overShoot, 1536)
require.GreaterOrEqual(t, overShoot, 0)
}
}

func TestCheckAudioSegmentTimeAddressing(t *testing.T) {
vodFS := os.DirFS("testdata/assets")
am := newAssetMgr(vodFS, "", false)
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
19 changes: 19 additions & 0 deletions cmd/livesim2/app/testdata/assets/bbb_hevc_ac3_8s/manifest.mpd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011" minBufferTime="PT1.500S" type="static" mediaPresentationDuration="PT0H0M8.000S" maxSegmentDuration="PT0H0M2.016S" profiles="urn:mpeg:dash:profile:isoff-live:2011">
<ProgramInformation>
<Title>BigBuckBunny 8s generated with ffmpeg and MP4Box</Title>
</ProgramInformation>
<Period duration="PT0H0M8.000S">
<AdaptationSet segmentAlignment="true" contentType="video" maxWidth="640" maxHeight="360" maxFrameRate="24" par="16:9" lang="und" startWithSAP="1">
<SegmentTemplate media="video_$Number$.m4s" initialization="video_init.mp4" timescale="12288" startNumber="1" duration="24576"/>
<Representation id="1" mimeType="video/mp4" codecs="hev1.1.6.L63.90" width="640" height="360" frameRate="24" sar="1:1" bandwidth="741142">
</Representation>
</AdaptationSet>
<AdaptationSet segmentAlignment="true" contentType="audio" lang="und" startWithSAP="1">
<SegmentTemplate media="audio_$Number$.m4s" initialization="audio_init.mp4" timescale="48000" startNumber="1" duration="96000"/>
<Representation id="2" mimeType="audio/mp4" codecs="ac-3" audioSamplingRate="48000" bandwidth="96000">
<AudioChannelConfiguration schemeIdUri="urn:mpeg:dash:23003:3:audio_channel_configuration:2011" value="2"/>
</Representation>
</AdaptationSet>
</Period>
</MPD>
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit b67f629

Please sign in to comment.