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

Unified Diff: content/common/gpu/media/gpu_video_decode_accelerator.cc

Issue 1796633002: Revert of content gpu refactor: get rid of gpu related content switches. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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
Index: content/common/gpu/media/gpu_video_decode_accelerator.cc
diff --git a/content/common/gpu/media/gpu_video_decode_accelerator.cc b/content/common/gpu/media/gpu_video_decode_accelerator.cc
index 2bab173172258ee37150897fcf6ab5848ca0d954..0d57d4ab1c6a7e6fe2748f1e19bd1a4f40eedb1c 100644
--- a/content/common/gpu/media/gpu_video_decode_accelerator.cc
+++ b/content/common/gpu/media/gpu_video_decode_accelerator.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/memory/ref_counted.h"
@@ -16,11 +17,10 @@
#include "build/build_config.h"
#include "content/common/gpu/gpu_channel.h"
-#include "content/common/gpu/gpu_channel_manager.h"
#include "content/common/gpu/media/gpu_video_accelerator_util.h"
#include "content/common/gpu/media/media_messages.h"
+#include "content/public/common/content_switches.h"
#include "gpu/command_buffer/common/command_buffer.h"
-#include "gpu/command_buffer/service/gpu_preferences.h"
#include "ipc/ipc_message_macros.h"
#include "ipc/ipc_message_utils.h"
#include "ipc/message_filter.h"
@@ -152,10 +152,10 @@
// static
gpu::VideoDecodeAcceleratorCapabilities
-GpuVideoDecodeAccelerator::GetCapabilities(
- const gpu::GpuPreferences& gpu_preferences) {
+GpuVideoDecodeAccelerator::GetCapabilities() {
media::VideoDecodeAccelerator::Capabilities capabilities;
- if (gpu_preferences.disable_accelerated_video_decode)
+ const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess();
+ if (cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode))
return gpu::VideoDecodeAcceleratorCapabilities();
// Query supported profiles for each VDA. The order of querying VDAs should
@@ -329,11 +329,6 @@
bool GpuVideoDecodeAccelerator::Initialize(
const media::VideoDecodeAccelerator::Config& config) {
- const gpu::GpuPreferences& gpu_preferences =
- stub_->channel()->gpu_channel_manager()->gpu_preferences();
- if (gpu_preferences.disable_accelerated_video_decode)
- return false;
-
DCHECK(!video_decode_accelerator_);
if (!stub_->channel()->AddRoute(host_route_id_, stub_->stream_id(), this)) {
@@ -353,26 +348,13 @@
// platform. This list is ordered by priority of use and it should be the
// same as the order of querying supported profiles of VDAs.
const GpuVideoDecodeAccelerator::CreateVDAFp create_vda_fps[] = {
-#if defined(OS_WIN)
- &GpuVideoDecodeAccelerator::CreateDXVAVDA,
-#endif
-#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
- &GpuVideoDecodeAccelerator::CreateV4L2VDA,
- &GpuVideoDecodeAccelerator::CreateV4L2SliceVDA,
-#endif
-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
- &GpuVideoDecodeAccelerator::CreateVaapiVDA,
-#endif
-#if defined(OS_MACOSX)
- &GpuVideoDecodeAccelerator::CreateVTVDA,
-#endif
-#if !defined(OS_CHROMEOS) && defined(USE_OZONE)
- &GpuVideoDecodeAccelerator::CreateOzoneVDA,
-#endif
-#if defined(OS_ANDROID)
- &GpuVideoDecodeAccelerator::CreateAndroidVDA,
-#endif
- };
+ &GpuVideoDecodeAccelerator::CreateDXVAVDA,
+ &GpuVideoDecodeAccelerator::CreateV4L2VDA,
+ &GpuVideoDecodeAccelerator::CreateV4L2SliceVDA,
+ &GpuVideoDecodeAccelerator::CreateVaapiVDA,
+ &GpuVideoDecodeAccelerator::CreateVTVDA,
+ &GpuVideoDecodeAccelerator::CreateOzoneVDA,
+ &GpuVideoDecodeAccelerator::CreateAndroidVDA};
for (const auto& create_vda_function : create_vda_fps) {
video_decode_accelerator_ = (this->*create_vda_function)();
@@ -392,28 +374,25 @@
return false;
}
-#if defined(OS_WIN)
scoped_ptr<media::VideoDecodeAccelerator>
GpuVideoDecodeAccelerator::CreateDXVAVDA() {
scoped_ptr<media::VideoDecodeAccelerator> decoder;
- const gpu::GpuPreferences& gpu_preferences =
- stub_->channel()->gpu_channel_manager()->gpu_preferences();
+#if defined(OS_WIN)
if (base::win::GetVersion() >= base::win::VERSION_WIN7) {
DVLOG(0) << "Initializing DXVA HW decoder for windows.";
- decoder.reset(new DXVAVideoDecodeAccelerator(
- make_context_current_, stub_->decoder()->GetGLContext(),
- gpu_preferences.enable_accelerated_vpx_decode));
+ decoder.reset(new DXVAVideoDecodeAccelerator(make_context_current_,
+ stub_->decoder()->GetGLContext()));
} else {
NOTIMPLEMENTED() << "HW video decode acceleration not available.";
}
+#endif
return decoder;
}
-#endif
-
-#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
+
scoped_ptr<media::VideoDecodeAccelerator>
GpuVideoDecodeAccelerator::CreateV4L2VDA() {
scoped_ptr<media::VideoDecodeAccelerator> decoder;
+#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
if (device.get()) {
decoder.reset(new V4L2VideoDecodeAccelerator(
@@ -424,12 +403,14 @@
device,
io_task_runner_));
}
+#endif
return decoder;
}
scoped_ptr<media::VideoDecodeAccelerator>
GpuVideoDecodeAccelerator::CreateV4L2SliceVDA() {
scoped_ptr<media::VideoDecodeAccelerator> decoder;
+#if defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC)
scoped_refptr<V4L2Device> device = V4L2Device::Create(V4L2Device::kDecoder);
if (device.get()) {
decoder.reset(new V4L2SliceVideoDecodeAccelerator(
@@ -440,11 +421,10 @@
make_context_current_,
io_task_runner_));
}
+#endif
return decoder;
}
-#endif
-
-#if (defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)) || defined(OS_MACOSX)
+
void GpuVideoDecodeAccelerator::BindImage(uint32_t client_texture_id,
uint32_t texture_target,
scoped_refptr<gl::GLImage> image) {
@@ -457,48 +437,49 @@
gpu::gles2::Texture::BOUND);
}
}
-#endif
-
-#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
+
scoped_ptr<media::VideoDecodeAccelerator>
GpuVideoDecodeAccelerator::CreateVaapiVDA() {
- return make_scoped_ptr<media::VideoDecodeAccelerator>(
- new VaapiVideoDecodeAccelerator(
- make_context_current_,
- base::Bind(&GpuVideoDecodeAccelerator::BindImage,
- base::Unretained(this))));
-}
-#endif
-
-#if defined(OS_MACOSX)
+ scoped_ptr<media::VideoDecodeAccelerator> decoder;
+#if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
+ decoder.reset(new VaapiVideoDecodeAccelerator(
+ make_context_current_, base::Bind(&GpuVideoDecodeAccelerator::BindImage,
+ base::Unretained(this))));
+#endif
+ return decoder;
+}
+
scoped_ptr<media::VideoDecodeAccelerator>
GpuVideoDecodeAccelerator::CreateVTVDA() {
- return make_scoped_ptr<media::VideoDecodeAccelerator>(
- new VTVideoDecodeAccelerator(
- make_context_current_,
- base::Bind(&GpuVideoDecodeAccelerator::BindImage,
- base::Unretained(this))));
-}
-#endif
-
-#if !defined(OS_CHROMEOS) && defined(USE_OZONE)
+ scoped_ptr<media::VideoDecodeAccelerator> decoder;
+#if defined(OS_MACOSX)
+ decoder.reset(new VTVideoDecodeAccelerator(
+ make_context_current_, base::Bind(&GpuVideoDecodeAccelerator::BindImage,
+ base::Unretained(this))));
+#endif
+ return decoder;
+}
+
scoped_ptr<media::VideoDecodeAccelerator>
GpuVideoDecodeAccelerator::CreateOzoneVDA() {
+ scoped_ptr<media::VideoDecodeAccelerator> decoder;
+#if !defined(OS_CHROMEOS) && defined(USE_OZONE)
media::MediaOzonePlatform* platform =
media::MediaOzonePlatform::GetInstance();
- return make_scoped_ptr<media::VideoDecodeAccelerator>(
- platform->CreateVideoDecodeAccelerator(make_context_current_));
-}
-#endif
-
-#if defined(OS_ANDROID)
+ decoder.reset(platform->CreateVideoDecodeAccelerator(make_context_current_));
+#endif
+ return decoder;
+}
+
scoped_ptr<media::VideoDecodeAccelerator>
GpuVideoDecodeAccelerator::CreateAndroidVDA() {
- return make_scoped_ptr<media::VideoDecodeAccelerator>(
- new AndroidVideoDecodeAccelerator(stub_->decoder()->AsWeakPtr(),
- make_context_current_));
-}
-#endif
+ scoped_ptr<media::VideoDecodeAccelerator> decoder;
+#if defined(OS_ANDROID)
+ decoder.reset(new AndroidVideoDecodeAccelerator(stub_->decoder()->AsWeakPtr(),
+ make_context_current_));
+#endif
+ return decoder;
+}
void GpuVideoDecodeAccelerator::OnSetCdm(int cdm_id) {
DCHECK(video_decode_accelerator_);
« no previous file with comments | « content/common/gpu/media/gpu_video_decode_accelerator.h ('k') | content/common/gpu/media/gpu_video_encode_accelerator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698