summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwuchengli <wuchengli@chromium.org>2014-10-23 21:54:15 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-24 04:54:36 +0000
commit6dd8cbfeb1b6df605d24988264c775af25ac595b (patch)
tree9e85ed88b4b83471eeb7124cbee84d85cad19e91
parentb9f5c40b0e3252fe2ba8fe1ce8ee347f9e0b78ab (diff)
downloadchromium_src-6dd8cbfeb1b6df605d24988264c775af25ac595b.zip
chromium_src-6dd8cbfeb1b6df605d24988264c775af25ac595b.tar.gz
chromium_src-6dd8cbfeb1b6df605d24988264c775af25ac595b.tar.bz2
Duplicate VideoEncodeAccelerator::SupportedProfile in gpu_info.h.
gpu_info.h depended on media/video and media/ depended on gpu/. gpu/ and media/ had a dependency cycle. Duplicate VEA::SupportedProfile to gpu_info.h so gpu does not depend on media. BUG=420801 TEST=Run apprtc loopback and ensure it uses HW encoder. Review URL: https://codereview.chromium.org/668633002 Cr-Commit-Position: refs/heads/master@{#301048}
-rw-r--r--content/common/gpu/client/gpu_video_encode_accelerator_host.cc44
-rw-r--r--content/common/gpu/client/gpu_video_encode_accelerator_host.h5
-rw-r--r--content/common/gpu/gpu_messages.h5
-rw-r--r--content/common/gpu/media/gpu_video_encode_accelerator.cc23
-rw-r--r--content/common/gpu/media/gpu_video_encode_accelerator.h8
-rw-r--r--content/renderer/media/renderer_gpu_video_accelerator_factories.cc6
-rw-r--r--gpu/config/DEPS1
-rw-r--r--gpu/config/gpu_info.cc4
-rw-r--r--gpu/config/gpu_info.h34
-rw-r--r--media/base/video_decoder_config.h3
10 files changed, 117 insertions, 16 deletions
diff --git a/content/common/gpu/client/gpu_video_encode_accelerator_host.cc b/content/common/gpu/client/gpu_video_encode_accelerator_host.cc
index c33e270..026040f 100644
--- a/content/common/gpu/client/gpu_video_encode_accelerator_host.cc
+++ b/content/common/gpu/client/gpu_video_encode_accelerator_host.cc
@@ -74,7 +74,49 @@ GpuVideoEncodeAcceleratorHost::GetSupportedProfiles() {
DCHECK(CalledOnValidThread());
if (!channel_)
return std::vector<media::VideoEncodeAccelerator::SupportedProfile>();
- return channel_->gpu_info().video_encode_accelerator_supported_profiles;
+ return ConvertGpuToMediaProfiles(
+ channel_->gpu_info().video_encode_accelerator_supported_profiles);
+}
+
+// Make sure the enum values of media::VideoCodecProfile and
+// gpu::VideoCodecProfile match.
+#define STATIC_ASSERT_ENUM_MATCH(name) \
+ static_assert( \
+ media::name == static_cast<media::VideoCodecProfile>(gpu::name), \
+ #name " value must match in media and gpu.")
+
+STATIC_ASSERT_ENUM_MATCH(VIDEO_CODEC_PROFILE_UNKNOWN);
+STATIC_ASSERT_ENUM_MATCH(VIDEO_CODEC_PROFILE_MIN);
+STATIC_ASSERT_ENUM_MATCH(H264PROFILE_BASELINE);
+STATIC_ASSERT_ENUM_MATCH(H264PROFILE_MAIN);
+STATIC_ASSERT_ENUM_MATCH(H264PROFILE_EXTENDED);
+STATIC_ASSERT_ENUM_MATCH(H264PROFILE_HIGH);
+STATIC_ASSERT_ENUM_MATCH(H264PROFILE_HIGH10PROFILE);
+STATIC_ASSERT_ENUM_MATCH(H264PROFILE_HIGH422PROFILE);
+STATIC_ASSERT_ENUM_MATCH(H264PROFILE_HIGH444PREDICTIVEPROFILE);
+STATIC_ASSERT_ENUM_MATCH(H264PROFILE_SCALABLEBASELINE);
+STATIC_ASSERT_ENUM_MATCH(H264PROFILE_SCALABLEHIGH);
+STATIC_ASSERT_ENUM_MATCH(H264PROFILE_STEREOHIGH);
+STATIC_ASSERT_ENUM_MATCH(H264PROFILE_MULTIVIEWHIGH);
+STATIC_ASSERT_ENUM_MATCH(VP8PROFILE_ANY);
+STATIC_ASSERT_ENUM_MATCH(VP9PROFILE_ANY);
+STATIC_ASSERT_ENUM_MATCH(VIDEO_CODEC_PROFILE_MAX);
+
+std::vector<media::VideoEncodeAccelerator::SupportedProfile>
+GpuVideoEncodeAcceleratorHost::ConvertGpuToMediaProfiles(const std::vector<
+ gpu::VideoEncodeAcceleratorSupportedProfile>& gpu_profiles) {
+ std::vector<media::VideoEncodeAccelerator::SupportedProfile> profiles;
+ for (size_t i = 0; i < gpu_profiles.size(); i++) {
+ media::VideoEncodeAccelerator::SupportedProfile profile;
+ profile.profile =
+ static_cast<media::VideoCodecProfile>(gpu_profiles[i].profile);
+ profile.max_resolution = gpu_profiles[i].max_resolution;
+ profile.max_framerate_numerator = gpu_profiles[i].max_framerate_numerator;
+ profile.max_framerate_denominator =
+ gpu_profiles[i].max_framerate_denominator;
+ profiles.push_back(profile);
+ }
+ return profiles;
}
bool GpuVideoEncodeAcceleratorHost::Initialize(
diff --git a/content/common/gpu/client/gpu_video_encode_accelerator_host.h b/content/common/gpu/client/gpu_video_encode_accelerator_host.h
index f4121ae..021eff4 100644
--- a/content/common/gpu/client/gpu_video_encode_accelerator_host.h
+++ b/content/common/gpu/client/gpu_video_encode_accelerator_host.h
@@ -12,6 +12,7 @@
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "content/common/gpu/client/command_buffer_proxy_impl.h"
+#include "gpu/config/gpu_info.h"
#include "ipc/ipc_listener.h"
#include "media/video/video_encode_accelerator.h"
@@ -44,6 +45,10 @@ class GpuVideoEncodeAcceleratorHost
GpuVideoEncodeAcceleratorHost(GpuChannelHost* channel,
CommandBufferProxyImpl* impl);
+ static std::vector<media::VideoEncodeAccelerator::SupportedProfile>
+ ConvertGpuToMediaProfiles(const std::vector<
+ gpu::VideoEncodeAcceleratorSupportedProfile>& gpu_profiles);
+
// IPC::Listener implementation.
bool OnMessageReceived(const IPC::Message& message) override;
void OnChannelError() override;
diff --git a/content/common/gpu/gpu_messages.h b/content/common/gpu/gpu_messages.h
index c15cc54a..075f248 100644
--- a/content/common/gpu/gpu_messages.h
+++ b/content/common/gpu/gpu_messages.h
@@ -64,6 +64,9 @@ IPC_ENUM_TRAITS_MIN_MAX_VALUE(media::VideoCodecProfile,
IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::CollectInfoResult,
gpu::kCollectInfoNone,
gpu::kCollectInfoFatalFailure)
+IPC_ENUM_TRAITS_MIN_MAX_VALUE(gpu::VideoCodecProfile,
+ gpu::VIDEO_CODEC_PROFILE_MIN,
+ gpu::VIDEO_CODEC_PROFILE_MAX)
IPC_STRUCT_BEGIN(GPUCreateCommandBufferConfig)
IPC_STRUCT_MEMBER(int32, share_group_id)
@@ -138,7 +141,7 @@ IPC_STRUCT_TRAITS_BEGIN(gpu::GPUInfo::GPUDevice)
IPC_STRUCT_TRAITS_MEMBER(device_string)
IPC_STRUCT_TRAITS_END()
-IPC_STRUCT_TRAITS_BEGIN(media::VideoEncodeAccelerator::SupportedProfile)
+IPC_STRUCT_TRAITS_BEGIN(gpu::VideoEncodeAcceleratorSupportedProfile)
IPC_STRUCT_TRAITS_MEMBER(profile)
IPC_STRUCT_TRAITS_MEMBER(max_resolution)
IPC_STRUCT_TRAITS_MEMBER(max_framerate_numerator)
diff --git a/content/common/gpu/media/gpu_video_encode_accelerator.cc b/content/common/gpu/media/gpu_video_encode_accelerator.cc
index 3fe89d3..12b473f 100644
--- a/content/common/gpu/media/gpu_video_encode_accelerator.cc
+++ b/content/common/gpu/media/gpu_video_encode_accelerator.cc
@@ -163,12 +163,29 @@ void GpuVideoEncodeAccelerator::OnWillDestroyStub() {
}
// static
-std::vector<media::VideoEncodeAccelerator::SupportedProfile>
+std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>
GpuVideoEncodeAccelerator::GetSupportedProfiles() {
scoped_ptr<media::VideoEncodeAccelerator> encoder = CreateEncoder();
if (!encoder)
- return std::vector<media::VideoEncodeAccelerator::SupportedProfile>();
- return encoder->GetSupportedProfiles();
+ return std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>();
+ return ConvertMediaToGpuProfiles(encoder->GetSupportedProfiles());
+}
+
+std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>
+GpuVideoEncodeAccelerator::ConvertMediaToGpuProfiles(const std::vector<
+ media::VideoEncodeAccelerator::SupportedProfile>& media_profiles) {
+ std::vector<gpu::VideoEncodeAcceleratorSupportedProfile> profiles;
+ for (size_t i = 0; i < media_profiles.size(); i++) {
+ gpu::VideoEncodeAcceleratorSupportedProfile profile;
+ profile.profile =
+ static_cast<gpu::VideoCodecProfile>(media_profiles[i].profile);
+ profile.max_resolution = media_profiles[i].max_resolution;
+ profile.max_framerate_numerator = media_profiles[i].max_framerate_numerator;
+ profile.max_framerate_denominator =
+ media_profiles[i].max_framerate_denominator;
+ profiles.push_back(profile);
+ }
+ return profiles;
}
scoped_ptr<media::VideoEncodeAccelerator>
diff --git a/content/common/gpu/media/gpu_video_encode_accelerator.h b/content/common/gpu/media/gpu_video_encode_accelerator.h
index 6f37abb..ca60f6f 100644
--- a/content/common/gpu/media/gpu_video_encode_accelerator.h
+++ b/content/common/gpu/media/gpu_video_encode_accelerator.h
@@ -10,6 +10,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "content/common/gpu/gpu_command_buffer_stub.h"
+#include "gpu/config/gpu_info.h"
#include "ipc/ipc_listener.h"
#include "media/video/video_encode_accelerator.h"
#include "ui/gfx/size.h"
@@ -58,8 +59,11 @@ class GpuVideoEncodeAccelerator
// Static query for supported profiles. This query calls the appropriate
// platform-specific version.
- static std::vector<media::VideoEncodeAccelerator::SupportedProfile>
- GetSupportedProfiles();
+ static std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>
+ GetSupportedProfiles();
+ static std::vector<gpu::VideoEncodeAcceleratorSupportedProfile>
+ ConvertMediaToGpuProfiles(const std::vector<
+ media::VideoEncodeAccelerator::SupportedProfile>& media_profiles);
private:
// Create the appropriate platform-specific VEA.
diff --git a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
index ad0f8cd..ab3d2f7 100644
--- a/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
+++ b/content/renderer/media/renderer_gpu_video_accelerator_factories.cc
@@ -12,6 +12,7 @@
#include "content/common/gpu/client/context_provider_command_buffer.h"
#include "content/common/gpu/client/gl_helper.h"
#include "content/common/gpu/client/gpu_channel_host.h"
+#include "content/common/gpu/client/gpu_video_encode_accelerator_host.h"
#include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h"
#include "content/renderer/render_thread_impl.h"
#include "gpu/command_buffer/client/gles2_implementation.h"
@@ -248,8 +249,9 @@ RendererGpuVideoAcceleratorFactories::GetTaskRunner() {
std::vector<media::VideoEncodeAccelerator::SupportedProfile>
RendererGpuVideoAcceleratorFactories::
GetVideoEncodeAcceleratorSupportedProfiles() {
- return gpu_channel_host_->gpu_info()
- .video_encode_accelerator_supported_profiles;
+ return GpuVideoEncodeAcceleratorHost::ConvertGpuToMediaProfiles(
+ gpu_channel_host_->gpu_info()
+ .video_encode_accelerator_supported_profiles);
}
} // namespace content
diff --git a/gpu/config/DEPS b/gpu/config/DEPS
index 7c0ee4b..39b325a 100644
--- a/gpu/config/DEPS
+++ b/gpu/config/DEPS
@@ -1,5 +1,4 @@
include_rules = [
"+third_party/libxml", # For parsing WinSAT results files.
"+third_party/libXNVCtrl", # For NV driver version query.
- "+media/video", # For VideoEncodeAccelerator::SupportedProfile.
]
diff --git a/gpu/config/gpu_info.cc b/gpu/config/gpu_info.cc
index c7951f9..f1f67ce 100644
--- a/gpu/config/gpu_info.cc
+++ b/gpu/config/gpu_info.cc
@@ -19,7 +19,7 @@ void EnumerateGPUDevice(gpu::GPUInfo::Enumerator* enumerator,
void EnumerateVideoEncodeAcceleratorSupportedProfile(
gpu::GPUInfo::Enumerator* enumerator,
- const media::VideoEncodeAccelerator::SupportedProfile profile) {
+ const gpu::VideoEncodeAcceleratorSupportedProfile profile) {
enumerator->BeginVideoEncodeAcceleratorSupportedProfile();
enumerator->AddInt("profile", profile.profile);
enumerator->AddInt("maxResolutionWidth", profile.max_resolution.width());
@@ -101,7 +101,7 @@ void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
CollectInfoResult dx_diagnostics_info_state;
DxDiagNode dx_diagnostics;
#endif
- std::vector<media::VideoEncodeAccelerator::SupportedProfile>
+ std::vector<VideoEncodeAcceleratorSupportedProfile>
video_encode_accelerator_supported_profiles;
};
diff --git a/gpu/config/gpu_info.h b/gpu/config/gpu_info.h
index bdbb205..7c92d3a 100644
--- a/gpu/config/gpu_info.h
+++ b/gpu/config/gpu_info.h
@@ -18,7 +18,7 @@
#include "gpu/config/dx_diag_node.h"
#include "gpu/config/gpu_performance_stats.h"
#include "gpu/gpu_export.h"
-#include "media/video/video_encode_accelerator.h"
+#include "ui/gfx/geometry/size.h"
namespace gpu {
@@ -35,6 +35,34 @@ enum CollectInfoResult {
kCollectInfoFatalFailure = 3
};
+// Video profile. This *must* match media::VideoCodecProfile.
+enum VideoCodecProfile {
+ VIDEO_CODEC_PROFILE_UNKNOWN = -1,
+ VIDEO_CODEC_PROFILE_MIN = VIDEO_CODEC_PROFILE_UNKNOWN,
+ H264PROFILE_BASELINE = 0,
+ H264PROFILE_MAIN = 1,
+ H264PROFILE_EXTENDED = 2,
+ H264PROFILE_HIGH = 3,
+ H264PROFILE_HIGH10PROFILE = 4,
+ H264PROFILE_HIGH422PROFILE = 5,
+ H264PROFILE_HIGH444PREDICTIVEPROFILE = 6,
+ H264PROFILE_SCALABLEBASELINE = 7,
+ H264PROFILE_SCALABLEHIGH = 8,
+ H264PROFILE_STEREOHIGH = 9,
+ H264PROFILE_MULTIVIEWHIGH = 10,
+ VP8PROFILE_ANY = 11,
+ VP9PROFILE_ANY = 12,
+ VIDEO_CODEC_PROFILE_MAX = VP9PROFILE_ANY,
+};
+
+// Specification of an encoding profile supported by a hardware encoder.
+struct GPU_EXPORT VideoEncodeAcceleratorSupportedProfile {
+ VideoCodecProfile profile;
+ gfx::Size max_resolution;
+ uint32 max_framerate_numerator;
+ uint32 max_framerate_denominator;
+};
+
struct GPU_EXPORT GPUInfo {
struct GPU_EXPORT GPUDevice {
GPUDevice();
@@ -178,7 +206,7 @@ struct GPU_EXPORT GPUInfo {
DxDiagNode dx_diagnostics;
#endif
- std::vector<media::VideoEncodeAccelerator::SupportedProfile>
+ std::vector<VideoEncodeAcceleratorSupportedProfile>
video_encode_accelerator_supported_profiles;
// Note: when adding new members, please remember to update EnumerateFields
// in gpu_info.cc.
@@ -204,7 +232,7 @@ struct GPU_EXPORT GPUInfo {
virtual void BeginGPUDevice() = 0;
virtual void EndGPUDevice() = 0;
- // Markers indicating that a VideoEncodeAccelerator::SupportedProfile is
+ // Markers indicating that a VideoEncodeAcceleratorSupportedProfile is
// being described.
virtual void BeginVideoEncodeAcceleratorSupportedProfile() = 0;
virtual void EndVideoEncodeAcceleratorSupportedProfile() = 0;
diff --git a/media/base/video_decoder_config.h b/media/base/video_decoder_config.h
index 0954e05..5d01d08 100644
--- a/media/base/video_decoder_config.h
+++ b/media/base/video_decoder_config.h
@@ -37,7 +37,8 @@ enum VideoCodec {
};
// Video stream profile. This *must* match PP_VideoDecoder_Profile.
-// (enforced in webkit/plugins/ppapi/ppb_video_decoder_impl.cc)
+// (enforced in webkit/plugins/ppapi/ppb_video_decoder_impl.cc) and
+// gpu::VideoCodecProfile.
enum VideoCodecProfile {
// Keep the values in this enum unique, as they imply format (h.264 vs. VP8,
// for example), and keep the values for a particular format grouped