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

Unified Diff: content/utility/utility_service_factory.cc

Issue 2900773004: media: Add experimental feature to enable Mojo CDM on desktop Chromium (Closed)
Patch Set: drop utility_process_host_impl.cc change Created 3 years, 7 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 | « content/utility/BUILD.gn ('k') | media/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/utility/utility_service_factory.cc
diff --git a/content/utility/utility_service_factory.cc b/content/utility/utility_service_factory.cc
index 2f95ab61a62d1c9a09d73429b3935e218d85ed29..bd79d2ee6537cb55fd8edd09c7a1b7dfb6dc9b5c 100644
--- a/content/utility/utility_service_factory.cc
+++ b/content/utility/utility_service_factory.cc
@@ -14,7 +14,7 @@
#include "content/public/utility/content_utility_client.h"
#include "content/public/utility/utility_thread.h"
#include "content/utility/utility_thread_impl.h"
-#include "media/mojo/features.h"
+#include "ppapi/features/features.h"
#include "services/data_decoder/data_decoder_service.h"
#include "services/data_decoder/public/interfaces/constants.mojom.h"
#include "services/shape_detection/public/interfaces/constants.mojom.h"
@@ -22,8 +22,13 @@
#include "services/video_capture/public/interfaces/constants.mojom.h"
#include "services/video_capture/service_impl.h"
-#if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS)
-#include "media/mojo/services/media_service_factory.h" // nogncheck
+#if BUILDFLAG(ENABLE_PEPPER_CDMS)
+#include "base/memory/ptr_util.h"
+#include "media/cdm/cdm_adapter_factory.h" // nogncheck
+#include "media/mojo/features.h" // nogncheck
+#include "media/mojo/services/media_service.h" // nogncheck
+#include "media/mojo/services/mojo_cdm_allocator.h" // nogncheck
+#include "media/mojo/services/mojo_media_client.h" // nogncheck
#endif
namespace {
@@ -38,6 +43,33 @@ namespace content {
namespace {
+#if BUILDFLAG(ENABLE_PEPPER_CDMS)
+
+static_assert(BUILDFLAG(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS), "");
+static_assert(BUILDFLAG(ENABLE_MOJO_CDM), "");
+
+std::unique_ptr<media::CdmAllocator> CreateCdmAllocator() {
+ return base::MakeUnique<media::MojoCdmAllocator>();
+}
+
+class CdmMojoMediaClient final : public media::MojoMediaClient {
+ public:
+ CdmMojoMediaClient() {}
+ ~CdmMojoMediaClient() override {}
+
+ std::unique_ptr<media::CdmFactory> CreateCdmFactory(
+ service_manager::mojom::InterfaceProvider* host_interfaces) override {
+ return base::MakeUnique<media::CdmAdapterFactory>(
+ base::Bind(&CreateCdmAllocator));
+ }
+};
+
+std::unique_ptr<service_manager::Service> CreateMediaService() {
+ return std::unique_ptr<service_manager::Service>(
+ new ::media::MediaService(base::MakeUnique<CdmMojoMediaClient>()));
+}
+#endif // BUILDFLAG(ENABLE_PEPPER_CDMS)
+
std::unique_ptr<service_manager::Service> CreateDataDecoderService() {
content::UtilityThread::Get()->EnsureBlinkInitialized();
return data_decoder::DataDecoderService::Create();
@@ -58,9 +90,9 @@ void UtilityServiceFactory::RegisterServices(ServiceMap* services) {
services->insert(
std::make_pair(video_capture::mojom::kServiceName, video_capture_info));
-#if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS)
+#if BUILDFLAG(ENABLE_PEPPER_CDMS)
ServiceInfo info;
- info.factory = base::Bind(&media::CreateMediaService);
+ info.factory = base::Bind(&CreateMediaService);
services->insert(std::make_pair("media", info));
#endif
« no previous file with comments | « content/utility/BUILD.gn ('k') | media/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698