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

Unified Diff: media/filters/frame_processor.cc

Issue 276573002: Add gapless playback support for AAC playback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Comments. Created 6 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
Index: media/filters/frame_processor.cc
diff --git a/media/filters/frame_processor.cc b/media/filters/frame_processor.cc
index 7f83a226b75cb9ad3165a81c115c72d1371e3510..e867df7c985ea76f7825b2d01eb069e394d610f2 100644
--- a/media/filters/frame_processor.cc
+++ b/media/filters/frame_processor.cc
@@ -75,11 +75,12 @@ bool FrameProcessor::ProcessFrames(
return true;
}
-bool FrameProcessor::ProcessFrame(scoped_refptr<StreamParserBuffer> frame,
- base::TimeDelta append_window_start,
- base::TimeDelta append_window_end,
- base::TimeDelta* timestamp_offset,
- bool* new_media_segment) {
+bool FrameProcessor::ProcessFrame(
+ const scoped_refptr<StreamParserBuffer>& frame,
+ base::TimeDelta append_window_start,
+ base::TimeDelta append_window_end,
+ base::TimeDelta* timestamp_offset,
+ bool* new_media_segment) {
// Implements the loop within step 1 of the coded frame processing algorithm
// for a single input frame per April 1, 2014 MSE spec editor's draft:
// https://dvcs.w3.org/hg/html-media/raw-file/d471a4412040/media-source/
@@ -263,45 +264,29 @@ bool FrameProcessor::ProcessFrame(scoped_refptr<StreamParserBuffer> frame,
// 11. If frame end timestamp is greater than appendWindowEnd, then set the
// need random access point flag to true, drop the coded frame, and jump
// to the top of the loop to start processing the next coded frame.
- if (presentation_timestamp < append_window_start ||
- frame_end_timestamp > append_window_end) {
- // See if a partial discard can be done around |append_window_start|.
- // TODO(wolenetz): Refactor this into a base helper across legacy and
- // new frame processors?
- if (track_buffer->stream()->supports_partial_append_window_trimming() &&
- presentation_timestamp < append_window_start &&
- frame_end_timestamp > append_window_start &&
- frame_end_timestamp <= append_window_end) {
- DCHECK(frame->IsKeyframe());
- DVLOG(1) << "Truncating buffer which overlaps append window start."
- << " presentation_timestamp "
- << presentation_timestamp.InSecondsF()
- << " append_window_start " << append_window_start.InSecondsF();
-
- // Adjust the timestamp of this frame forward to |append_window_start|,
- // while decreasing the duration appropriately.
- frame->set_discard_padding(std::make_pair(
- append_window_start - presentation_timestamp, base::TimeDelta()));
- presentation_timestamp = append_window_start; // |frame| updated below.
- decode_timestamp = append_window_start; // |frame| updated below.
- frame_duration = frame_end_timestamp - presentation_timestamp;
- frame->set_duration(frame_duration);
-
- // TODO(dalecurtis): This could also be done with |append_window_end|,
- // but is not necessary since splice frames covert the overlap there.
- } else {
- track_buffer->set_needs_random_access_point(true);
- DVLOG(3) << "Dropping frame that is outside append window.";
-
- if (!sequence_mode_) {
- // This also 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 segment.
- *new_media_segment = true;
- }
-
- return true;
+ if (track_buffer->stream()->supports_partial_append_window_trimming() &&
+ HandlePartialAppendWindowTrimming(append_window_start,
+ append_window_end,
+ presentation_timestamp,
+ frame_end_timestamp,
+ frame)) {
+ // |frame| has been partially trimmed or had preroll added.
wolenetz 2014/05/23 19:59:45 ditto of LegacyFrameProcessor comment: do the foll
DaleCurtis 2014/05/23 21:46:26 Blew out the else from below. Should be fine now?
+ decode_timestamp = frame->GetDecodeTimestamp();
+ presentation_timestamp = frame->timestamp();
+ frame_duration = frame->duration();
acolwell GONE FROM CHROMIUM 2014/05/23 17:27:30 Since presentation_timestamp & frame_duration are
DaleCurtis 2014/05/23 21:46:26 No, since the timestamp is moved forward by a valu
acolwell GONE FROM CHROMIUM 2014/05/24 00:58:20 ok. A comment or DCHECK here would be nice so that
DaleCurtis 2014/05/27 23:59:32 Done.
+ } else if (presentation_timestamp < append_window_start ||
acolwell GONE FROM CHROMIUM 2014/05/23 17:27:30 I wonder if we should drop the else here. ISTM tha
wolenetz 2014/05/23 19:59:45 Good point: I think that would address my *new_med
DaleCurtis 2014/05/23 21:46:26 Seems reasonable. Done.
+ frame_end_timestamp > append_window_end) {
+ track_buffer->set_needs_random_access_point(true);
+ DVLOG(3) << "Dropping frame that is outside append window.";
+
+ if (!sequence_mode_) {
+ // This also 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 segment.
+ *new_media_segment = true;
}
+
+ return true;
}
// 12. If the need random access point flag on track buffer equals true,

Powered by Google App Engine
This is Rietveld 408576698