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

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

Issue 817023005: Reland: Refactor Vaapi video decoder/encoder in preparation of Freon support (Closed) Base URL: https://chromium.googlesource.com/chromium/src@master
Patch Set: Pawel's nits Created 6 years 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_video_decode_accelerator.h
diff --git a/content/common/gpu/media/vaapi_video_decode_accelerator.h b/content/common/gpu/media/vaapi_video_decode_accelerator.h
index 5d65da7a4ae4ae6ab4276f7475f4b639877eb30c..0366d93a1a6dedfb20aee7fa3af7665f0ded1a28 100644
--- a/content/common/gpu/media/vaapi_video_decode_accelerator.h
+++ b/content/common/gpu/media/vaapi_video_decode_accelerator.h
@@ -20,7 +20,6 @@
#include "base/message_loop/message_loop.h"
#include "base/synchronization/condition_variable.h"
#include "base/synchronization/lock.h"
-#include "base/threading/non_thread_safe.h"
#include "base/threading/thread.h"
#include "content/common/content_export.h"
#include "content/common/gpu/media/vaapi_h264_decoder.h"
@@ -28,10 +27,11 @@
#include "media/base/bitstream_buffer.h"
#include "media/video/picture.h"
#include "media/video/video_decode_accelerator.h"
-#include "ui/gl/gl_bindings.h"
namespace content {
+class VaapiPicture;
+
// Class to provide video decode acceleration for Intel systems with hardware
// support for it, and on which libva is available.
// Decoding tasks are performed in a separate decoding thread.
@@ -44,7 +44,6 @@ class CONTENT_EXPORT VaapiVideoDecodeAccelerator
: public media::VideoDecodeAccelerator {
public:
VaapiVideoDecodeAccelerator(
- Display* x_display,
const base::Callback<bool(void)>& make_context_current);
virtual ~VaapiVideoDecodeAccelerator();
@@ -123,16 +122,13 @@ private:
// |va_surface|.
void SurfaceReady(int32 input_id, const scoped_refptr<VASurface>& va_surface);
- // Represents a texture bound to an X Pixmap for output purposes.
- class TFPPicture;
-
// Callback to be executed once we have a |va_surface| to be output and
- // an available |tfp_picture| to use for output.
- // Puts contents of |va_surface| into given |tfp_picture|, releases the
+ // an available |picture| to use for output.
+ // Puts contents of |va_surface| into given |picture|, releases the
// surface and passes the resulting picture to client for output.
void OutputPicture(const scoped_refptr<VASurface>& va_surface,
int32 input_id,
- TFPPicture* tfp_picture);
+ VaapiPicture* picture);
// Try to OutputPicture() if we have both a ready surface and picture.
void TryOutputSurface();
@@ -148,10 +144,8 @@ private:
// Check if the surfaces have been released or post ourselves for later.
void TryFinishSurfaceSetChange();
- // Client-provided X/GLX state.
- Display* x_display_;
+ // Client-provided GL state.
base::Callback<bool(void)> make_context_current_;
- GLXFBConfig fb_config_;
// VAVDA state.
enum State {
@@ -196,13 +190,13 @@ private:
typedef std::queue<int32> OutputBuffers;
OutputBuffers output_buffers_;
- typedef std::map<int32, linked_ptr<TFPPicture> > TFPPictures;
- // All allocated TFPPictures, regardless of their current state. TFPPictures
- // are allocated once and destroyed at the end of decode.
- TFPPictures tfp_pictures_;
+ typedef std::map<int32, linked_ptr<VaapiPicture>> Pictures;
+ // All allocated Pictures, regardless of their current state.
+ // Pictures are allocated once and destroyed at the end of decode.
+ Pictures pictures_;
- // Return a TFPPicture associated with given client-provided id.
- TFPPicture* TFPPictureById(int32 picture_buffer_id);
+ // Return a VaapiPicture associated with given client-provided id.
+ VaapiPicture* PictureById(int32 picture_buffer_id);
// VA Surfaces no longer in use that can be passed back to the decoder for
// reuse, once it requests them.
@@ -212,15 +206,15 @@ private:
base::ConditionVariable surfaces_available_;
// Pending output requests from the decoder. When it indicates that we should
- // output a surface and we have an available TFPPicture (i.e. texture) ready
- // to use, we'll execute the callback passing the TFPPicture. The callback
+ // output a surface and we have an available Picture (i.e. texture) ready
+ // to use, we'll execute the callback passing the Picture. The callback
// will put the contents of the surface into the picture and return it to
// the client, releasing the surface as well.
- // If we don't have any available TFPPictures at the time when the decoder
+ // If we don't have any available Pictures at the time when the decoder
// requests output, we'll store the request on pending_output_cbs_ queue for
// later and run it once the client gives us more textures
// via ReusePictureBuffer().
- typedef base::Callback<void(TFPPicture*)> OutputCB;
+ typedef base::Callback<void(VaapiPicture*)> OutputCB;
std::queue<OutputCB> pending_output_cbs_;
// ChildThread's message loop
@@ -242,7 +236,7 @@ private:
scoped_ptr<base::WeakPtrFactory<Client> > client_ptr_factory_;
base::WeakPtr<Client> client_;
- scoped_ptr<VaapiWrapper> vaapi_wrapper_;
+ scoped_refptr<VaapiWrapper> vaapi_wrapper_;
// Comes after vaapi_wrapper_ to ensure its destructor is executed before
// vaapi_wrapper_ is destroyed.

Powered by Google App Engine
This is Rietveld 408576698