Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(740)

Unified Diff: media/formats/mp4/track_run_iterator.cc

Issue 540503003: Fix TrackRunIterator to generate a parse error when it encounters a reserved dependency value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | media/formats/mp4/track_run_iterator_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/formats/mp4/track_run_iterator.cc
diff --git a/media/formats/mp4/track_run_iterator.cc b/media/formats/mp4/track_run_iterator.cc
index 52959f1c738556c9033e2894d07580a1c4281f8b..604074ca727b2b3a4fca1d0d39eab7ade4b3b87c 100644
--- a/media/formats/mp4/track_run_iterator.cc
+++ b/media/formats/mp4/track_run_iterator.cc
@@ -88,13 +88,14 @@ TrackRunIterator::TrackRunIterator(const Movie* moov,
TrackRunIterator::~TrackRunIterator() {}
-static void PopulateSampleInfo(const TrackExtends& trex,
+static bool PopulateSampleInfo(const TrackExtends& trex,
const TrackFragmentHeader& tfhd,
const TrackFragmentRun& trun,
const int64 edit_list_offset,
const uint32 i,
SampleInfo* sample_info,
- const SampleDependsOn sdtp_sample_depends_on) {
+ const SampleDependsOn sdtp_sample_depends_on,
+ const LogCB& log_cb) {
if (i < trun.sample_sizes.size()) {
sample_info->size = trun.sample_sizes[i];
} else if (tfhd.default_sample_size > 0) {
@@ -156,8 +157,10 @@ static void PopulateSampleInfo(const TrackExtends& trex,
break;
case kSampleDependsOnReserved:
- CHECK(false);
+ MEDIA_LOG(log_cb) << "Reserved value used in sample dependency info.";
+ return false;
}
+ return true;
}
// In well-structured encrypted media, each track run will be immediately
@@ -300,8 +303,13 @@ bool TrackRunIterator::Init(const MovieFragment& moof) {
tri.samples.resize(trun.sample_count);
for (size_t k = 0; k < trun.sample_count; k++) {
- PopulateSampleInfo(*trex, traf.header, trun, edit_list_offset,
- k, &tri.samples[k], traf.sdtp.sample_depends_on(k));
+ if (!PopulateSampleInfo(*trex, traf.header, trun, edit_list_offset,
+ k, &tri.samples[k],
+ traf.sdtp.sample_depends_on(k),
+ log_cb_)) {
+ return false;
+ }
+
run_start_dts += tri.samples[k].duration;
if (!is_sample_to_group_valid) {
« no previous file with comments | « no previous file | media/formats/mp4/track_run_iterator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698