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

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

Issue 2382103002: media: Add GpuMojoMediaClient. (Closed)
Patch Set: Add GpuMojoMediaClient. Created 4 years, 1 month 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/gpu_mojo_media_client.cc
diff --git a/media/mojo/services/gpu_mojo_media_client.cc b/media/mojo/services/gpu_mojo_media_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..390fb4ff168535760a4dc23ce6c82e81420acbc2
--- /dev/null
+++ b/media/mojo/services/gpu_mojo_media_client.cc
@@ -0,0 +1,71 @@
+// Copyright 2016 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/gpu_mojo_media_client.h"
+
+#include "media/base/audio_decoder.h"
+#include "media/base/cdm_factory.h"
+#include "media/base/video_decoder.h"
+
+#if defined(OS_ANDROID)
+#include "base/memory/ptr_util.h"
+#include "media/base/android/android_cdm_factory.h"
+#include "media/filters/android/media_codec_audio_decoder.h"
+#include "media/mojo/interfaces/provision_fetcher.mojom.h"
+#include "media/mojo/services/mojo_provision_fetcher.h"
+#include "services/service_manager/public/cpp/connect.h"
+#endif // defined(OS_ANDROID)
+
+namespace media {
+
+namespace {
+
+#if defined(OS_ANDROID)
+std::unique_ptr<ProvisionFetcher> CreateProvisionFetcher(
+ service_manager::mojom::InterfaceProvider* interface_provider) {
+ mojom::ProvisionFetcherPtr provision_fetcher_ptr;
+ service_manager::GetInterface(interface_provider, &provision_fetcher_ptr);
+ return base::MakeUnique<MojoProvisionFetcher>(
+ std::move(provision_fetcher_ptr));
+}
+#endif // defined(OS_ANDROID)
xhwang 2016/11/23 06:58:03 It would be nice to avoid the duplication between
sandersd (OOO until July 31) 2016/11/23 21:21:02 It should be possible to just delete it soon. The
xhwang 2016/11/24 07:02:10 I am a bit lost. Do you mean the "construction pat
sandersd (OOO until July 31) 2016/11/28 00:56:15 Yes, that's what I mean. The paths that construct
+
+} // namespace
+
+GpuMojoMediaClient::GpuMojoMediaClient(
+ scoped_refptr<base::SingleThreadTaskRunner> media_task_runner,
+ MediaGpuChannelManager* media_gpu_channel_manager)
+ : media_task_runner_(media_task_runner),
+ media_gpu_channel_manager_(media_gpu_channel_manager) {}
+
+GpuMojoMediaClient::~GpuMojoMediaClient() {}
+
+std::unique_ptr<AudioDecoder> GpuMojoMediaClient::CreateAudioDecoder(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
+#if defined(OS_ANDROID)
+ return base::MakeUnique<MediaCodecAudioDecoder>(task_runner);
+#else
+ return nullptr;
+#endif // defined(OS_ANDROID)
+}
+
+std::unique_ptr<VideoDecoder> GpuMojoMediaClient::CreateVideoDecoder(
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner) {
+ (void)media_gpu_channel_manager_;
sandersd (OOO until July 31) 2016/11/22 23:07:59 This just avoids the compiler warning for unused p
+
+ // TODO(sandersd): Factory for VideoDecoders.
+ return nullptr;
+}
+
+std::unique_ptr<CdmFactory> GpuMojoMediaClient::CreateCdmFactory(
+ service_manager::mojom::InterfaceProvider* interface_provider) {
+#if defined(OS_ANDROID)
+ return base::MakeUnique<AndroidCdmFactory>(
+ base::Bind(&CreateProvisionFetcher, interface_provider));
+#else
+ return nullptr;
+#endif // defined(OS_ANDROID)
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698