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