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

Unified Diff: media/filters/source_buffer.cc

Issue 10389125: Refactor StreamParser creation & enforce configs matching expected stream types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 7 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/source_buffer.cc
diff --git a/media/filters/source_buffer.cc b/media/filters/source_buffer.cc
index 4d2fd4fcfac8f37c9088521d2892acb89ba178fe..90f0434ad21a42f56c7699fac8cb1c02ae0b656d 100644
--- a/media/filters/source_buffer.cc
+++ b/media/filters/source_buffer.cc
@@ -14,12 +14,14 @@ SourceBuffer::SourceBuffer() {}
SourceBuffer::~SourceBuffer() {}
-void SourceBuffer::Init(const InitCB& init_cb,
+void SourceBuffer::Init(scoped_ptr<StreamParser> parser,
+ const InitCB& init_cb,
const NewConfigCB& config_cb,
const NewBuffersCB& audio_cb,
const NewBuffersCB& video_cb,
const KeyNeededCB& key_needed_cb) {
DCHECK(init_cb_.is_null());
+ DCHECK(parser.get());
DCHECK(!init_cb.is_null());
DCHECK(!config_cb.is_null());
DCHECK(!audio_cb.is_null() || !video_cb.is_null());
@@ -31,7 +33,7 @@ void SourceBuffer::Init(const InitCB& init_cb,
video_cb_ = video_cb;
key_needed_cb_ = key_needed_cb;
- stream_parser_.reset(new WebMStreamParser());
+ stream_parser_.reset(parser.release());
stream_parser_->Init(
base::Bind(&SourceBuffer::OnStreamParserInitDone, base::Unretained(this)),
@@ -59,6 +61,13 @@ bool SourceBuffer::OnNewConfigs(const AudioDecoderConfig& audio_config,
const VideoDecoderConfig& video_config) {
CHECK(audio_config.IsValidConfig() || video_config.IsValidConfig());
+ // Signal an error if we get configuration info for stream types
+ // we don't have a callback to handle.
+ if ((audio_config.IsValidConfig() && audio_cb_.is_null()) ||
+ (video_config.IsValidConfig() && video_cb_.is_null())) {
+ return false;
+ }
+
return config_cb_.Run(audio_config, video_config);
}
« no previous file with comments | « media/filters/source_buffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698