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

Unified Diff: media/mp4/track_run_iterator.cc

Issue 10832176: Add initial support for edit lists in MSE BMFF. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Counting? Who needs counting? Created 8 years, 4 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
Index: media/mp4/track_run_iterator.cc
diff --git a/media/mp4/track_run_iterator.cc b/media/mp4/track_run_iterator.cc
index 59bc22967e48fc0f802481b046b49c7279661a6b..79bd5745203e6a41d342408b5c6f290b3d98b221 100644
--- a/media/mp4/track_run_iterator.cc
+++ b/media/mp4/track_run_iterator.cc
@@ -71,6 +71,7 @@ TrackRunIterator::~TrackRunIterator() {}
static void PopulateSampleInfo(const TrackExtends& trex,
const TrackFragmentHeader& tfhd,
const TrackFragmentRun& trun,
+ const int64 edit_list_offset,
const uint32 i,
SampleInfo* sample_info) {
if (i < trun.sample_sizes.size()) {
@@ -94,6 +95,7 @@ static void PopulateSampleInfo(const TrackExtends& trex,
} else {
sample_info->cts_offset = 0;
}
+ sample_info->cts_offset += edit_list_offset;
uint32 flags;
if (i < trun.sample_flags.size()) {
@@ -164,6 +166,15 @@ bool TrackRunIterator::Init(const MovieFragment& moof) {
RCHECK(desc_idx > 0); // Descriptions are one-indexed in the file
desc_idx -= 1;
+ // Process edit list to remove CTS offset introduced in the presence of
+ // B-frames. Other uses of edit lists are not supported, as they are
+ // both uncommon and better served by higher-level protocols.
acolwell GONE FROM CHROMIUM 2012/08/07 20:12:13 nit: It looks like there should be a if (stuff w
strobe_ 2012/08/07 22:54:39 Done.
+ int64 edit_list_offset = 0;
+ const std::vector<EditListEntry>& edits = trak->edit.list.edits;
+ if (!edits.empty() && edits[0].media_time > 0) {
+ edit_list_offset = -edits[0].media_time;
+ }
+
int64 run_start_dts = traf.decode_time.decode_time;
int sample_count_sum = 0;
@@ -226,7 +237,8 @@ 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, k, &tri.samples[k]);
+ PopulateSampleInfo(*trex, traf.header, trun, edit_list_offset,
+ k, &tri.samples[k]);
run_start_dts += tri.samples[k].duration;
}
runs_.push_back(tri);

Powered by Google App Engine
This is Rietveld 408576698