Commit b3a65a61 authored by wutao's avatar wutao Committed by Commit Bot

Add assistant audio decoder

This cl creates a mojo service for assistant audio decoder. The decoder
is running in utility process. This is a temporary solution until
MediaService for Chrome OS is implemented.

Bug: b/80315134
Test: manual tested can create the audio decoder for assistant.
Change-Id: Ib4d1a8d3e6d38b0cbb436e20e6d12033d74ed7cf
Reviewed-on: https://chromium-review.googlesource.com/1137020Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Commit-Queue: Tao Wu <wutao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577713}
parent 3764d52b
...@@ -34,6 +34,10 @@ ...@@ -34,6 +34,10 @@
#include "services/viz/public/interfaces/constants.mojom.h" #include "services/viz/public/interfaces/constants.mojom.h"
#include "services/viz/service.h" #include "services/viz/service.h"
#if BUILDFLAG(ENABLE_ASSISTANT_AUDIO_DECODER)
#include "media/mojo/services/media_service_factory.h" // nogncheck
#endif
#if BUILDFLAG(ENABLE_LIBRARY_CDMS) #if BUILDFLAG(ENABLE_LIBRARY_CDMS)
#include "media/cdm/cdm_adapter_factory.h" // nogncheck #include "media/cdm/cdm_adapter_factory.h" // nogncheck
#include "media/mojo/interfaces/constants.mojom.h" // nogncheck #include "media/mojo/interfaces/constants.mojom.h" // nogncheck
...@@ -96,6 +100,12 @@ std::unique_ptr<service_manager::Service> CreateCdmService() { ...@@ -96,6 +100,12 @@ std::unique_ptr<service_manager::Service> CreateCdmService() {
} }
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS) #endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)
#if BUILDFLAG(ENABLE_ASSISTANT_AUDIO_DECODER)
std::unique_ptr<service_manager::Service> CreateMediaService() {
return ::media::CreateMediaService();
}
#endif // BUILDFLAG(ENABLE_ASSISTANT_AUDIO_DECODER)
std::unique_ptr<service_manager::Service> CreateDataDecoderService() { std::unique_ptr<service_manager::Service> CreateDataDecoderService() {
content::UtilityThread::Get()->EnsureBlinkInitialized(); content::UtilityThread::Get()->EnsureBlinkInitialized();
return data_decoder::DataDecoderService::Create(); return data_decoder::DataDecoderService::Create();
...@@ -145,6 +155,14 @@ void UtilityServiceFactory::RegisterServices(ServiceMap* services) { ...@@ -145,6 +155,14 @@ void UtilityServiceFactory::RegisterServices(ServiceMap* services) {
services->emplace(media::mojom::kCdmServiceName, info); services->emplace(media::mojom::kCdmServiceName, info);
#endif #endif
#if BUILDFLAG(ENABLE_ASSISTANT_AUDIO_DECODER)
service_manager::EmbeddedServiceInfo assistant_media_service_info;
assistant_media_service_info.factory =
base::BindRepeating(&CreateMediaService);
services->emplace(media::mojom::kMediaServiceName,
assistant_media_service_info);
#endif
service_manager::EmbeddedServiceInfo shape_detection_info; service_manager::EmbeddedServiceInfo shape_detection_info;
shape_detection_info.factory = shape_detection_info.factory =
base::Bind(&shape_detection::ShapeDetectionService::Create); base::Bind(&shape_detection::ShapeDetectionService::Create);
......
...@@ -34,6 +34,7 @@ buildflag_header("media_buildflags") { ...@@ -34,6 +34,7 @@ buildflag_header("media_buildflags") {
"ENABLE_CDM_STORAGE_ID=$enable_cdm_storage_id", "ENABLE_CDM_STORAGE_ID=$enable_cdm_storage_id",
"ENABLE_MEDIA_REMOTING=$enable_media_remoting", "ENABLE_MEDIA_REMOTING=$enable_media_remoting",
"ENABLE_MEDIA_REMOTING_RPC=$enable_media_remoting_rpc", "ENABLE_MEDIA_REMOTING_RPC=$enable_media_remoting_rpc",
"ENABLE_ASSISTANT_AUDIO_DECODER=$enable_assistant_audio_decoder",
"USE_PROPRIETARY_CODECS=$proprietary_codecs", "USE_PROPRIETARY_CODECS=$proprietary_codecs",
] ]
} }
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/config/chromecast_build.gni") import("//build/config/chromecast_build.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
import("//chromeos/assistant/assistant.gni")
import("//testing/libfuzzer/fuzzer_test.gni") import("//testing/libfuzzer/fuzzer_test.gni")
# Do not expand this list without double-checking with OWNERS, this is a list of # Do not expand this list without double-checking with OWNERS, this is a list of
...@@ -173,6 +174,13 @@ assert(!enable_cdm_host_verification || is_mac || is_win, ...@@ -173,6 +174,13 @@ assert(!enable_cdm_host_verification || is_mac || is_win,
_default_mojo_media_services = [] _default_mojo_media_services = []
_default_mojo_media_host = "none" _default_mojo_media_host = "none"
# Mojo media host for Chrome OS Assistant.
_default_assistant_mojo_media_host = "none"
# Enables the use of Assistant Audio Decoder Service. If true, it will be hosted
# in the mojo MediaService running in the utility process.
enable_assistant_audio_decoder = is_chromeos && enable_cros_libassistant
# Default mojo_media_services and mojo_media_host on various platforms. # Default mojo_media_services and mojo_media_host on various platforms.
# Can be overridden by gn build arguments from the --args command line flag # Can be overridden by gn build arguments from the --args command line flag
# for local testing. # for local testing.
...@@ -196,6 +204,12 @@ if (enable_mojo_media) { ...@@ -196,6 +204,12 @@ if (enable_mojo_media) {
_default_mojo_media_host = "gpu" _default_mojo_media_host = "gpu"
} }
if (enable_assistant_audio_decoder) {
# Chrome OS Assistant uses audio decoder running in utility process.
_default_mojo_media_services += [ "assistant_audio_decoder" ]
_default_assistant_mojo_media_host = "utility"
}
if (enable_library_cdms) { if (enable_library_cdms) {
_default_mojo_media_services += [ "cdm" ] _default_mojo_media_services += [ "cdm" ]
...@@ -235,6 +249,7 @@ declare_args() { ...@@ -235,6 +249,7 @@ declare_args() {
# - "gpu": Use mojo media service hosted in the gpu process. # - "gpu": Use mojo media service hosted in the gpu process.
# - "utility": Use mojo media service hosted in the utility process. # - "utility": Use mojo media service hosted in the utility process.
mojo_media_host = _default_mojo_media_host mojo_media_host = _default_mojo_media_host
assistant_mojo_media_host = _default_assistant_mojo_media_host
} }
declare_args() { declare_args() {
......
...@@ -12,6 +12,7 @@ buildflag_header("buildflags") { ...@@ -12,6 +12,7 @@ buildflag_header("buildflags") {
enable_mojo_renderer = false enable_mojo_renderer = false
enable_mojo_cdm = false enable_mojo_cdm = false
enable_mojo_audio_decoder = false enable_mojo_audio_decoder = false
enable_assistant_mojo_audio_decoder = false
enable_mojo_video_decoder = false enable_mojo_video_decoder = false
enable_mojo_media_in_browser_process = false enable_mojo_media_in_browser_process = false
enable_mojo_media_in_gpu_process = false enable_mojo_media_in_gpu_process = false
...@@ -30,6 +31,8 @@ buildflag_header("buildflags") { ...@@ -30,6 +31,8 @@ buildflag_header("buildflags") {
enable_mojo_cdm = true enable_mojo_cdm = true
} else if (service == "audio_decoder") { } else if (service == "audio_decoder") {
enable_mojo_audio_decoder = true enable_mojo_audio_decoder = true
} else if (service == "assistant_audio_decoder") {
enable_assistant_mojo_audio_decoder = true
} else if (service == "video_decoder") { } else if (service == "video_decoder") {
enable_mojo_video_decoder = true enable_mojo_video_decoder = true
} else { } else {
...@@ -49,6 +52,10 @@ buildflag_header("buildflags") { ...@@ -49,6 +52,10 @@ buildflag_header("buildflags") {
} else { } else {
assert(false, "Invalid mojo media host: $mojo_media_host") assert(false, "Invalid mojo media host: $mojo_media_host")
} }
if (assistant_mojo_media_host == "utility") {
enable_mojo_media_in_utility_process = true
}
} }
flags = [ flags = [
...@@ -57,6 +64,7 @@ buildflag_header("buildflags") { ...@@ -57,6 +64,7 @@ buildflag_header("buildflags") {
"ENABLE_MOJO_RENDERER=$enable_mojo_renderer", "ENABLE_MOJO_RENDERER=$enable_mojo_renderer",
"ENABLE_MOJO_CDM=$enable_mojo_cdm", "ENABLE_MOJO_CDM=$enable_mojo_cdm",
"ENABLE_MOJO_AUDIO_DECODER=$enable_mojo_audio_decoder", "ENABLE_MOJO_AUDIO_DECODER=$enable_mojo_audio_decoder",
"ENABLE_ASSISTANT_MOJO_AUDIO_DECODER=$enable_assistant_mojo_audio_decoder",
"ENABLE_MOJO_VIDEO_DECODER=$enable_mojo_video_decoder", "ENABLE_MOJO_VIDEO_DECODER=$enable_mojo_video_decoder",
"ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS=$enable_mojo_media_in_browser_process", "ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS=$enable_mojo_media_in_browser_process",
"ENABLE_MOJO_MEDIA_IN_GPU_PROCESS=$enable_mojo_media_in_gpu_process", "ENABLE_MOJO_MEDIA_IN_GPU_PROCESS=$enable_mojo_media_in_gpu_process",
......
...@@ -142,6 +142,13 @@ component("services") { ...@@ -142,6 +142,13 @@ component("services") {
deps += [ "//sandbox" ] deps += [ "//sandbox" ]
} }
} }
if (enable_assistant_audio_decoder) {
sources += [
"assistant_mojo_media_client.cc",
"assistant_mojo_media_client.h",
]
}
} }
service_manifest("cdm_manifest") { service_manifest("cdm_manifest") {
......
...@@ -49,7 +49,8 @@ AndroidMojoMediaClient::~AndroidMojoMediaClient() {} ...@@ -49,7 +49,8 @@ AndroidMojoMediaClient::~AndroidMojoMediaClient() {}
// MojoMediaClient overrides. // MojoMediaClient overrides.
std::unique_ptr<AudioDecoder> AndroidMojoMediaClient::CreateAudioDecoder( std::unique_ptr<AudioDecoder> AndroidMojoMediaClient::CreateAudioDecoder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { scoped_refptr<base::SingleThreadTaskRunner> task_runner,
MediaLog* media_log) {
return std::make_unique<MediaCodecAudioDecoder>(task_runner); return std::make_unique<MediaCodecAudioDecoder>(task_runner);
} }
......
...@@ -20,7 +20,8 @@ class AndroidMojoMediaClient : public MojoMediaClient { ...@@ -20,7 +20,8 @@ class AndroidMojoMediaClient : public MojoMediaClient {
// MojoMediaClient implementation. // MojoMediaClient implementation.
std::unique_ptr<AudioDecoder> CreateAudioDecoder( std::unique_ptr<AudioDecoder> CreateAudioDecoder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) final; scoped_refptr<base::SingleThreadTaskRunner> task_runner,
MediaLog* media_log) final;
std::unique_ptr<CdmFactory> CreateCdmFactory( std::unique_ptr<CdmFactory> CreateCdmFactory(
service_manager::mojom::InterfaceProvider* host_interfaces) final; service_manager::mojom::InterfaceProvider* host_interfaces) final;
......
// Copyright 2018 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/assistant_mojo_media_client.h"
#include "base/single_thread_task_runner.h"
#include "media/base/audio_decoder.h"
#include "media/filters/ffmpeg_audio_decoder.h"
namespace media {
AssistantMojoMediaClient::AssistantMojoMediaClient() = default;
AssistantMojoMediaClient::~AssistantMojoMediaClient() = default;
std::unique_ptr<AudioDecoder> AssistantMojoMediaClient::CreateAudioDecoder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
MediaLog* media_log) {
return std::make_unique<FFmpegAudioDecoder>(std::move(task_runner),
media_log);
}
} // namespace media
// Copyright 2018 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_ASSISTANT_MOJO_MEDIA_CLIENT_H_
#define MEDIA_MOJO_SERVICES_ASSISTANT_MOJO_MEDIA_CLIENT_H_
#include <memory>
#include "base/macros.h"
#include "base/memory/scoped_refptr.h"
#include "media/base/media_log.h"
#include "media/mojo/services/mojo_media_client.h"
namespace base {
class SingleThreadTaskRunner;
} // namespace base
namespace media {
class MediaLog;
class AssistantMojoMediaClient : public MojoMediaClient {
public:
AssistantMojoMediaClient();
~AssistantMojoMediaClient() final;
// MojoMediaClient implementation.
std::unique_ptr<AudioDecoder> CreateAudioDecoder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
MediaLog* media_log) final;
private:
DISALLOW_COPY_AND_ASSIGN(AssistantMojoMediaClient);
};
} // namespace media
#endif // MEDIA_MOJO_SERVICES_ASSISTANT_MOJO_MEDIA_CLIENT_H_
...@@ -102,7 +102,8 @@ GpuMojoMediaClient::~GpuMojoMediaClient() = default; ...@@ -102,7 +102,8 @@ GpuMojoMediaClient::~GpuMojoMediaClient() = default;
void GpuMojoMediaClient::Initialize(service_manager::Connector* connector) {} void GpuMojoMediaClient::Initialize(service_manager::Connector* connector) {}
std::unique_ptr<AudioDecoder> GpuMojoMediaClient::CreateAudioDecoder( std::unique_ptr<AudioDecoder> GpuMojoMediaClient::CreateAudioDecoder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { scoped_refptr<base::SingleThreadTaskRunner> task_runner,
MediaLog* media_log) {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
return std::make_unique<MediaCodecAudioDecoder>(task_runner); return std::make_unique<MediaCodecAudioDecoder>(task_runner);
#else #else
......
...@@ -39,7 +39,8 @@ class GpuMojoMediaClient : public MojoMediaClient { ...@@ -39,7 +39,8 @@ class GpuMojoMediaClient : public MojoMediaClient {
// MojoMediaClient implementation. // MojoMediaClient implementation.
void Initialize(service_manager::Connector* connector) final; void Initialize(service_manager::Connector* connector) final;
std::unique_ptr<AudioDecoder> CreateAudioDecoder( std::unique_ptr<AudioDecoder> CreateAudioDecoder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) final; scoped_refptr<base::SingleThreadTaskRunner> task_runner,
MediaLog* media_log) final;
std::unique_ptr<VideoDecoder> CreateVideoDecoder( std::unique_ptr<VideoDecoder> CreateVideoDecoder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_refptr<base::SingleThreadTaskRunner> task_runner,
MediaLog* media_log, MediaLog* media_log,
......
...@@ -16,9 +16,11 @@ ...@@ -16,9 +16,11 @@
#include "mojo/public/cpp/bindings/strong_binding.h" #include "mojo/public/cpp/bindings/strong_binding.h"
#include "services/service_manager/public/mojom/interface_provider.mojom.h" #include "services/service_manager/public/mojom/interface_provider.mojom.h"
#if BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) #if BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) || \
BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
#include "media/mojo/services/mojo_audio_decoder_service.h" #include "media/mojo/services/mojo_audio_decoder_service.h"
#endif // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) #endif // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) ||
// BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
#if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER) #if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
#include "media/mojo/services/mojo_video_decoder_service.h" #include "media/mojo/services/mojo_video_decoder_service.h"
...@@ -47,7 +49,8 @@ InterfaceFactoryImpl::InterfaceFactoryImpl( ...@@ -47,7 +49,8 @@ InterfaceFactoryImpl::InterfaceFactoryImpl(
std::unique_ptr<service_manager::ServiceContextRef> connection_ref, std::unique_ptr<service_manager::ServiceContextRef> connection_ref,
MojoMediaClient* mojo_media_client) MojoMediaClient* mojo_media_client)
: :
#if BUILDFLAG(ENABLE_MOJO_RENDERER) #if BUILDFLAG(ENABLE_MOJO_RENDERER) || BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) || \
BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
media_log_(media_log), media_log_(media_log),
#endif #endif
#if BUILDFLAG(ENABLE_MOJO_CDM) #if BUILDFLAG(ENABLE_MOJO_CDM)
...@@ -70,12 +73,13 @@ InterfaceFactoryImpl::~InterfaceFactoryImpl() { ...@@ -70,12 +73,13 @@ InterfaceFactoryImpl::~InterfaceFactoryImpl() {
void InterfaceFactoryImpl::CreateAudioDecoder( void InterfaceFactoryImpl::CreateAudioDecoder(
mojo::InterfaceRequest<mojom::AudioDecoder> request) { mojo::InterfaceRequest<mojom::AudioDecoder> request) {
DVLOG(2) << __func__; DVLOG(2) << __func__;
#if BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) #if BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) || \
BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
scoped_refptr<base::SingleThreadTaskRunner> task_runner( scoped_refptr<base::SingleThreadTaskRunner> task_runner(
base::ThreadTaskRunnerHandle::Get()); base::ThreadTaskRunnerHandle::Get());
std::unique_ptr<AudioDecoder> audio_decoder = std::unique_ptr<AudioDecoder> audio_decoder =
mojo_media_client_->CreateAudioDecoder(task_runner); mojo_media_client_->CreateAudioDecoder(task_runner, media_log_);
if (!audio_decoder) { if (!audio_decoder) {
DLOG(ERROR) << "AudioDecoder creation failed."; DLOG(ERROR) << "AudioDecoder creation failed.";
return; return;
...@@ -85,7 +89,8 @@ void InterfaceFactoryImpl::CreateAudioDecoder( ...@@ -85,7 +89,8 @@ void InterfaceFactoryImpl::CreateAudioDecoder(
std::make_unique<MojoAudioDecoderService>(&cdm_service_context_, std::make_unique<MojoAudioDecoderService>(&cdm_service_context_,
std::move(audio_decoder)), std::move(audio_decoder)),
std::move(request)); std::move(request));
#endif // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) #endif // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) ||
// BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
} }
void InterfaceFactoryImpl::CreateVideoDecoder( void InterfaceFactoryImpl::CreateVideoDecoder(
...@@ -202,10 +207,12 @@ void InterfaceFactoryImpl::OnDestroyPending(base::OnceClosure destroy_cb) { ...@@ -202,10 +207,12 @@ void InterfaceFactoryImpl::OnDestroyPending(base::OnceClosure destroy_cb) {
} }
bool InterfaceFactoryImpl::IsEmpty() { bool InterfaceFactoryImpl::IsEmpty() {
#if BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) #if BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) || \
BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
if (!audio_decoder_bindings_.empty()) if (!audio_decoder_bindings_.empty())
return false; return false;
#endif // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) #endif // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) ||
// BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
#if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER) #if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
if (!video_decoder_bindings_.empty()) if (!video_decoder_bindings_.empty())
...@@ -240,9 +247,11 @@ void InterfaceFactoryImpl::SetBindingConnectionErrorHandler() { ...@@ -240,9 +247,11 @@ void InterfaceFactoryImpl::SetBindingConnectionErrorHandler() {
auto connection_error_cb = base::BindRepeating( auto connection_error_cb = base::BindRepeating(
&InterfaceFactoryImpl::OnBindingConnectionError, base::Unretained(this)); &InterfaceFactoryImpl::OnBindingConnectionError, base::Unretained(this));
#if BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) #if BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) || \
BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
audio_decoder_bindings_.set_connection_error_handler(connection_error_cb); audio_decoder_bindings_.set_connection_error_handler(connection_error_cb);
#endif // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) #endif // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) ||
// BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
#if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER) #if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
video_decoder_bindings_.set_connection_error_handler(connection_error_cb); video_decoder_bindings_.set_connection_error_handler(connection_error_cb);
......
...@@ -63,16 +63,24 @@ class InterfaceFactoryImpl : public DeferredDestroy<mojom::InterfaceFactory> { ...@@ -63,16 +63,24 @@ class InterfaceFactoryImpl : public DeferredDestroy<mojom::InterfaceFactory> {
// available. // available.
MojoCdmServiceContext cdm_service_context_; MojoCdmServiceContext cdm_service_context_;
#if BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) #if BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) || \
BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
mojo::StrongBindingSet<mojom::AudioDecoder> audio_decoder_bindings_; mojo::StrongBindingSet<mojom::AudioDecoder> audio_decoder_bindings_;
#endif // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) #endif // BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) ||
// BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
#if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER) #if BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
mojo::StrongBindingSet<mojom::VideoDecoder> video_decoder_bindings_; mojo::StrongBindingSet<mojom::VideoDecoder> video_decoder_bindings_;
#endif // BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER) #endif // BUILDFLAG(ENABLE_MOJO_VIDEO_DECODER)
#if BUILDFLAG(ENABLE_MOJO_RENDERER) #if BUILDFLAG(ENABLE_MOJO_RENDERER) || BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) || \
BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
MediaLog* media_log_; MediaLog* media_log_;
#endif // BUILDFLAG(ENABLE_MOJO_RENDERER) ||
// BUILDFLAG(ENABLE_MOJO_AUDIO_DECODER) ||
// BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
#if BUILDFLAG(ENABLE_MOJO_RENDERER)
mojo::StrongBindingSet<mojom::Renderer> renderer_bindings_; mojo::StrongBindingSet<mojom::Renderer> renderer_bindings_;
#endif // BUILDFLAG(ENABLE_MOJO_RENDERER) #endif // BUILDFLAG(ENABLE_MOJO_RENDERER)
......
...@@ -7,10 +7,15 @@ ...@@ -7,10 +7,15 @@
#include <memory> #include <memory>
#include "base/logging.h" #include "base/logging.h"
#include "media/mojo/buildflags.h"
#include "media/mojo/services/gpu_mojo_media_client.h" #include "media/mojo/services/gpu_mojo_media_client.h"
#include "media/mojo/services/media_service.h" #include "media/mojo/services/media_service.h"
#include "media/mojo/services/test_mojo_media_client.h" #include "media/mojo/services/test_mojo_media_client.h"
#if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_UTILITY_PROCESS)
#include "media/mojo/services/assistant_mojo_media_client.h" // nogncheck
#endif
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#include "media/mojo/services/android_mojo_media_client.h" // nogncheck #include "media/mojo/services/android_mojo_media_client.h" // nogncheck
#endif #endif
...@@ -23,6 +28,9 @@ std::unique_ptr<service_manager::Service> CreateMediaService() { ...@@ -23,6 +28,9 @@ std::unique_ptr<service_manager::Service> CreateMediaService() {
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
return std::unique_ptr<service_manager::Service>( return std::unique_ptr<service_manager::Service>(
new MediaService(std::make_unique<AndroidMojoMediaClient>())); new MediaService(std::make_unique<AndroidMojoMediaClient>()));
#elif BUILDFLAG(ENABLE_ASSISTANT_MOJO_AUDIO_DECODER)
return std::make_unique<MediaService>(
std::make_unique<AssistantMojoMediaClient>());
#else #else
NOTREACHED() << "No MediaService implementation available."; NOTREACHED() << "No MediaService implementation available.";
return nullptr; return nullptr;
......
...@@ -24,7 +24,8 @@ MojoMediaClient::~MojoMediaClient() = default; ...@@ -24,7 +24,8 @@ MojoMediaClient::~MojoMediaClient() = default;
void MojoMediaClient::Initialize(service_manager::Connector* connector) {} void MojoMediaClient::Initialize(service_manager::Connector* connector) {}
std::unique_ptr<AudioDecoder> MojoMediaClient::CreateAudioDecoder( std::unique_ptr<AudioDecoder> MojoMediaClient::CreateAudioDecoder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner) { scoped_refptr<base::SingleThreadTaskRunner> task_runner,
MediaLog* media_log) {
return nullptr; return nullptr;
} }
......
...@@ -52,7 +52,8 @@ class MEDIA_MOJO_EXPORT MojoMediaClient { ...@@ -52,7 +52,8 @@ class MEDIA_MOJO_EXPORT MojoMediaClient {
virtual void Initialize(service_manager::Connector* connector); virtual void Initialize(service_manager::Connector* connector);
virtual std::unique_ptr<AudioDecoder> CreateAudioDecoder( virtual std::unique_ptr<AudioDecoder> CreateAudioDecoder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner); scoped_refptr<base::SingleThreadTaskRunner> task_runner,
MediaLog* media_log);
virtual std::unique_ptr<VideoDecoder> CreateVideoDecoder( virtual std::unique_ptr<VideoDecoder> CreateVideoDecoder(
scoped_refptr<base::SingleThreadTaskRunner> task_runner, scoped_refptr<base::SingleThreadTaskRunner> task_runner,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment