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

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

Issue 2643743002: Mojify demuxers and allow running {Chunk/FFmpeg}Demuxer in a Utility Process (Closed)
Patch Set: Rebase and make sure to unbind mojom::DemuxerPtr on the bound thread during termination Created 3 years, 10 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/mojo_demuxer_service_context.h ('k') | media/mojo/services/mojo_media_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/mojo_demuxer_service_context.cc
diff --git a/media/mojo/services/mojo_demuxer_service_context.cc b/media/mojo/services/mojo_demuxer_service_context.cc
new file mode 100644
index 0000000000000000000000000000000000000000..7979e66a180a1668e2233eaf08f49e349747b181
--- /dev/null
+++ b/media/mojo/services/mojo_demuxer_service_context.cc
@@ -0,0 +1,59 @@
+// Copyright 2017 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/mojo_demuxer_service_context.h"
+
+#include "media/base/demuxer.h"
+#include "media/mojo/services/mojo_demuxer_service.h"
+
+namespace media {
+
+MojoDemuxerServiceContext::MojoDemuxerServiceContext()
+ : weak_ptr_factory_(this) {}
+
+MojoDemuxerServiceContext::~MojoDemuxerServiceContext() {}
+
+base::WeakPtr<MojoDemuxerServiceContext>
+MojoDemuxerServiceContext::GetWeakPtr() {
+ return weak_ptr_factory_.GetWeakPtr();
+}
+
+void MojoDemuxerServiceContext::RegisterDemuxer(
+ int demuxer_id,
+ MojoDemuxerService* demuxer_service) {
+ DCHECK(!demuxer_services_.count(demuxer_id));
+ DCHECK(demuxer_service);
+ demuxer_services_[demuxer_id] = demuxer_service;
+}
+
+void MojoDemuxerServiceContext::UnregisterDemuxer(int demuxer_id) {
+ DCHECK(demuxer_services_.count(demuxer_id));
+ demuxer_services_.erase(demuxer_id);
+}
+
+Demuxer* MojoDemuxerServiceContext::GetDemuxer(
+ int demuxer_id,
+ const PipelineStatusCB& demuxer_init_cb) {
+ auto demuxer_service = demuxer_services_.find(demuxer_id);
+ if (demuxer_service == demuxer_services_.end()) {
+ LOG(ERROR) << "Demuxer service not found: " << demuxer_id;
+ return nullptr;
+ }
+
+ return demuxer_service->second->GetDemuxer(demuxer_init_cb);
+}
+
+media::Demuxer* MojoDemuxerServiceContext::GetDemuxerSourceBuffer(
+ int demuxer_id,
+ media::SourceBuffer** source_buffer_out) {
+ auto demuxer_service = demuxer_services_.find(demuxer_id);
+ if (demuxer_service == demuxer_services_.end()) {
+ LOG(ERROR) << "Demuxer service not found: " << demuxer_id;
+ return nullptr;
+ }
+
+ return demuxer_service->second->GetDemuxerSourceBuffer(source_buffer_out);
+}
+
+} // namespace media
« no previous file with comments | « media/mojo/services/mojo_demuxer_service_context.h ('k') | media/mojo/services/mojo_media_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698