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

Unified Diff: media/filters/frame_processor.cc

Issue 2035003002: MSE: Signal new coded frame group more aggressively (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « media/filters/frame_processor.h ('k') | media/filters/frame_processor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/frame_processor.cc
diff --git a/media/filters/frame_processor.cc b/media/filters/frame_processor.cc
index 8360722ba44db1507d7766e14bf1c7a187bffc11..aab81f961c13fc83b1e98cf61554bee713f33dac 100644
--- a/media/filters/frame_processor.cc
+++ b/media/filters/frame_processor.cc
@@ -185,6 +185,10 @@ void FrameProcessor::SetSequenceMode(bool sequence_mode) {
if (sequence_mode) {
DCHECK(kNoTimestamp() != group_end_timestamp_);
group_start_timestamp_ = group_end_timestamp_;
+ } else if (sequence_mode_) {
+ // We're switching from 'sequence' to 'segments' mode. Be safe and signal a
+ // new coded frame group on the next frame emitted.
+ coded_frame_group_last_dts_ = kNoDecodeTimestamp();
}
// Step 8: Update the attribute to new mode.
@@ -290,10 +294,10 @@ void FrameProcessor::Reset() {
itr->second->Reset();
}
- // Maintain current |in_coded_frame_group_| state for Reset() during
+ // Maintain current |coded_frame_group_last_dts_| state for Reset() during
// sequence mode. Reset it here only if in segments mode.
chcunningham 2016/06/03 22:16:15 Can you say why? I know I've asked before, but I'v
wolenetz 2016/06/03 22:43:42 Done.
if (!sequence_mode_) {
- in_coded_frame_group_ = false;
+ coded_frame_group_last_dts_ = kNoDecodeTimestamp();
return;
}
@@ -598,7 +602,7 @@ bool FrameProcessor::ProcessFrame(
decode_timestamp - track_last_decode_timestamp;
if (track_dts_delta < base::TimeDelta() ||
track_dts_delta > 2 * track_buffer->last_frame_duration()) {
- DCHECK(in_coded_frame_group_);
+ DCHECK(coded_frame_group_last_dts_ != kNoDecodeTimestamp());
// 7.1. If mode equals "segments": Set group end timestamp to
// presentation timestamp.
// If mode equals "sequence": Set group start timestamp equal to
@@ -607,13 +611,13 @@ bool FrameProcessor::ProcessFrame(
group_end_timestamp_ = presentation_timestamp;
// This triggers a discontinuity so we need to treat the next frames
// appended within the append window as if they were the beginning of
- // a new coded frame group.
- in_coded_frame_group_ = false;
+ // a new coded frame group. |coded_frame_group_last_dts_| is reset in
+ // Reset(), below, for "segments" mode.
} else {
DVLOG(3) << __FUNCTION__ << " : Sequence mode discontinuity, GETS: "
<< group_end_timestamp_.InSecondsF();
- DCHECK(kNoTimestamp() != group_end_timestamp_);
- group_start_timestamp_ = group_end_timestamp_;
+ // Reset(), below, performs the "Set group start timestamp equal to
+ // the group end timestamp" operation for "sequence" mode.
}
// 7.2. - 7.5.:
@@ -701,18 +705,24 @@ bool FrameProcessor::ProcessFrame(
// If it is the first in a new coded frame group (such as following a
// discontinuity), notify all the track buffers' streams that a coded frame
// group is starting.
- if (!in_coded_frame_group_) {
+ // If in 'sequence' appendMode, also check to make sure we don't need to
+ // signal the start of a new coded frame group in the case where
+ // timestampOffset adjustments by the app may cause this coded frame to be
+ // in the timeline prior to the last frame processed.
+ if (coded_frame_group_last_dts_ == kNoDecodeTimestamp() ||
+ (sequence_mode_ && coded_frame_group_last_dts_ > decode_timestamp)) {
// First, complete the append to track buffer streams of the previous
// coded frame group's frames, if any.
if (!FlushProcessedFrames())
return false;
- // TODO(acolwell/wolenetz): This should be changed to a presentation
- // timestamp. See http://crbug.com/402502
+ // TODO(wolenetz): This should be changed to a presentation timestamp. See
+ // http://crbug.com/402502
NotifyStartOfCodedFrameGroup(decode_timestamp);
- in_coded_frame_group_ = true;
}
+ coded_frame_group_last_dts_ = decode_timestamp;
+
DVLOG(3) << __FUNCTION__ << ": Sending processed frame to stream, "
<< "PTS=" << presentation_timestamp.InSecondsF()
<< ", DTS=" << decode_timestamp.InSecondsF();
« no previous file with comments | « media/filters/frame_processor.h ('k') | media/filters/frame_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698