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

Unified Diff: media/base/pipeline_impl.cc

Issue 2667283002: Refactor MediaResource to be multi-stream capable (Closed)
Patch Set: Created 3 years, 11 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/base/mock_filters.h ('k') | media/base/pipeline_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/pipeline_impl.cc
diff --git a/media/base/pipeline_impl.cc b/media/base/pipeline_impl.cc
index 0ec81f9e7ca815c345531ba3f35ce1779b93d393..3270fb26c60980a0e325807c425d4ebdd624be4f 100644
--- a/media/base/pipeline_impl.cc
+++ b/media/base/pipeline_impl.cc
@@ -860,8 +860,7 @@ void PipelineImpl::RendererWrapper::InitializeRenderer(
switch (demuxer_->GetType()) {
case MediaResource::Type::STREAM:
- if (!demuxer_->GetStream(DemuxerStream::AUDIO) &&
- !demuxer_->GetStream(DemuxerStream::VIDEO)) {
+ if (demuxer_->GetStreams().empty()) {
DVLOG(1) << "Error: demuxer does not have an audio or a video stream.";
done_cb.Run(PIPELINE_ERROR_COULD_NOT_RENDER);
return;
@@ -901,24 +900,26 @@ void PipelineImpl::RendererWrapper::ReportMetadata() {
DCHECK(media_task_runner_->BelongsToCurrentThread());
PipelineMetadata metadata;
- DemuxerStream* stream;
+ std::vector<DemuxerStream*> streams;
switch (demuxer_->GetType()) {
case MediaResource::Type::STREAM:
metadata.timeline_offset = demuxer_->GetTimelineOffset();
- stream = demuxer_->GetStream(DemuxerStream::VIDEO);
- if (stream) {
- metadata.has_video = true;
- metadata.natural_size =
- GetRotatedVideoSize(stream->video_rotation(),
- stream->video_decoder_config().natural_size());
- metadata.video_rotation = stream->video_rotation();
- metadata.video_decoder_config = stream->video_decoder_config();
- }
- stream = demuxer_->GetStream(DemuxerStream::AUDIO);
- if (stream) {
- metadata.has_audio = true;
- metadata.audio_decoder_config = stream->audio_decoder_config();
+ // TODO(servolk): What should we do about metadata for multiple streams?
+ streams = demuxer_->GetStreams();
+ for (const auto& stream : streams) {
+ if (stream->type() == DemuxerStream::VIDEO && !metadata.has_video) {
+ metadata.has_video = true;
+ metadata.natural_size = GetRotatedVideoSize(
+ stream->video_rotation(),
+ stream->video_decoder_config().natural_size());
+ metadata.video_rotation = stream->video_rotation();
+ metadata.video_decoder_config = stream->video_decoder_config();
+ }
+ if (stream->type() == DemuxerStream::AUDIO && !metadata.has_audio) {
+ metadata.has_audio = true;
+ metadata.audio_decoder_config = stream->audio_decoder_config();
+ }
}
break;
« no previous file with comments | « media/base/mock_filters.h ('k') | media/base/pipeline_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698