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

Unified Diff: media/filters/source_buffer_stream.cc

Issue 220103002: Fix unit test failures with estimated durations and splice frames. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix removal of old buffers. Created 6 years, 8 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/pipeline_integration_test.cc ('k') | media/filters/source_buffer_stream_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/source_buffer_stream.cc
diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc
index 4b892d78b65b7f5e67d54db48f898431839b5333..09a314575242d05e85994f05d764c55f554d1ad1 100644
--- a/media/filters/source_buffer_stream.cc
+++ b/media/filters/source_buffer_stream.cc
@@ -490,7 +490,8 @@ bool SourceBufferStream::Append(const BufferQueue& buffers) {
last_appended_buffer_timestamp_ = buffers.back()->GetDecodeTimestamp();
last_appended_buffer_is_keyframe_ = buffers.back()->IsKeyframe();
} else {
- base::TimeDelta new_range_start_time = media_segment_start_time_;
+ base::TimeDelta new_range_start_time = std::min(
+ media_segment_start_time_, buffers.front()->GetDecodeTimestamp());
const BufferQueue* buffers_for_new_range = &buffers;
BufferQueue trimmed_buffers;
@@ -988,7 +989,14 @@ void SourceBufferStream::PrepareRangesForNextAppend(
// timestamp situation. This prevents the first buffer in the current append
// from deleting the last buffer in the previous append if both buffers
// have the same timestamp.
- bool is_exclusive = (prev_timestamp == next_timestamp) &&
+ //
+ // The delete range should never be exclusive if a splice frame was generated
+ // because we don't generate splice frames for same timestamp situations.
+ DCHECK(new_buffers.front()->splice_timestamp() !=
+ new_buffers.front()->timestamp());
+ const bool is_exclusive =
+ new_buffers.front()->get_splice_buffers().empty() &&
+ prev_timestamp == next_timestamp &&
AllowSameTimestamp(prev_is_keyframe, next_is_keyframe, GetType());
// Delete the buffers that |new_buffers| overlaps.
@@ -1677,8 +1685,12 @@ SourceBufferRange::SourceBufferRange(
void SourceBufferRange::AppendBuffersToEnd(const BufferQueue& new_buffers) {
DCHECK(buffers_.empty() || CanAppendBuffersToEnd(new_buffers));
+ DCHECK(media_segment_start_time_ == kNoTimestamp() ||
+ media_segment_start_time_ <=
+ new_buffers.front()->GetDecodeTimestamp());
for (BufferQueue::const_iterator itr = new_buffers.begin();
- itr != new_buffers.end(); ++itr) {
+ itr != new_buffers.end();
+ ++itr) {
DCHECK((*itr)->GetDecodeTimestamp() != kNoTimestamp());
buffers_.push_back(*itr);
size_in_bytes_ += (*itr)->data_size();
« no previous file with comments | « media/filters/pipeline_integration_test.cc ('k') | media/filters/source_buffer_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698