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

Unified Diff: media/filters/frame_processor.cc

Issue 1637213002: Revert of MSE: Relax the 'media segment must begin with keyframe' requirement (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 28503155763f13a08e024718c295efe3fd399f2d..6f7706df7621abbb1c232865b4ef821cd7047274 100644
--- a/media/filters/frame_processor.cc
+++ b/media/filters/frame_processor.cc
@@ -197,6 +197,7 @@
const StreamParser::TextBufferQueueMap& text_map,
base::TimeDelta append_window_start,
base::TimeDelta append_window_end,
+ bool* new_media_segment,
base::TimeDelta* timestamp_offset) {
StreamParser::BufferQueue frames;
if (!MergeBufferQueues(audio_buffers, video_buffers, text_map, &frames)) {
@@ -216,7 +217,7 @@
for (StreamParser::BufferQueue::const_iterator frames_itr = frames.begin();
frames_itr != frames.end(); ++frames_itr) {
if (!ProcessFrame(*frames_itr, append_window_start, append_window_end,
- timestamp_offset)) {
+ timestamp_offset, new_media_segment)) {
FlushProcessedFrames();
return false;
}
@@ -290,16 +291,10 @@
itr->second->Reset();
}
- // Maintain current |in_coded_frame_group_| state for Reset() during
- // sequence mode. Reset it here only if in segments mode.
- if (!sequence_mode_) {
- in_coded_frame_group_ = false;
- return;
- }
-
- // Sequence mode
- DCHECK(kNoTimestamp() != group_end_timestamp_);
- group_start_timestamp_ = group_end_timestamp_;
+ if (sequence_mode_) {
+ DCHECK(kNoTimestamp() != group_end_timestamp_);
+ group_start_timestamp_ = group_end_timestamp_;
+ }
}
void FrameProcessor::OnPossibleAudioConfigUpdate(
@@ -325,14 +320,14 @@
return itr->second;
}
-void FrameProcessor::NotifyStartOfCodedFrameGroup(
- DecodeTimestamp start_timestamp) {
- DVLOG(2) << __FUNCTION__ << "(" << start_timestamp.InSecondsF() << ")";
+void FrameProcessor::NotifyNewMediaSegmentStarting(
+ DecodeTimestamp segment_timestamp) {
+ DVLOG(2) << __FUNCTION__ << "(" << segment_timestamp.InSecondsF() << ")";
for (TrackBufferMap::iterator itr = track_buffers_.begin();
itr != track_buffers_.end();
++itr) {
- itr->second->stream()->OnStartOfCodedFrameGroup(start_timestamp);
+ itr->second->stream()->OnNewMediaSegment(segment_timestamp);
}
}
@@ -453,7 +448,8 @@
const scoped_refptr<StreamParserBuffer>& frame,
base::TimeDelta append_window_start,
base::TimeDelta append_window_end,
- base::TimeDelta* timestamp_offset) {
+ 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/
@@ -591,14 +587,12 @@
// If last decode timestamp for track buffer is set and the difference
// between decode timestamp and last decode timestamp is greater than 2
// times last frame duration:
- DecodeTimestamp track_last_decode_timestamp =
+ DecodeTimestamp last_decode_timestamp =
track_buffer->last_decode_timestamp();
- if (track_last_decode_timestamp != kNoDecodeTimestamp()) {
- base::TimeDelta track_dts_delta =
- 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_);
+ if (last_decode_timestamp != kNoDecodeTimestamp()) {
+ base::TimeDelta dts_delta = decode_timestamp - last_decode_timestamp;
+ if (dts_delta < base::TimeDelta() ||
+ dts_delta > 2 * track_buffer->last_frame_duration()) {
// 7.1. If mode equals "segments": Set group end timestamp to
// presentation timestamp.
// If mode equals "sequence": Set group start timestamp equal to
@@ -607,8 +601,8 @@
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 segment.
+ *new_media_segment = true;
} else {
DVLOG(3) << __FUNCTION__ << " : Sequence mode discontinuity, GETS: "
<< group_end_timestamp_.InSecondsF();
@@ -698,19 +692,19 @@
}
// We now have a processed buffer to append to the track buffer's stream.
- // 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_) {
- // First, complete the append to track buffer streams of the previous
- // coded frame group's frames, if any.
+ // If it is the first in a new media segment or following a discontinuity,
+ // notify all the track buffers' streams that a new segment is beginning.
+ if (*new_media_segment) {
+ // First, complete the append to track buffer streams of previous media
+ // segment's frames, if any.
if (!FlushProcessedFrames())
return false;
+ *new_media_segment = false;
+
// TODO(acolwell/wolenetz): This should be changed to a presentation
// timestamp. See http://crbug.com/402502
- NotifyStartOfCodedFrameGroup(decode_timestamp);
- in_coded_frame_group_ = true;
+ NotifyNewMediaSegmentStarting(decode_timestamp);
}
DVLOG(3) << __FUNCTION__ << ": Sending processed frame to stream, "
@@ -719,7 +713,9 @@
// Steps 13-18: Note, we optimize by appending groups of contiguous
// processed frames for each track buffer at end of ProcessFrames() or prior
- // to NotifyStartOfCodedFrameGroup().
+ // to NotifyNewMediaSegmentStarting().
+ // TODO(wolenetz): Refactor SourceBufferStream to conform to spec GC timing.
+ // See http://crbug.com/371197.
track_buffer->EnqueueProcessedFrame(frame);
// 19. Set last decode timestamp for track buffer to decode timestamp.
« 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