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

Unified Diff: media/filters/source_buffer_stream.cc

Issue 10836304: Add support for config changes during playback to FFmpegVideoDecoder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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
Index: media/filters/source_buffer_stream.cc
diff --git a/media/filters/source_buffer_stream.cc b/media/filters/source_buffer_stream.cc
index c76842391532f3b235dc3c98322035dd14ed5e05..959d3b83697ef8d311f0e7bbd9911f18dbd44692 100644
--- a/media/filters/source_buffer_stream.cc
+++ b/media/filters/source_buffer_stream.cc
@@ -282,6 +282,7 @@ SourceBufferStream::SourceBufferStream(const AudioDecoderConfig& audio_config)
last_buffer_timestamp_(kNoTimestamp()),
max_interbuffer_distance_(kNoTimestamp()),
memory_limit_(kDefaultAudioMemoryLimit) {
+ DCHECK(audio_config.IsValidConfig());
audio_configs_[0] = new AudioDecoderConfig();
Ami GONE FROM CHROMIUM 2012/08/17 15:16:59 FWIW, you could audio_configs_.push_back(new Audio
acolwell GONE FROM CHROMIUM 2012/08/20 23:10:12 Done.
audio_configs_[0]->CopyFrom(audio_config);
}
@@ -301,6 +302,7 @@ SourceBufferStream::SourceBufferStream(const VideoDecoderConfig& video_config)
last_buffer_timestamp_(kNoTimestamp()),
max_interbuffer_distance_(kNoTimestamp()),
memory_limit_(kDefaultVideoMemoryLimit) {
+ DCHECK(video_config.IsValidConfig());
video_configs_[0] = new VideoDecoderConfig();
video_configs_[0]->CopyFrom(video_config);
}
@@ -736,6 +738,7 @@ void SourceBufferStream::Seek(base::TimeDelta timestamp) {
DCHECK(timestamp >= stream_start_time_);
SetSelectedRange(NULL);
track_buffer_.clear();
+ config_change_pending_ = false;
if (ShouldSeekToStartOfBuffered(timestamp)) {
SetSelectedRange(ranges_.front());
@@ -768,8 +771,10 @@ bool SourceBufferStream::IsSeekPending() const {
SourceBufferStream::Status SourceBufferStream::GetNextBuffer(
scoped_refptr<StreamParserBuffer>* out_buffer) {
if (!track_buffer_.empty()) {
- if (track_buffer_.front()->GetConfigId() != current_config_index_)
+ if (track_buffer_.front()->GetConfigId() != current_config_index_) {
+ config_change_pending_ = true;
return kConfigChange;
+ }
*out_buffer = track_buffer_.front();
track_buffer_.pop_front();
@@ -779,8 +784,10 @@ SourceBufferStream::Status SourceBufferStream::GetNextBuffer(
if (!selected_range_ || !selected_range_->HasNextBuffer())
return kNeedBuffer;
- if (selected_range_->GetNextConfigId() != current_config_index_)
+ if (selected_range_->GetNextConfigId() != current_config_index_) {
+ config_change_pending_ = true;
return kConfigChange;
+ }
CHECK(selected_range_->GetNextBuffer(out_buffer));
return kSuccess;
@@ -852,12 +859,14 @@ bool SourceBufferStream::IsEndSelected() const {
}
const AudioDecoderConfig& SourceBufferStream::GetCurrentAudioDecoderConfig() {
- CompleteConfigChange();
+ if (config_change_pending_)
+ CompleteConfigChange();
return *audio_configs_[current_config_index_];
}
const VideoDecoderConfig& SourceBufferStream::GetCurrentVideoDecoderConfig() {
- CompleteConfigChange();
+ if (config_change_pending_)
+ CompleteConfigChange();
return *video_configs_[current_config_index_];
}
@@ -935,6 +944,7 @@ bool SourceBufferStream::UpdateVideoConfig(const VideoDecoderConfig& config) {
void SourceBufferStream::CompleteConfigChange() {
if (!track_buffer_.empty()) {
current_config_index_ = track_buffer_.front()->GetConfigId();
+ config_change_pending_ = false;
return;
}
@@ -942,6 +952,7 @@ void SourceBufferStream::CompleteConfigChange() {
return;
current_config_index_ = selected_range_->GetNextConfigId();
+ config_change_pending_ = false;
}
SourceBufferRange::SourceBufferRange(

Powered by Google App Engine
This is Rietveld 408576698