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

Unified Diff: media/filters/legacy_frame_processor.cc

Issue 205703003: MSE: Use frame duration, if available, in LegacyFrameProcessor (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to pull in WebM frame duration estimation, undid the CD tests' conversion to just BlockGrou… Created 6 years, 9 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/filters/legacy_frame_processor.cc
diff --git a/media/filters/legacy_frame_processor.cc b/media/filters/legacy_frame_processor.cc
index f7b0547f586e85d69ec6cc96461eba4c1459e83f..de1deb7dfe0b983a6fff269891ef69c1075e5e68 100644
--- a/media/filters/legacy_frame_processor.cc
+++ b/media/filters/legacy_frame_processor.cc
@@ -164,10 +164,17 @@ void LegacyFrameProcessor::FilterWithAppendWindow(
// because we can only resume decoding at keyframes.
base::TimeDelta presentation_timestamp = (*itr)->timestamp();
- // TODO(acolwell): Change |frame_end_timestamp| value to
+ // TODO(acolwell): Change |frame_end_timestamp| value to always be
// |presentation_timestamp + (*itr)->duration()|, like the spec
// requires, once frame durations are actually present in all buffers.
+ // See http://crbug.com/351166.
base::TimeDelta frame_end_timestamp = presentation_timestamp;
+ base::TimeDelta frame_duration = (*itr)->duration();
+ if (frame_duration > base::TimeDelta()) {
+ DCHECK(frame_duration != kNoTimestamp());
+ frame_end_timestamp += frame_duration;
+ }
+
if (presentation_timestamp < append_window_start ||
frame_end_timestamp > append_window_end) {
DVLOG(1) << "Dropping buffer outside append window."
@@ -206,7 +213,11 @@ bool LegacyFrameProcessor::AppendAndUpdateDuration(
if (!stream || !stream->Append(buffers))
return false;
- increase_duration_cb_.Run(buffers.back()->timestamp(), stream);
+ // Approximate spec's "highest presentation end timestamp".
+ base::TimeDelta highest_end_timestamp = stream->GetBufferedDuration();
+ DCHECK(highest_end_timestamp > base::TimeDelta());
+
+ increase_duration_cb_.Run(highest_end_timestamp);
return true;
}

Powered by Google App Engine
This is Rietveld 408576698