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

Unified Diff: media/mojo/services/demuxer_stream_provider_shim.cc

Issue 2383663002: Make mojo renderer capable of supporting multiple streams/tracks (Closed)
Patch Set: nit 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/mojo/services/demuxer_stream_provider_shim.h ('k') | media/mojo/services/media_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/demuxer_stream_provider_shim.cc
diff --git a/media/mojo/services/demuxer_stream_provider_shim.cc b/media/mojo/services/demuxer_stream_provider_shim.cc
index 0c9d8fea64f70708b9d9e88ded2be08ea32527d4..1bb7e6025291d13f2d4debbd40a52898f678dc36 100644
--- a/media/mojo/services/demuxer_stream_provider_shim.cc
+++ b/media/mojo/services/demuxer_stream_provider_shim.cc
@@ -13,36 +13,31 @@
namespace media {
DemuxerStreamProviderShim::DemuxerStreamProviderShim(
- mojom::DemuxerStreamPtr audio,
- mojom::DemuxerStreamPtr video,
+ std::vector<mojom::DemuxerStreamPtr> streams,
const base::Closure& demuxer_ready_cb)
: demuxer_ready_cb_(demuxer_ready_cb),
streams_ready_(0),
weak_factory_(this) {
- DCHECK(audio || video);
+ DCHECK(!streams.empty());
DCHECK(!demuxer_ready_cb_.is_null());
- if (audio) {
- streams_.push_back(new MojoDemuxerStreamAdapter(
- std::move(audio), base::Bind(&DemuxerStreamProviderShim::OnStreamReady,
- weak_factory_.GetWeakPtr())));
- }
-
- if (video) {
- streams_.push_back(new MojoDemuxerStreamAdapter(
- std::move(video), base::Bind(&DemuxerStreamProviderShim::OnStreamReady,
- weak_factory_.GetWeakPtr())));
+ for (auto& s : streams) {
+ streams_.emplace_back(new MojoDemuxerStreamAdapter(
+ std::move(s), base::Bind(&DemuxerStreamProviderShim::OnStreamReady,
+ weak_factory_.GetWeakPtr())));
}
}
DemuxerStreamProviderShim::~DemuxerStreamProviderShim() {
}
+// This function returns only the first stream of the given |type| for now.
+// TODO(servolk): Make this work with multiple streams.
DemuxerStream* DemuxerStreamProviderShim::GetStream(DemuxerStream::Type type) {
DCHECK(demuxer_ready_cb_.is_null());
- for (auto* stream : streams_) {
+ for (auto& stream : streams_) {
if (stream->type() == type)
- return stream;
+ return stream.get();
}
return nullptr;
« no previous file with comments | « media/mojo/services/demuxer_stream_provider_shim.h ('k') | media/mojo/services/media_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698