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

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

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.cc ('k') | media/mojo/services/mojo_demuxer_service_context.cc » ('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.h
diff --git a/media/mojo/services/mojo_demuxer_service_context.h b/media/mojo/services/mojo_demuxer_service_context.h
new file mode 100644
index 0000000000000000000000000000000000000000..f8fab8ec0718ee1a7d970ac2f5d88411d5569fa6
--- /dev/null
+++ b/media/mojo/services/mojo_demuxer_service_context.h
@@ -0,0 +1,53 @@
+// 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.
+
+#ifndef MEDIA_MOJO_SERVICES_MOJO_DEMUXER_SERVICE_CONTEXT_H_
+#define MEDIA_MOJO_SERVICES_MOJO_DEMUXER_SERVICE_CONTEXT_H_
+
+#include <map>
+
+#include "base/memory/weak_ptr.h"
+#include "media/base/pipeline.h"
+#include "media/mojo/services/media_mojo_export.h"
+
+namespace media {
+
+class Demuxer;
+class MojoDemuxerService;
+class SourceBuffer;
+
+// A class that creates, owns and manages all MojoDemuxerService instances.
+class MEDIA_MOJO_EXPORT MojoDemuxerServiceContext {
+ public:
+ MojoDemuxerServiceContext();
+ ~MojoDemuxerServiceContext();
+
+ base::WeakPtr<MojoDemuxerServiceContext> GetWeakPtr();
+
+ // Registers The |demuxer_service| with |demuxer_id|.
+ void RegisterDemuxer(int demuxer_id, MojoDemuxerService* demuxer_service);
+
+ // Unregisters the Demuxer. Must be called before the Demuxer is destroyed.
+ void UnregisterDemuxer(int demuxer_id);
+
+ // Returns the Demuxer associated with |demuxer_id|.
+ Demuxer* GetDemuxer(int demuxer_id, const PipelineStatusCB& demuxer_init_cb);
+
+ media::Demuxer* GetDemuxerSourceBuffer(
+ int demuxer_id,
+ media::SourceBuffer** source_buffer_out);
+
+ private:
+ // A map between Demuxer ID and MojoDemuxerService.
+ std::map<int, MojoDemuxerService*> demuxer_services_;
+
+ // NOTE: Weak pointers must be invalidated before all other member variables.
+ base::WeakPtrFactory<MojoDemuxerServiceContext> weak_ptr_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(MojoDemuxerServiceContext);
+};
+
+} // namespace media
+
+#endif // MEDIA_MOJO_SERVICES_MOJO_DEMUXER_SERVICE_CONTEXT_H_
« no previous file with comments | « media/mojo/services/mojo_demuxer_service.cc ('k') | media/mojo/services/mojo_demuxer_service_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698