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

Unified Diff: content/common/gpu/media/vaapi_wrapper.h

Issue 872623002: VaapiVEA: Get maximum resolution from libva (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix nits Created 5 years, 10 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/vaapi_wrapper.h
diff --git a/content/common/gpu/media/vaapi_wrapper.h b/content/common/gpu/media/vaapi_wrapper.h
index d21f3f1ee5ec52ece294ce53594c01e4f7252846..cdd1ea2730149e0416da0ae2a130903cd83fab13 100644
--- a/content/common/gpu/media/vaapi_wrapper.h
+++ b/content/common/gpu/media/vaapi_wrapper.h
@@ -13,12 +13,14 @@
#include <set>
#include <vector>
+#include "base/lazy_instance.h"
#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#include "content/common/content_export.h"
#include "content/common/gpu/media/va_surface.h"
#include "media/base/video_decoder_config.h"
#include "media/base/video_frame.h"
+#include "media/video/video_encode_accelerator.h"
#include "third_party/libva/va/va.h"
#include "third_party/libva/va/va_vpp.h"
#include "ui/gfx/geometry/size.h"
@@ -43,14 +45,15 @@ class CONTENT_EXPORT VaapiWrapper {
enum CodecMode {
kDecode,
kEncode,
+ kCodecModeMax,
};
- // Create VaapiWrapper for VAProfile.
- // |report_error_to_uma_cb| will be called independently from reporting
- // errors to clients via method return values.
+ // Return an instance of VaapiWrapper and initialize by |va_profile| and
Pawel Osciak 2015/03/02 11:00:21 s/and initialize by/initialized for/
henryhsu 2015/03/03 10:48:03 Done.
+ // |mode|. |report_error_to_uma_cb| will be called independently from
+ // reporting errors to clients via method return values.
static scoped_ptr<VaapiWrapper> Create(
CodecMode mode,
- VAProfile profile,
+ VAProfile va_profile,
const base::Closure& report_error_to_uma_cb);
// Create VaapiWrapper for VideoCodecProfile. It maps VideoCodecProfile
@@ -63,8 +66,8 @@ class CONTENT_EXPORT VaapiWrapper {
const base::Closure& report_error_to_uma_cb);
// Return the supported encode profiles.
- static std::vector<media::VideoCodecProfile> GetSupportedEncodeProfiles(
- const base::Closure& report_error_to_uma_cb);
+ static std::vector<media::VideoEncodeAccelerator::SupportedProfile>
+ GetSupportedEncodeProfiles();
~VaapiWrapper();
@@ -183,8 +186,30 @@ class CONTENT_EXPORT VaapiWrapper {
const gfx::Size& dest_size);
private:
+ struct ProfileInfo {
+ VAProfile va_profile;
+ VaapiWrapper::CodecMode mode;
Pawel Osciak 2015/03/02 11:00:20 s/VaapiWrapper::// ?
henryhsu 2015/03/03 10:48:02 Done.
+ gfx::Size max_resolution;
+ };
+
+ class LazyProfileInfo {
wuchengli 2015/03/02 07:10:12 s/LazyProfileInfo/LazyProfileInfos/ to distinguish
henryhsu 2015/03/03 10:48:02 Done.
+ public:
+ LazyProfileInfo();
+ ~LazyProfileInfo();
+ std::vector<VaapiWrapper::ProfileInfo> GetSupportedProfileInfos(
Pawel Osciak 2015/03/02 11:00:21 Are VaapiWrapper:: prefixes needed?
henryhsu 2015/03/03 10:48:02 Done.
+ VaapiWrapper::CodecMode mode);
+ bool IsProfileSupported(
+ VaapiWrapper::CodecMode mode, VAProfile va_profile);
+ private:
+ std::vector<VaapiWrapper::ProfileInfo>
+ supported_profiles_[VaapiWrapper::kCodecModeMax];
+ };
+
VaapiWrapper();
+ // Initialize all supported profile configs.
+ static std::vector<ProfileInfo> InitSupportedProfileInfos();
wuchengli 2015/03/02 07:10:12 Move this near PostSandboxInitialization(). Static
henryhsu 2015/03/03 10:48:02 Done.
+
bool Initialize(CodecMode mode, VAProfile va_profile);
void Deinitialize();
bool VaInitialize(const base::Closure& report_error_to_uma_cb);
@@ -193,6 +218,7 @@ class CONTENT_EXPORT VaapiWrapper {
bool AreAttribsSupported(VAProfile va_profile,
VAEntrypoint entrypoint,
const std::vector<VAConfigAttrib>& required_attribs);
+ bool GetVaCodecMaxResolution(VAConfigID config, gfx::Size* resolution);
wuchengli 2015/03/02 07:10:12 Add function comments.
Pawel Osciak 2015/03/02 11:00:20 s/config/va_config_id/ Could we just return empty
henryhsu 2015/03/03 10:48:02 I prefer to return boolean value to consist with o
henryhsu 2015/03/03 10:48:02 Done.
// Destroys a |va_surface| created using CreateUnownedSurface.
void DestroyUnownedSurface(VASurfaceID va_surface_id);
@@ -212,6 +238,9 @@ class CONTENT_EXPORT VaapiWrapper {
// Attempt to set render mode to "render to texture.". Failure is non-fatal.
void TryToSetVADisplayAttributeToLocalGPU();
+ // Get all supported profile configs.
wuchengli 2015/03/02 07:10:12 s/configs/infos/
henryhsu 2015/03/03 10:48:02 Done.
+ std::vector<ProfileInfo> GetSupportedProfileInfos();
+
// Lazily initialize static data after sandbox is enabled. Return false on
// init failure.
static bool PostSandboxInitialization();
@@ -255,6 +284,8 @@ class CONTENT_EXPORT VaapiWrapper {
VAContextID va_vpp_context_id_;
VABufferID va_vpp_buffer_id_;
+ static base::LazyInstance<LazyProfileInfo> profile_info_;
wuchengli 2015/03/02 07:10:12 s/profile_info/profile_infos_/. Add variable comme
henryhsu 2015/03/03 10:48:02 Done.
+
DISALLOW_COPY_AND_ASSIGN(VaapiWrapper);
};

Powered by Google App Engine
This is Rietveld 408576698