Commit 57673f4d authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Rename AVDACodecAllocator to CodecAllocator.

Since AVDA is on it's way out... this also replaces all instances of
base::Bind with the appropriate version (generally base::BindOnce).

BUG=none
TEST=bots
R=liberato

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: I75f8dd4895f7404fe752cf02d495a198b8a78a6a
Reviewed-on: https://chromium-review.googlesource.com/1252961
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarFrank Liberato <liberato@chromium.org>
Cr-Commit-Position: refs/heads/master@{#595323}
parent f0ac64f0
...@@ -157,8 +157,6 @@ component("gpu") { ...@@ -157,8 +157,6 @@ component("gpu") {
"android/android_video_surface_chooser.h", "android/android_video_surface_chooser.h",
"android/android_video_surface_chooser_impl.cc", "android/android_video_surface_chooser_impl.cc",
"android/android_video_surface_chooser_impl.h", "android/android_video_surface_chooser_impl.h",
"android/avda_codec_allocator.cc",
"android/avda_codec_allocator.h",
"android/avda_codec_image.cc", "android/avda_codec_image.cc",
"android/avda_codec_image.h", "android/avda_codec_image.h",
"android/avda_picture_buffer_manager.cc", "android/avda_picture_buffer_manager.cc",
...@@ -168,6 +166,8 @@ component("gpu") { ...@@ -168,6 +166,8 @@ component("gpu") {
"android/avda_state_provider.h", "android/avda_state_provider.h",
"android/avda_surface_bundle.cc", "android/avda_surface_bundle.cc",
"android/avda_surface_bundle.h", "android/avda_surface_bundle.h",
"android/codec_allocator.cc",
"android/codec_allocator.h",
"android/codec_image.cc", "android/codec_image.cc",
"android/codec_image.h", "android/codec_image.h",
"android/codec_image_group.cc", "android/codec_image_group.cc",
...@@ -438,7 +438,7 @@ source_set("android_video_decode_accelerator_unittests") { ...@@ -438,7 +438,7 @@ source_set("android_video_decode_accelerator_unittests") {
sources = [ sources = [
"android/android_video_decode_accelerator_unittest.cc", "android/android_video_decode_accelerator_unittest.cc",
"android/android_video_surface_chooser_impl_unittest.cc", "android/android_video_surface_chooser_impl_unittest.cc",
"android/avda_codec_allocator_unittest.cc", "android/codec_allocator_unittest.cc",
"android/codec_image_group_unittest.cc", "android/codec_image_group_unittest.cc",
"android/codec_image_unittest.cc", "android/codec_image_unittest.cc",
"android/codec_wrapper_unittest.cc", "android/codec_wrapper_unittest.cc",
......
...@@ -118,7 +118,7 @@ constexpr base::TimeDelta IdleTimerTimeOut = base::TimeDelta::FromSeconds(1); ...@@ -118,7 +118,7 @@ constexpr base::TimeDelta IdleTimerTimeOut = base::TimeDelta::FromSeconds(1);
// On low end devices (< KitKat is always low-end due to buggy MediaCodec), // On low end devices (< KitKat is always low-end due to buggy MediaCodec),
// defer the surface creation until the codec is actually used if we know no // defer the surface creation until the codec is actually used if we know no
// software fallback exists. // software fallback exists.
bool ShouldDeferSurfaceCreation(AVDACodecAllocator* codec_allocator, bool ShouldDeferSurfaceCreation(CodecAllocator* codec_allocator,
const OverlayInfo& overlay_info, const OverlayInfo& overlay_info,
VideoCodec codec, VideoCodec codec,
DeviceInfo* device_info) { DeviceInfo* device_info) {
...@@ -259,7 +259,7 @@ AndroidVideoDecodeAccelerator::BitstreamRecord::BitstreamRecord( ...@@ -259,7 +259,7 @@ AndroidVideoDecodeAccelerator::BitstreamRecord::BitstreamRecord(
AndroidVideoDecodeAccelerator::BitstreamRecord::~BitstreamRecord() {} AndroidVideoDecodeAccelerator::BitstreamRecord::~BitstreamRecord() {}
AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator( AndroidVideoDecodeAccelerator::AndroidVideoDecodeAccelerator(
AVDACodecAllocator* codec_allocator, CodecAllocator* codec_allocator,
std::unique_ptr<AndroidVideoSurfaceChooser> surface_chooser, std::unique_ptr<AndroidVideoSurfaceChooser> surface_chooser,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const GetContextGroupCallback& get_context_group_cb, const GetContextGroupCallback& get_context_group_cb,
......
...@@ -22,9 +22,9 @@ ...@@ -22,9 +22,9 @@
#include "media/base/android/media_crypto_context.h" #include "media/base/android/media_crypto_context.h"
#include "media/base/android_overlay_mojo_factory.h" #include "media/base/android_overlay_mojo_factory.h"
#include "media/base/content_decryption_module.h" #include "media/base/content_decryption_module.h"
#include "media/gpu/android/avda_codec_allocator.h"
#include "media/gpu/android/avda_picture_buffer_manager.h" #include "media/gpu/android/avda_picture_buffer_manager.h"
#include "media/gpu/android/avda_state_provider.h" #include "media/gpu/android/avda_state_provider.h"
#include "media/gpu/android/codec_allocator.h"
#include "media/gpu/android/device_info.h" #include "media/gpu/android/device_info.h"
#include "media/gpu/android/surface_chooser_helper.h" #include "media/gpu/android/surface_chooser_helper.h"
#include "media/gpu/gpu_video_decode_accelerator_helpers.h" #include "media/gpu/gpu_video_decode_accelerator_helpers.h"
...@@ -44,13 +44,13 @@ class PromotionHintAggregator; ...@@ -44,13 +44,13 @@ class PromotionHintAggregator;
class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator
: public VideoDecodeAccelerator, : public VideoDecodeAccelerator,
public AVDAStateProvider, public AVDAStateProvider,
public AVDACodecAllocatorClient { public CodecAllocatorClient {
public: public:
static VideoDecodeAccelerator::Capabilities GetCapabilities( static VideoDecodeAccelerator::Capabilities GetCapabilities(
const gpu::GpuPreferences& gpu_preferences); const gpu::GpuPreferences& gpu_preferences);
AndroidVideoDecodeAccelerator( AndroidVideoDecodeAccelerator(
AVDACodecAllocator* codec_allocator, CodecAllocator* codec_allocator,
std::unique_ptr<AndroidVideoSurfaceChooser> surface_chooser, std::unique_ptr<AndroidVideoSurfaceChooser> surface_chooser,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const GetContextGroupCallback& get_context_group_cb, const GetContextGroupCallback& get_context_group_cb,
...@@ -83,7 +83,7 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator ...@@ -83,7 +83,7 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator
void NotifyError(Error error) override; void NotifyError(Error error) override;
PromotionHintAggregator::NotifyPromotionHintCB GetPromotionHintCB() override; PromotionHintAggregator::NotifyPromotionHintCB GetPromotionHintCB() override;
// AVDACodecAllocatorClient implementation: // CodecAllocatorClient implementation:
void OnCodecConfigured( void OnCodecConfigured(
std::unique_ptr<MediaCodecBridge> media_codec, std::unique_ptr<MediaCodecBridge> media_codec,
scoped_refptr<AVDASurfaceBundle> surface_bundle) override; scoped_refptr<AVDASurfaceBundle> surface_bundle) override;
...@@ -266,7 +266,7 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator ...@@ -266,7 +266,7 @@ class MEDIA_GPU_EXPORT AndroidVideoDecodeAccelerator
// To expose client callbacks from VideoDecodeAccelerator. // To expose client callbacks from VideoDecodeAccelerator.
Client* client_; Client* client_;
AVDACodecAllocator* codec_allocator_; CodecAllocator* codec_allocator_;
// Callback to set the correct gl context. // Callback to set the correct gl context.
MakeGLContextCurrentCallback make_context_current_cb_; MakeGLContextCurrentCallback make_context_current_cb_;
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
#include "media/base/android/mock_media_codec_bridge.h" #include "media/base/android/mock_media_codec_bridge.h"
#include "media/gpu/android/android_video_decode_accelerator.h" #include "media/gpu/android/android_video_decode_accelerator.h"
#include "media/gpu/android/android_video_surface_chooser.h" #include "media/gpu/android/android_video_surface_chooser.h"
#include "media/gpu/android/avda_codec_allocator.h" #include "media/gpu/android/codec_allocator.h"
#include "media/gpu/android/fake_codec_allocator.h" #include "media/gpu/android/fake_codec_allocator.h"
#include "media/gpu/android/mock_android_video_surface_chooser.h" #include "media/gpu/android/mock_android_video_surface_chooser.h"
#include "media/gpu/android/mock_device_info.h" #include "media/gpu/android/mock_device_info.h"
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef MEDIA_GPU_ANDROID_AVDA_CODEC_ALLOCATOR_H_ #ifndef MEDIA_GPU_ANDROID_CODEC_ALLOCATOR_H_
#define MEDIA_GPU_ANDROID_AVDA_CODEC_ALLOCATOR_H_ #define MEDIA_GPU_ANDROID_CODEC_ALLOCATOR_H_
#include <stddef.h> #include <stddef.h>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
namespace media { namespace media {
// For TaskRunnerFor. These are used as vector indices, so please update // For TaskRunnerFor. These are used as vector indices, so please update
// AVDACodecAllocator's constructor if you add / change them. // CodecAllocator's constructor if you add / change them.
enum TaskType { enum TaskType {
// Task for an autodetected MediaCodec instance. // Task for an autodetected MediaCodec instance.
AUTO_CODEC = 0, AUTO_CODEC = 0,
...@@ -104,7 +104,7 @@ class AVDASurfaceAllocatorClient { ...@@ -104,7 +104,7 @@ class AVDASurfaceAllocatorClient {
~AVDASurfaceAllocatorClient() {} ~AVDASurfaceAllocatorClient() {}
}; };
class AVDACodecAllocatorClient { class CodecAllocatorClient {
public: public:
// Called on the main thread when a new MediaCodec is configured. // Called on the main thread when a new MediaCodec is configured.
// |media_codec| will be null if configuration failed. // |media_codec| will be null if configuration failed.
...@@ -113,16 +113,16 @@ class AVDACodecAllocatorClient { ...@@ -113,16 +113,16 @@ class AVDACodecAllocatorClient {
scoped_refptr<AVDASurfaceBundle> surface_bundle) = 0; scoped_refptr<AVDASurfaceBundle> surface_bundle) = 0;
protected: protected:
~AVDACodecAllocatorClient() {} ~CodecAllocatorClient() {}
}; };
// AVDACodecAllocator manages threads for allocating and releasing MediaCodec // CodecAllocator manages threads for allocating and releasing MediaCodec
// instances. These activities can hang, depending on android version, due // instances. These activities can hang, depending on android version, due
// to mediaserver bugs. AVDACodecAllocator detects these cases, and reports // to mediaserver bugs. CodecAllocator detects these cases, and reports
// on them to allow software fallback if the HW path is hung up. // on them to allow software fallback if the HW path is hung up.
class MEDIA_GPU_EXPORT AVDACodecAllocator { class MEDIA_GPU_EXPORT CodecAllocator {
public: public:
static AVDACodecAllocator* GetInstance( static CodecAllocator* GetInstance(
scoped_refptr<base::SequencedTaskRunner> task_runner); scoped_refptr<base::SequencedTaskRunner> task_runner);
using CodecFactoryCB = using CodecFactoryCB =
...@@ -141,8 +141,8 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator { ...@@ -141,8 +141,8 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator {
// Make sure the construction threads are started for |client|. If the // Make sure the construction threads are started for |client|. If the
// threads fail to start, then codec allocation may fail. // threads fail to start, then codec allocation may fail.
virtual void StartThread(AVDACodecAllocatorClient* client); virtual void StartThread(CodecAllocatorClient* client);
virtual void StopThread(AVDACodecAllocatorClient* client); virtual void StopThread(CodecAllocatorClient* client);
// Create and configure a MediaCodec synchronously. // Create and configure a MediaCodec synchronously.
virtual std::unique_ptr<MediaCodecBridge> CreateMediaCodecSync( virtual std::unique_ptr<MediaCodecBridge> CreateMediaCodecSync(
...@@ -150,9 +150,8 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator { ...@@ -150,9 +150,8 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator {
// Create and configure a MediaCodec asynchronously. The result is delivered // Create and configure a MediaCodec asynchronously. The result is delivered
// via OnCodecConfigured(). // via OnCodecConfigured().
virtual void CreateMediaCodecAsync( virtual void CreateMediaCodecAsync(base::WeakPtr<CodecAllocatorClient> client,
base::WeakPtr<AVDACodecAllocatorClient> client, scoped_refptr<CodecConfig> codec_config);
scoped_refptr<CodecConfig> codec_config);
// Asynchronously release |media_codec| with the attached surface. We will // Asynchronously release |media_codec| with the attached surface. We will
// drop our reference to |surface_bundle| on the main thread after the codec // drop our reference to |surface_bundle| on the main thread after the codec
...@@ -177,11 +176,11 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator { ...@@ -177,11 +176,11 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator {
protected: protected:
// |tick_clock| and |stop_event| are for tests only. // |tick_clock| and |stop_event| are for tests only.
AVDACodecAllocator(AVDACodecAllocator::CodecFactoryCB factory_cb, CodecAllocator(CodecAllocator::CodecFactoryCB factory_cb,
scoped_refptr<base::SequencedTaskRunner> task_runner, scoped_refptr<base::SequencedTaskRunner> task_runner,
const base::TickClock* tick_clock = nullptr, const base::TickClock* tick_clock = nullptr,
base::WaitableEvent* stop_event = nullptr); base::WaitableEvent* stop_event = nullptr);
virtual ~AVDACodecAllocator(); virtual ~CodecAllocator();
// Struct to own a codec and surface bundle, with a custom deleter to post // Struct to own a codec and surface bundle, with a custom deleter to post
// destruction to the right thread. // destruction to the right thread.
...@@ -199,7 +198,7 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator { ...@@ -199,7 +198,7 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator {
// It may only reference |client| from |client_task_runner|. // It may only reference |client| from |client_task_runner|.
void ForwardOrDropCodec( void ForwardOrDropCodec(
scoped_refptr<base::SequencedTaskRunner> client_task_runner, scoped_refptr<base::SequencedTaskRunner> client_task_runner,
base::WeakPtr<AVDACodecAllocatorClient> client, base::WeakPtr<CodecAllocatorClient> client,
TaskType task_type, TaskType task_type,
scoped_refptr<AVDASurfaceBundle> surface_bundle, scoped_refptr<AVDASurfaceBundle> surface_bundle,
std::unique_ptr<MediaCodecBridge> media_codec); std::unique_ptr<MediaCodecBridge> media_codec);
...@@ -207,11 +206,11 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator { ...@@ -207,11 +206,11 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator {
// Forward |surface_bundle| and |media_codec| to |client| on the right thread // Forward |surface_bundle| and |media_codec| to |client| on the right thread
// to access |client|. // to access |client|.
void ForwardOrDropCodecOnClientThread( void ForwardOrDropCodecOnClientThread(
base::WeakPtr<AVDACodecAllocatorClient> client, base::WeakPtr<CodecAllocatorClient> client,
std::unique_ptr<MediaCodecAndSurface> codec_and_surface); std::unique_ptr<MediaCodecAndSurface> codec_and_surface);
private: private:
friend class AVDACodecAllocatorTest; friend class CodecAllocatorTest;
struct OwnerRecord { struct OwnerRecord {
AVDASurfaceAllocatorClient* owner = nullptr; AVDASurfaceAllocatorClient* owner = nullptr;
...@@ -249,7 +248,7 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator { ...@@ -249,7 +248,7 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator {
// which it should post the reply to |client|. // which it should post the reply to |client|.
void CreateMediaCodecAsyncInternal( void CreateMediaCodecAsyncInternal(
scoped_refptr<base::SequencedTaskRunner> client_task_runner, scoped_refptr<base::SequencedTaskRunner> client_task_runner,
base::WeakPtr<AVDACodecAllocatorClient> client, base::WeakPtr<CodecAllocatorClient> client,
scoped_refptr<CodecConfig> codec_config); scoped_refptr<CodecConfig> codec_config);
// Return the task type to use for a new codec allocation, or nullopt if // Return the task type to use for a new codec allocation, or nullopt if
...@@ -275,7 +274,7 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator { ...@@ -275,7 +274,7 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator {
const scoped_refptr<base::SequencedTaskRunner> task_runner_; const scoped_refptr<base::SequencedTaskRunner> task_runner_;
// All registered AVDAs. // All registered AVDAs.
std::set<AVDACodecAllocatorClient*> clients_; std::set<CodecAllocatorClient*> clients_;
// Waitable events for ongoing release tasks indexed by overlay so we can // Waitable events for ongoing release tasks indexed by overlay so we can
// wait on the codec release if the surface attached to it is being destroyed. // wait on the codec release if the surface attached to it is being destroyed.
...@@ -297,11 +296,11 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator { ...@@ -297,11 +296,11 @@ class MEDIA_GPU_EXPORT AVDACodecAllocator {
CodecFactoryCB factory_cb_; CodecFactoryCB factory_cb_;
// For canceling pending StopThreadTask()s. // For canceling pending StopThreadTask()s.
base::WeakPtrFactory<AVDACodecAllocator> weak_this_factory_; base::WeakPtrFactory<CodecAllocator> weak_this_factory_;
DISALLOW_COPY_AND_ASSIGN(AVDACodecAllocator); DISALLOW_COPY_AND_ASSIGN(CodecAllocator);
}; };
} // namespace media } // namespace media
#endif // MEDIA_GPU_ANDROID_AVDA_CODEC_ALLOCATOR_H_ #endif // MEDIA_GPU_ANDROID_CODEC_ALLOCATOR_H_
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "media/base/android/mock_media_codec_bridge.h" #include "media/base/android/mock_media_codec_bridge.h"
#include "media/gpu/android/avda_codec_allocator.h" #include "media/gpu/android/codec_allocator.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -16,16 +16,16 @@ namespace media { ...@@ -16,16 +16,16 @@ namespace media {
FakeCodecAllocator::FakeCodecAllocator( FakeCodecAllocator::FakeCodecAllocator(
scoped_refptr<base::SequencedTaskRunner> task_runner) scoped_refptr<base::SequencedTaskRunner> task_runner)
: testing::NiceMock<AVDACodecAllocator>( : testing::NiceMock<CodecAllocator>(
base::BindRepeating(&MockMediaCodecBridge::CreateVideoDecoder), base::BindRepeating(&MockMediaCodecBridge::CreateVideoDecoder),
task_runner), task_runner),
most_recent_config(new CodecConfig()) {} most_recent_config(new CodecConfig()) {}
FakeCodecAllocator::~FakeCodecAllocator() = default; FakeCodecAllocator::~FakeCodecAllocator() = default;
void FakeCodecAllocator::StartThread(AVDACodecAllocatorClient* client) {} void FakeCodecAllocator::StartThread(CodecAllocatorClient* client) {}
void FakeCodecAllocator::StopThread(AVDACodecAllocatorClient* client) {} void FakeCodecAllocator::StopThread(CodecAllocatorClient* client) {}
std::unique_ptr<MediaCodecBridge> FakeCodecAllocator::CreateMediaCodecSync( std::unique_ptr<MediaCodecBridge> FakeCodecAllocator::CreateMediaCodecSync(
scoped_refptr<CodecConfig> config) { scoped_refptr<CodecConfig> config) {
...@@ -47,7 +47,7 @@ std::unique_ptr<MediaCodecBridge> FakeCodecAllocator::CreateMediaCodecSync( ...@@ -47,7 +47,7 @@ std::unique_ptr<MediaCodecBridge> FakeCodecAllocator::CreateMediaCodecSync(
} }
void FakeCodecAllocator::CreateMediaCodecAsync( void FakeCodecAllocator::CreateMediaCodecAsync(
base::WeakPtr<AVDACodecAllocatorClient> client, base::WeakPtr<CodecAllocatorClient> client,
scoped_refptr<CodecConfig> config) { scoped_refptr<CodecConfig> config) {
// Clear |most_recent_codec| until somebody calls Provide*CodecAsync(). // Clear |most_recent_codec| until somebody calls Provide*CodecAsync().
most_recent_codec = nullptr; most_recent_codec = nullptr;
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
#include "base/sequenced_task_runner.h" #include "base/sequenced_task_runner.h"
#include "media/base/android/mock_media_codec_bridge.h" #include "media/base/android/mock_media_codec_bridge.h"
#include "media/gpu/android/avda_codec_allocator.h"
#include "media/gpu/android/avda_surface_bundle.h" #include "media/gpu/android/avda_surface_bundle.h"
#include "media/gpu/android/codec_allocator.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
#include "ui/gl/android/surface_texture.h" #include "ui/gl/android/surface_texture.h"
...@@ -19,13 +19,13 @@ namespace media { ...@@ -19,13 +19,13 @@ namespace media {
// A codec allocator that provides a configurable fake implementation // A codec allocator that provides a configurable fake implementation
// and lets you set expecations on the "Mock*" methods. // and lets you set expecations on the "Mock*" methods.
class FakeCodecAllocator : public testing::NiceMock<AVDACodecAllocator> { class FakeCodecAllocator : public testing::NiceMock<CodecAllocator> {
public: public:
FakeCodecAllocator(scoped_refptr<base::SequencedTaskRunner> task_runner); FakeCodecAllocator(scoped_refptr<base::SequencedTaskRunner> task_runner);
~FakeCodecAllocator() override; ~FakeCodecAllocator() override;
void StartThread(AVDACodecAllocatorClient* client) override; void StartThread(CodecAllocatorClient* client) override;
void StopThread(AVDACodecAllocatorClient* client) override; void StopThread(CodecAllocatorClient* client) override;
// These are called with some parameters of the codec config by our // These are called with some parameters of the codec config by our
// implementation of their respective functions. This allows tests to set // implementation of their respective functions. This allows tests to set
...@@ -41,7 +41,7 @@ class FakeCodecAllocator : public testing::NiceMock<AVDACodecAllocator> { ...@@ -41,7 +41,7 @@ class FakeCodecAllocator : public testing::NiceMock<AVDACodecAllocator> {
std::unique_ptr<MediaCodecBridge> CreateMediaCodecSync( std::unique_ptr<MediaCodecBridge> CreateMediaCodecSync(
scoped_refptr<CodecConfig> config) override; scoped_refptr<CodecConfig> config) override;
void CreateMediaCodecAsync(base::WeakPtr<AVDACodecAllocatorClient> client, void CreateMediaCodecAsync(base::WeakPtr<CodecAllocatorClient> client,
scoped_refptr<CodecConfig> config) override; scoped_refptr<CodecConfig> config) override;
void ReleaseMediaCodec( void ReleaseMediaCodec(
std::unique_ptr<MediaCodecBridge> media_codec, std::unique_ptr<MediaCodecBridge> media_codec,
...@@ -82,7 +82,7 @@ class FakeCodecAllocator : public testing::NiceMock<AVDACodecAllocator> { ...@@ -82,7 +82,7 @@ class FakeCodecAllocator : public testing::NiceMock<AVDACodecAllocator> {
// Whether CreateMediaCodecAsync() has been called but a codec hasn't been // Whether CreateMediaCodecAsync() has been called but a codec hasn't been
// provided yet. // provided yet.
bool codec_creation_pending_ = false; bool codec_creation_pending_ = false;
base::WeakPtr<AVDACodecAllocatorClient> client_; base::WeakPtr<CodecAllocatorClient> client_;
// The surface bundle of the pending codec creation. // The surface bundle of the pending codec creation.
scoped_refptr<AVDASurfaceBundle> pending_surface_bundle_; scoped_refptr<AVDASurfaceBundle> pending_surface_bundle_;
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "media/base/video_frame.h" #include "media/base/video_frame.h"
#include "media/base/video_util.h" #include "media/base/video_util.h"
#include "media/gpu/android/android_video_surface_chooser.h" #include "media/gpu/android/android_video_surface_chooser.h"
#include "media/gpu/android/avda_codec_allocator.h" #include "media/gpu/android/codec_allocator.h"
#include "media/media_buildflags.h" #include "media/media_buildflags.h"
#if BUILDFLAG(USE_PROPRIETARY_CODECS) #if BUILDFLAG(USE_PROPRIETARY_CODECS)
...@@ -116,7 +116,7 @@ PendingDecode::~PendingDecode() = default; ...@@ -116,7 +116,7 @@ PendingDecode::~PendingDecode() = default;
MediaCodecVideoDecoder::MediaCodecVideoDecoder( MediaCodecVideoDecoder::MediaCodecVideoDecoder(
const gpu::GpuPreferences& gpu_preferences, const gpu::GpuPreferences& gpu_preferences,
DeviceInfo* device_info, DeviceInfo* device_info,
AVDACodecAllocator* codec_allocator, CodecAllocator* codec_allocator,
std::unique_ptr<AndroidVideoSurfaceChooser> surface_chooser, std::unique_ptr<AndroidVideoSurfaceChooser> surface_chooser,
AndroidOverlayMojoFactoryCB overlay_factory_cb, AndroidOverlayMojoFactoryCB overlay_factory_cb,
RequestOverlayInfoCB request_overlay_info_cb, RequestOverlayInfoCB request_overlay_info_cb,
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
#include "media/base/overlay_info.h" #include "media/base/overlay_info.h"
#include "media/base/video_decoder.h" #include "media/base/video_decoder.h"
#include "media/gpu/android/android_video_surface_chooser.h" #include "media/gpu/android/android_video_surface_chooser.h"
#include "media/gpu/android/avda_codec_allocator.h" #include "media/gpu/android/codec_allocator.h"
#include "media/gpu/android/codec_wrapper.h" #include "media/gpu/android/codec_wrapper.h"
#include "media/gpu/android/device_info.h" #include "media/gpu/android/device_info.h"
#include "media/gpu/android/surface_chooser_helper.h" #include "media/gpu/android/surface_chooser_helper.h"
...@@ -48,14 +48,13 @@ struct PendingDecode { ...@@ -48,14 +48,13 @@ struct PendingDecode {
// playbacks that need them. // playbacks that need them.
// TODO: Lazy initialization should be handled at a higher layer of the media // TODO: Lazy initialization should be handled at a higher layer of the media
// stack for both simplicity and cross platform support. // stack for both simplicity and cross platform support.
class MEDIA_GPU_EXPORT MediaCodecVideoDecoder class MEDIA_GPU_EXPORT MediaCodecVideoDecoder : public VideoDecoder,
: public VideoDecoder, public CodecAllocatorClient {
public AVDACodecAllocatorClient {
public: public:
MediaCodecVideoDecoder( MediaCodecVideoDecoder(
const gpu::GpuPreferences& gpu_preferences, const gpu::GpuPreferences& gpu_preferences,
DeviceInfo* device_info, DeviceInfo* device_info,
AVDACodecAllocator* codec_allocator, CodecAllocator* codec_allocator,
std::unique_ptr<AndroidVideoSurfaceChooser> surface_chooser, std::unique_ptr<AndroidVideoSurfaceChooser> surface_chooser,
AndroidOverlayMojoFactoryCB overlay_factory_cb, AndroidOverlayMojoFactoryCB overlay_factory_cb,
RequestOverlayInfoCB request_overlay_info_cb, RequestOverlayInfoCB request_overlay_info_cb,
...@@ -141,7 +140,7 @@ class MEDIA_GPU_EXPORT MediaCodecVideoDecoder ...@@ -141,7 +140,7 @@ class MEDIA_GPU_EXPORT MediaCodecVideoDecoder
// Creates a codec asynchronously. // Creates a codec asynchronously.
void CreateCodec(); void CreateCodec();
// AVDACodecAllocatorClient implementation. // CodecAllocatorClient implementation.
void OnCodecConfigured( void OnCodecConfigured(
std::unique_ptr<MediaCodecBridge> media_codec, std::unique_ptr<MediaCodecBridge> media_codec,
scoped_refptr<AVDASurfaceBundle> surface_bundle) override; scoped_refptr<AVDASurfaceBundle> surface_bundle) override;
...@@ -234,7 +233,7 @@ class MEDIA_GPU_EXPORT MediaCodecVideoDecoder ...@@ -234,7 +233,7 @@ class MEDIA_GPU_EXPORT MediaCodecVideoDecoder
std::unique_ptr<CodecWrapper> codec_; std::unique_ptr<CodecWrapper> codec_;
base::ElapsedTimer idle_timer_; base::ElapsedTimer idle_timer_;
base::RepeatingTimer pump_codec_timer_; base::RepeatingTimer pump_codec_timer_;
AVDACodecAllocator* codec_allocator_; CodecAllocator* codec_allocator_;
// The current target surface that |codec_| should be rendering to. It // The current target surface that |codec_| should be rendering to. It
// reflects the latest surface choice by |surface_chooser_|. If the codec is // reflects the latest surface choice by |surface_chooser_|. If the codec is
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
#include "media/gpu/android/android_video_decode_accelerator.h" #include "media/gpu/android/android_video_decode_accelerator.h"
#include "media/gpu/android/android_video_surface_chooser_impl.h" #include "media/gpu/android/android_video_surface_chooser_impl.h"
#include "media/gpu/android/avda_codec_allocator.h" #include "media/gpu/android/codec_allocator.h"
#include "media/gpu/android/device_info.h" #include "media/gpu/android/device_info.h"
#endif #endif
#if BUILDFLAG(USE_VAAPI) #if BUILDFLAG(USE_VAAPI)
...@@ -266,7 +266,7 @@ GpuVideoDecodeAcceleratorFactory::CreateAndroidVDA( ...@@ -266,7 +266,7 @@ GpuVideoDecodeAcceleratorFactory::CreateAndroidVDA(
MediaLog* media_log) const { MediaLog* media_log) const {
std::unique_ptr<VideoDecodeAccelerator> decoder; std::unique_ptr<VideoDecodeAccelerator> decoder;
decoder.reset(new AndroidVideoDecodeAccelerator( decoder.reset(new AndroidVideoDecodeAccelerator(
AVDACodecAllocator::GetInstance(base::ThreadTaskRunnerHandle::Get()), CodecAllocator::GetInstance(base::ThreadTaskRunnerHandle::Get()),
std::make_unique<AndroidVideoSurfaceChooserImpl>( std::make_unique<AndroidVideoSurfaceChooserImpl>(
DeviceInfo::GetInstance()->IsSetOutputSurfaceSupported()), DeviceInfo::GetInstance()->IsSetOutputSurfaceSupported()),
make_context_current_cb_, get_context_group_cb_, overlay_factory_cb_, make_context_current_cb_, get_context_group_cb_, overlay_factory_cb_,
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "media/base/android/android_cdm_factory.h" #include "media/base/android/android_cdm_factory.h"
#include "media/filters/android/media_codec_audio_decoder.h" #include "media/filters/android/media_codec_audio_decoder.h"
#include "media/gpu/android/android_video_surface_chooser_impl.h" #include "media/gpu/android/android_video_surface_chooser_impl.h"
#include "media/gpu/android/avda_codec_allocator.h" #include "media/gpu/android/codec_allocator.h"
#include "media/gpu/android/media_codec_video_decoder.h" #include "media/gpu/android/media_codec_video_decoder.h"
#include "media/gpu/android/video_frame_factory_impl.h" #include "media/gpu/android/video_frame_factory_impl.h"
#include "media/mojo/interfaces/media_drm_storage.mojom.h" #include "media/mojo/interfaces/media_drm_storage.mojom.h"
...@@ -138,7 +138,7 @@ std::unique_ptr<VideoDecoder> GpuMojoMediaClient::CreateVideoDecoder( ...@@ -138,7 +138,7 @@ std::unique_ptr<VideoDecoder> GpuMojoMediaClient::CreateVideoDecoder(
command_buffer_id->channel_token, command_buffer_id->route_id); command_buffer_id->channel_token, command_buffer_id->route_id);
return std::make_unique<MediaCodecVideoDecoder>( return std::make_unique<MediaCodecVideoDecoder>(
gpu_preferences_, DeviceInfo::GetInstance(), gpu_preferences_, DeviceInfo::GetInstance(),
AVDACodecAllocator::GetInstance(gpu_task_runner_), CodecAllocator::GetInstance(gpu_task_runner_),
std::make_unique<AndroidVideoSurfaceChooserImpl>( std::make_unique<AndroidVideoSurfaceChooserImpl>(
DeviceInfo::GetInstance()->IsSetOutputSurfaceSupported()), DeviceInfo::GetInstance()->IsSetOutputSurfaceSupported()),
android_overlay_factory_cb_, std::move(request_overlay_info_cb), android_overlay_factory_cb_, std::move(request_overlay_info_cb),
......
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