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(); |