Index: media/remoting/courier_renderer.cc |
diff --git a/media/remoting/courier_renderer.cc b/media/remoting/courier_renderer.cc |
index ca0f5677f73b92f270d98002cbb6ca55cc6f950f..8d30578947ef342d5878dc8aed10c33097f12e5a 100644 |
--- a/media/remoting/courier_renderer.cc |
+++ b/media/remoting/courier_renderer.cc |
@@ -126,17 +126,27 @@ void CourierRenderer::Initialize(MediaResource* media_resource, |
state_ = STATE_CREATE_PIPE; |
+ // TODO(servolk): Implement support for multiple streams. For now use the |
+ // first enabled audio and video streams to preserve the existing behavior. |
+ std::vector<::media::DemuxerStream*> streams = media_resource_->GetStreams(); |
+ ::media::DemuxerStream* audio_demuxer_stream = nullptr; |
+ ::media::DemuxerStream* video_demuxer_stream = nullptr; |
+ for (const auto& stream : streams) { |
+ if (stream->type() == DemuxerStream::AUDIO && stream->enabled() && |
+ !audio_demuxer_stream) |
+ audio_demuxer_stream = stream; |
+ if (stream->type() == DemuxerStream::VIDEO && stream->enabled() && |
+ !video_demuxer_stream) |
+ video_demuxer_stream = stream; |
+ } |
+ |
// Create audio mojo data pipe handles if audio is available. |
- DemuxerStream* audio_demuxer_stream = |
- media_resource_->GetStream(DemuxerStream::AUDIO); |
std::unique_ptr<mojo::DataPipe> audio_data_pipe; |
if (audio_demuxer_stream) { |
audio_data_pipe = base::WrapUnique(DemuxerStreamAdapter::CreateDataPipe()); |
} |
// Create video mojo data pipe handles if video is available. |
- DemuxerStream* video_demuxer_stream = |
- media_resource_->GetStream(DemuxerStream::VIDEO); |
std::unique_ptr<mojo::DataPipe> video_data_pipe; |
if (video_demuxer_stream) { |
video_data_pipe = base::WrapUnique(DemuxerStreamAdapter::CreateDataPipe()); |
@@ -326,9 +336,20 @@ void CourierRenderer::OnDataPipeCreated( |
return; // Abort because something went wrong in the meantime. |
DCHECK_EQ(state_, STATE_CREATE_PIPE); |
+ // TODO(erickung): Make remote renderer multi-stream capable. |
+ std::vector<::media::DemuxerStream*> streams = media_resource_->GetStreams(); |
+ ::media::DemuxerStream* audio_demuxer_stream = nullptr; |
+ ::media::DemuxerStream* video_demuxer_stream = nullptr; |
+ for (const auto& s : streams) { |
+ if (s->type() == DemuxerStream::AUDIO && s->enabled() && |
+ !audio_demuxer_stream) |
+ audio_demuxer_stream = s; |
+ if (s->type() == DemuxerStream::VIDEO && s->enabled() && |
+ !video_demuxer_stream) |
+ video_demuxer_stream = s; |
+ } |
+ |
// Create audio demuxer stream adapter if audio is available. |
- DemuxerStream* audio_demuxer_stream = |
- media_resource_->GetStream(DemuxerStream::AUDIO); |
if (audio_demuxer_stream && audio.is_valid() && audio_handle.is_valid() && |
audio_rpc_handle != RpcBroker::kInvalidHandle) { |
VLOG(2) << "Initialize audio"; |
@@ -340,8 +361,6 @@ void CourierRenderer::OnDataPipeCreated( |
} |
// Create video demuxer stream adapter if video is available. |
- DemuxerStream* video_demuxer_stream = |
- media_resource_->GetStream(DemuxerStream::VIDEO); |
if (video_demuxer_stream && video.is_valid() && video_handle.is_valid() && |
video_rpc_handle != RpcBroker::kInvalidHandle) { |
VLOG(2) << "Initialize video"; |