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

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

Issue 1432963003: [Ozone] Extends the lifetime of VaapiWrapper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Extends the lifetime of VaapiWrapper Created 5 years, 1 month 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 036bee4f61d7c05ab8c02749fe8d8343eb3f478c..3a5f6fc6c59eabf4bc86eb5d038db7973178ee18 100644
--- a/content/common/gpu/media/vaapi_wrapper.h
+++ b/content/common/gpu/media/vaapi_wrapper.h
@@ -31,6 +31,10 @@
#include "third_party/libva/va/va_x11.h"
#endif // USE_X11
+namespace ui {
+class NativePixmap;
+}
+
namespace content {
// This class handles VA-API calls and ensures proper locking of VA-API calls
@@ -43,7 +47,8 @@ namespace content {
// It is also responsible for managing and freeing VABuffers (not VASurfaces),
// which are used to queue parameters and slice data to the HW codec,
// as well as underlying memory for VASurfaces themselves.
-class CONTENT_EXPORT VaapiWrapper {
+class CONTENT_EXPORT VaapiWrapper
+ : public base::RefCountedThreadSafe<VaapiWrapper> {
public:
enum CodecMode {
kDecode,
@@ -54,7 +59,7 @@ class CONTENT_EXPORT VaapiWrapper {
// Return an instance of VaapiWrapper initialized for |va_profile| and
// |mode|. |report_error_to_uma_cb| will be called independently from
// reporting errors to clients via method return values.
- static scoped_ptr<VaapiWrapper> Create(
+ static scoped_refptr<VaapiWrapper> Create(
CodecMode mode,
VAProfile va_profile,
const base::Closure& report_error_to_uma_cb);
@@ -63,7 +68,7 @@ class CONTENT_EXPORT VaapiWrapper {
// |profile| to VAProfile.
// |report_error_to_uma_cb| will be called independently from reporting
// errors to clients via method return values.
- static scoped_ptr<VaapiWrapper> CreateForVideoCodec(
+ static scoped_refptr<VaapiWrapper> CreateForVideoCodec(
CodecMode mode,
media::VideoCodecProfile profile,
const base::Closure& report_error_to_uma_cb);
@@ -106,6 +111,13 @@ class CONTENT_EXPORT VaapiWrapper {
const gfx::Size& size,
const std::vector<VASurfaceAttrib>& va_attribs);
+ // Create a VASurface for |pixmap| of |pixmap_size|. The ownership of the
+ // surface is transferred to the caller. It differs from surfaces created
+ // using CreateSurfaces(), where VaapiWrapper is the owner of the surfaces.
+ scoped_refptr<VASurface> CreateVASurfaceForPixmap(
+ scoped_refptr<ui::NativePixmap> pixmap,
Pawel Osciak 2015/11/20 10:09:18 const&
william.xie1 2015/11/23 03:33:58 Done.
+ gfx::Size pixmap_size);
Pawel Osciak 2015/11/20 10:09:18 const&
william.xie1 2015/11/23 03:33:58 Done.
+
// Submit parameters or slice data of |va_buffer_type|, copying them from
// |buffer| of size |size|, into HW codec. The data in |buffer| is no
// longer needed and can be freed after this method returns.
@@ -198,6 +210,12 @@ class CONTENT_EXPORT VaapiWrapper {
// Get the created surfaces format.
unsigned int va_surface_format() const { return va_surface_format_; }
+ // Map gfx::BufferFormat value to VA FOURCC value.
+ static uint32_t BufferFormatToVAFourCC(gfx::BufferFormat fmt);
Pawel Osciak 2015/11/20 10:09:18 These methods don't need to be members of the clas
william.xie1 2015/11/23 03:33:58 Done.
+
+ // Map gfx::BufferFormat value to VA render target format value.
+ static uint32_t BufferFormatToVARTFormat(gfx::BufferFormat fmt);
+
private:
struct ProfileInfo {
VAProfile va_profile;

Powered by Google App Engine
This is Rietveld 408576698