diff --git a/packager/app/test/testdata/encryption-and-output-media-info-and-mpd-from-media-info/output.mpd b/packager/app/test/testdata/encryption-and-output-media-info-and-mpd-from-media-info/output.mpd index 9f33624f0d..1e0a65977b 100644 --- a/packager/app/test/testdata/encryption-and-output-media-info-and-mpd-from-media-info/output.mpd +++ b/packager/app/test/testdata/encryption-and-output-media-info-and-mpd-from-media-info/output.mpd @@ -1,6 +1,6 @@ - + diff --git a/packager/mpd/base/period.cc b/packager/mpd/base/period.cc index 51e2d548d5..08952ac690 100644 --- a/packager/mpd/base/period.cc +++ b/packager/mpd/base/period.cc @@ -46,6 +46,11 @@ Period::Period(uint32_t period_id, AdaptationSet* Period::GetOrCreateAdaptationSet( const MediaInfo& media_info, bool content_protection_in_adaptation_set) { + // Set duration if it is not set. It may be updated later from duration + // calculated from segments. + if (duration_seconds_ == 0) + duration_seconds_ = media_info.media_duration_seconds(); + // AdaptationSets with the same key should only differ in ContentProtection, // which also means that if |content_protection_in_adaptation_set| is false, // there should be at most one entry in |adaptation_sets|. diff --git a/packager/mpd/test/data/audio_media_info1_expected_mpd_output.txt b/packager/mpd/test/data/audio_media_info1_expected_mpd_output.txt index b9b235f466..3a645f6505 100644 --- a/packager/mpd/test/data/audio_media_info1_expected_mpd_output.txt +++ b/packager/mpd/test/data/audio_media_info1_expected_mpd_output.txt @@ -1,5 +1,5 @@ - + diff --git a/packager/mpd/test/data/audio_media_info1_video_media_info1_expected_mpd_output.txt b/packager/mpd/test/data/audio_media_info1_video_media_info1_expected_mpd_output.txt index 88f9eebb34..0da72fba08 100644 --- a/packager/mpd/test/data/audio_media_info1_video_media_info1_expected_mpd_output.txt +++ b/packager/mpd/test/data/audio_media_info1_video_media_info1_expected_mpd_output.txt @@ -1,5 +1,5 @@ - + diff --git a/packager/mpd/test/data/video_media_info1_expected_mpd_output.txt b/packager/mpd/test/data/video_media_info1_expected_mpd_output.txt index 5e4775bc1a..8d66cd8ca8 100644 --- a/packager/mpd/test/data/video_media_info1_expected_mpd_output.txt +++ b/packager/mpd/test/data/video_media_info1_expected_mpd_output.txt @@ -1,5 +1,5 @@ - + diff --git a/packager/mpd/test/data/video_media_info1and2_expected_mpd_output.txt b/packager/mpd/test/data/video_media_info1and2_expected_mpd_output.txt index 5a4052b25c..927fe1cada 100644 --- a/packager/mpd/test/data/video_media_info1and2_expected_mpd_output.txt +++ b/packager/mpd/test/data/video_media_info1and2_expected_mpd_output.txt @@ -1,5 +1,5 @@ - +