diff options
author | Matt Wolenetz <wolenetz@chromium.org> | 2014-09-26 16:13:39 -0700 |
---|---|---|
committer | Matt Wolenetz <wolenetz@chromium.org> | 2014-09-26 23:14:25 +0000 |
commit | 61032832804d0dd076cf24fb23a5171004b38560 (patch) | |
tree | 7056b1c1b66726448fa87cd24fc71bdf4dabff32 | |
parent | 9490e34223080a730b89c7dd3392ada9292a1332 (diff) | |
download | chromium_src-61032832804d0dd076cf24fb23a5171004b38560.zip chromium_src-61032832804d0dd076cf24fb23a5171004b38560.tar.gz chromium_src-61032832804d0dd076cf24fb23a5171004b38560.tar.bz2 |
Merge to M38: MSE: Reduce spurious buffered range discontinuities
Includes last frame's duration in the determination of
SourceBufferStream's |max_interbuffer_distance_|, to prevent an
unusually long segment-ending frame from triggering discontinuity when
adjacent buffers are appended. A more correct fix requires
StreamParsers to always emit valid frame durations (crbug 351166), and
would use them exclusively to determine discontinuity.
BUG=351489
R=dalecurtis@chromium.org
TEST=No media_unittest, layout, or yt-dash-mse ToT conformance regression. Fixes b/17570928.
Review URL: https://codereview.chromium.org/597293004
Cr-Commit-Position: refs/heads/master@{#296599}
(cherry picked from commit 674907fe07fc1b26b19f41f63ad70bca78665a7b)
Review URL: https://codereview.chromium.org/608953003
Cr-Commit-Position: refs/branch-heads/2125@{#508}
Cr-Branched-From: b68026d94bda36dd106a3d91a098719f952a9477-refs/heads/master@{#290040}
-rw-r--r-- | media/filters/source_buffer_stream.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc index a0381d2..09b9f03 100644 --- a/media/filters/source_buffer_stream.cc +++ b/media/filters/source_buffer_stream.cc @@ -316,6 +316,11 @@ static bool CompareStreamParserBufferToTimeDelta( // Returns an estimate of how far from the beginning or end of a range a buffer // can be to still be considered in the range, given the |approximate_duration| // of a buffer in the stream. +// TODO(wolenetz): Once all stream parsers emit accurate frame durations, use +// logic like FrameProcessor (2*last_frame_duration + last_decode_timestamp) +// instead of an overall maximum interbuffer delta for range discontinuity +// detection, and adjust similarly for splice frame discontinuity detection. +// See http://crbug.com/351489 and http://crbug.com/351166. static base::TimeDelta ComputeFudgeRoom(base::TimeDelta approximate_duration) { // Because we do not know exactly when is the next timestamp, any buffer // that starts within 2x the approximate duration of a buffer is considered @@ -418,6 +423,8 @@ SourceBufferStream::~SourceBufferStream() { void SourceBufferStream::OnNewMediaSegment( DecodeTimestamp media_segment_start_time) { + DVLOG(1) << __FUNCTION__ << "(" << media_segment_start_time.InSecondsF() + << ")"; DCHECK(!end_of_stream_); media_segment_start_time_ = media_segment_start_time; new_media_segment_ = true; @@ -432,8 +439,11 @@ void SourceBufferStream::OnNewMediaSegment( media_segment_start_time)) { last_appended_buffer_timestamp_ = kNoDecodeTimestamp(); last_appended_buffer_is_keyframe_ = false; + DVLOG(3) << __FUNCTION__ << " next appended buffers will be in a new range"; } else if (last_range != ranges_.end()) { DCHECK(last_range == range_for_next_append_); + DVLOG(3) << __FUNCTION__ << " next appended buffers will continue range " + << "unless intervening remove makes discontinuity"; } } @@ -771,8 +781,15 @@ void SourceBufferStream::UpdateMaxInterbufferDistance( DecodeTimestamp current_timestamp = (*itr)->GetDecodeTimestamp(); DCHECK(current_timestamp != kNoDecodeTimestamp()); + base::TimeDelta interbuffer_distance = (*itr)->duration(); + DCHECK(interbuffer_distance >= base::TimeDelta()); + if (prev_timestamp != kNoDecodeTimestamp()) { - base::TimeDelta interbuffer_distance = current_timestamp - prev_timestamp; + interbuffer_distance = + std::max(current_timestamp - prev_timestamp, interbuffer_distance); + } + + if (interbuffer_distance > base::TimeDelta()) { if (max_interbuffer_distance_ == kNoTimestamp()) { max_interbuffer_distance_ = interbuffer_distance; } else { |