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

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

Issue 2668393002: Rename DemuxerStreamProvider into MediaResource (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/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
deleted file mode 100644
index 1bb7e6025291d13f2d4debbd40a52898f678dc36..0000000000000000000000000000000000000000
--- a/media/mojo/services/demuxer_stream_provider_shim.cc
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// 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 <utility>
-
-#include "base/bind.h"
-#include "base/bind_helpers.h"
-#include "base/callback_helpers.h"
-
-namespace media {
-
-DemuxerStreamProviderShim::DemuxerStreamProviderShim(
- std::vector<mojom::DemuxerStreamPtr> streams,
- const base::Closure& demuxer_ready_cb)
- : demuxer_ready_cb_(demuxer_ready_cb),
- streams_ready_(0),
- weak_factory_(this) {
- DCHECK(!streams.empty());
- DCHECK(!demuxer_ready_cb_.is_null());
-
- 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_) {
- if (stream->type() == type)
- return stream.get();
- }
-
- return nullptr;
-}
-
-void DemuxerStreamProviderShim::OnStreamReady() {
- if (++streams_ready_ == streams_.size())
- base::ResetAndReturn(&demuxer_ready_cb_).Run();
-}
-
-} // namespace media

Powered by Google App Engine
This is Rietveld 408576698