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

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

Issue 2491043003: MediaResource refactoring to support multiple streams (Closed)
Patch Set: rebase 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
Index: media/mojo/services/media_resource_shim.cc
diff --git a/media/mojo/services/demuxer_stream_provider_shim.cc b/media/mojo/services/media_resource_shim.cc
similarity index 58%
rename from media/mojo/services/demuxer_stream_provider_shim.cc
rename to media/mojo/services/media_resource_shim.cc
index 1bb7e6025291d13f2d4debbd40a52898f678dc36..fb984103ebc047baf1f778d3390d03954c10277e 100644
--- a/media/mojo/services/demuxer_stream_provider_shim.cc
+++ b/media/mojo/services/media_resource_shim.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "media/mojo/services/demuxer_stream_provider_shim.h"
+#include "media/mojo/services/media_resource_shim.h"
#include <utility>
@@ -12,7 +12,7 @@
namespace media {
-DemuxerStreamProviderShim::DemuxerStreamProviderShim(
+MediaResourceShim::MediaResourceShim(
std::vector<mojom::DemuxerStreamPtr> streams,
const base::Closure& demuxer_ready_cb)
: demuxer_ready_cb_(demuxer_ready_cb),
@@ -23,27 +23,27 @@ DemuxerStreamProviderShim::DemuxerStreamProviderShim(
for (auto& s : streams) {
streams_.emplace_back(new MojoDemuxerStreamAdapter(
- std::move(s), base::Bind(&DemuxerStreamProviderShim::OnStreamReady,
+ std::move(s), base::Bind(&MediaResourceShim::OnStreamReady,
weak_factory_.GetWeakPtr())));
}
}
-DemuxerStreamProviderShim::~DemuxerStreamProviderShim() {
-}
+MediaResourceShim::~MediaResourceShim() {}
-// 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) {
+std::vector<DemuxerStream*> MediaResourceShim::GetStreams() {
DCHECK(demuxer_ready_cb_.is_null());
- for (auto& stream : streams_) {
- if (stream->type() == type)
- return stream.get();
- }
+ std::vector<DemuxerStream*> result;
+ for (auto& stream : streams_)
+ result.push_back(stream.get());
+ return result;
+}
- return nullptr;
+void MediaResourceShim::SetStreamStatusChangeCB(
+ const StreamStatusChangeCB& cb) {
+ NOTIMPLEMENTED();
}
-void DemuxerStreamProviderShim::OnStreamReady() {
+void MediaResourceShim::OnStreamReady() {
if (++streams_ready_ == streams_.size())
base::ResetAndReturn(&demuxer_ready_cb_).Run();
}

Powered by Google App Engine
This is Rietveld 408576698