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

Unified Diff: media/filters/source_buffer_stream.cc

Issue 251903008: Fix incorrect config id being associated with post splice buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ChunkDemuxer test. 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/source_buffer_stream.h ('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 5626ff898f3e688fb3323eaa4e049f3c370c6450..6207c99810a58cc09998a68db7704318a9475d79 100644
--- a/media/filters/source_buffer_stream.cc
+++ b/media/filters/source_buffer_stream.cc
@@ -359,6 +359,7 @@ SourceBufferStream::SourceBufferStream(const AudioDecoderConfig& audio_config,
memory_limit_(kDefaultAudioMemoryLimit),
config_change_pending_(false),
splice_buffers_index_(0),
+ pre_splice_complete_(false),
splice_frames_enabled_(splice_frames_enabled) {
DCHECK(audio_config.IsValidConfig());
audio_configs_.push_back(audio_config);
@@ -384,6 +385,7 @@ SourceBufferStream::SourceBufferStream(const VideoDecoderConfig& video_config,
memory_limit_(kDefaultVideoMemoryLimit),
config_change_pending_(false),
splice_buffers_index_(0),
+ pre_splice_complete_(false),
splice_frames_enabled_(splice_frames_enabled) {
DCHECK(video_config.IsValidConfig());
video_configs_.push_back(video_config);
@@ -410,6 +412,7 @@ SourceBufferStream::SourceBufferStream(const TextTrackConfig& text_config,
memory_limit_(kDefaultAudioMemoryLimit),
config_change_pending_(false),
splice_buffers_index_(0),
+ pre_splice_complete_(false),
splice_frames_enabled_(splice_frames_enabled) {}
SourceBufferStream::~SourceBufferStream() {
@@ -691,6 +694,7 @@ void SourceBufferStream::ResetSeekState() {
last_output_buffer_timestamp_ = kNoTimestamp();
splice_buffers_index_ = 0;
splice_buffer_ = NULL;
+ pre_splice_complete_ = false;
}
bool SourceBufferStream::ShouldSeekToStartOfBuffered(
@@ -1170,8 +1174,9 @@ SourceBufferStream::Status SourceBufferStream::GetNextBuffer(
}
// Did we hand out the last pre-splice buffer on the previous call?
- if (splice_buffers_index_ == last_splice_buffer_index) {
- splice_buffers_index_++;
+ if (!pre_splice_complete_) {
+ DCHECK_EQ(splice_buffers_index_, last_splice_buffer_index);
+ pre_splice_complete_ = true;
config_change_pending_ = true;
DVLOG(1) << "Config change (forced for fade in of splice frame).";
return SourceBufferStream::kConfigChange;
@@ -1181,11 +1186,13 @@ SourceBufferStream::Status SourceBufferStream::GetNextBuffer(
// so hand out the final buffer for fade in. Because a config change is
// always issued prior to handing out this buffer, any changes in config id
// have been inherently handled.
- DCHECK_GE(splice_buffers_index_, splice_buffers.size());
+ DCHECK(pre_splice_complete_);
+ DCHECK_EQ(splice_buffers_index_, splice_buffers.size() - 1);
DCHECK(splice_buffers.back()->splice_timestamp() == kNoTimestamp());
*out_buffer = splice_buffers.back();
splice_buffer_ = NULL;
splice_buffers_index_ = 0;
+ pre_splice_complete_ = false;
return SourceBufferStream::kSuccess;
}
« no previous file with comments | « media/filters/source_buffer_stream.h ('k') | media/filters/source_buffer_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698