diff --git a/AUTHORS b/AUTHORS index dfe9a198e2..99c8ec452c 100644 --- a/AUTHORS +++ b/AUTHORS @@ -35,4 +35,5 @@ Richard Eklycke Sanil Raut Sergio Ammirata The Chromium Authors <*@chromium.org> +Prakash Duggaraju Dennis E. Mungai (Brainiarc7) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index de58caf56a..eeeeaa47fb 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -52,4 +52,5 @@ Thomas Inskip Tim Lansen Vincent Nguyen Weiguo Shao +Prakash Duggaraju Dennis E. Mungai (Brainiarc7) diff --git a/packager/media/formats/mp4/mp4_media_parser_unittest.cc b/packager/media/formats/mp4/mp4_media_parser_unittest.cc index 953b6c3c7a..715cf065d7 100644 --- a/packager/media/formats/mp4/mp4_media_parser_unittest.cc +++ b/packager/media/formats/mp4/mp4_media_parser_unittest.cc @@ -298,6 +298,13 @@ TEST_F(MP4MediaParserTest, CencWithDecryptionSourceAndSenc) { EXPECT_EQ(82u, num_samples_); } +TEST_F(MP4MediaParserTest, NonInterleavedFMP4) { + // Test small, non-interleaved fragment MP4 with one track per fragment. + EXPECT_TRUE(ParseMP4File("BigBuckBunny_10s.ismv", 512)); + EXPECT_EQ(2u, num_streams_); + EXPECT_EQ(770u, num_samples_); +} + } // namespace mp4 } // namespace media } // namespace shaka diff --git a/packager/media/formats/mp4/track_run_iterator.cc b/packager/media/formats/mp4/track_run_iterator.cc index 2fd836168b..94e27ab0da 100644 --- a/packager/media/formats/mp4/track_run_iterator.cc +++ b/packager/media/formats/mp4/track_run_iterator.cc @@ -284,10 +284,11 @@ bool TrackRunIterator::Init() { bool TrackRunIterator::Init(const MovieFragment& moof) { runs_.clear(); - next_fragment_start_dts_.resize(moof.tracks.size(), 0); + const auto track_count = std::max(moof.tracks.size(), moov_->tracks.size()); + next_fragment_start_dts_.resize(track_count, 0); for (size_t i = 0; i < moof.tracks.size(); i++) { const TrackFragment& traf = moof.tracks[i]; - + const auto track_index = traf.header.track_id - 1; const Track* trak = NULL; for (size_t t = 0; t < moov_->tracks.size(); t++) { if (moov_->tracks[t].header.track_id == traf.header.track_id) @@ -351,7 +352,7 @@ bool TrackRunIterator::Init(const MovieFragment& moof) { } int64_t run_start_dts = traf.decode_time_absent - ? next_fragment_start_dts_[i] + ? next_fragment_start_dts_[track_index] : traf.decode_time.decode_time; // dts is directly adjusted, which then propagates to pts as pts is encoded @@ -426,7 +427,7 @@ bool TrackRunIterator::Init(const MovieFragment& moof) { runs_.push_back(tri); sample_count_sum += trun.sample_count; } - next_fragment_start_dts_[i] = run_start_dts; + next_fragment_start_dts_[track_index] = run_start_dts; } std::sort(runs_.begin(), runs_.end(), CompareMinTrackRunDataOffset()); diff --git a/packager/media/test/data/BigBuckBunny_10s.ismv b/packager/media/test/data/BigBuckBunny_10s.ismv new file mode 100644 index 0000000000..a5ffe5a699 Binary files /dev/null and b/packager/media/test/data/BigBuckBunny_10s.ismv differ