Index: content/common/gpu/media/vaapi_video_decode_accelerator.cc |
diff --git a/content/common/gpu/media/vaapi_video_decode_accelerator.cc b/content/common/gpu/media/vaapi_video_decode_accelerator.cc |
index 90c0cdda7124dca69be4e032e21bf41af8b79fd3..d24744d715fb386baa4787e4cfe65e22cf8b808e 100644 |
--- a/content/common/gpu/media/vaapi_video_decode_accelerator.cc |
+++ b/content/common/gpu/media/vaapi_video_decode_accelerator.cc |
@@ -15,6 +15,7 @@ |
#include "media/base/bind_to_current_loop.h" |
#include "media/video/picture.h" |
#include "ui/gl/gl_bindings.h" |
+#include "ui/gl/gl_image.h" |
static void ReportToUMA( |
content::VaapiH264Decoder::VAVDAH264DecoderFailure failure) { |
@@ -72,7 +73,9 @@ VaapiPicture* VaapiVideoDecodeAccelerator::PictureById( |
} |
VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( |
- const base::Callback<bool(void)>& make_context_current) |
+ const base::Callback<bool(void)>& make_context_current, |
+ const base::Callback<void(uint32, uint32, scoped_refptr<gfx::GLImage>)>& |
+ bind_image) |
: make_context_current_(make_context_current), |
state_(kUninitialized), |
input_ready_(&lock_), |
@@ -84,6 +87,7 @@ VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( |
finish_flush_pending_(false), |
awaiting_va_surfaces_recycle_(false), |
requested_num_pics_(0), |
+ bind_image_(bind_image), |
weak_this_factory_(this) { |
weak_this_ = weak_this_factory_.GetWeakPtr(); |
va_surface_release_cb_ = media::BindToCurrentLoop( |
@@ -186,8 +190,9 @@ void VaapiVideoDecodeAccelerator::OutputPicture( |
// TODO(posciak): Use visible size from decoder here instead |
// (crbug.com/402760). |
if (client_) |
- client_->PictureReady( |
- media::Picture(output_id, input_id, gfx::Rect(picture->size()), false)); |
+ client_->PictureReady(media::Picture(output_id, input_id, |
+ gfx::Rect(picture->size()), |
+ picture->AllowOverlay())); |
} |
void VaapiVideoDecodeAccelerator::TryOutputSurface() { |
@@ -525,6 +530,12 @@ void VaapiVideoDecodeAccelerator::AssignPictureBuffers( |
vaapi_wrapper_.get(), make_context_current_, buffers[i].id(), |
buffers[i].texture_id(), requested_pic_size_)); |
+ scoped_refptr<gfx::GLImage> image = picture->GetImageToBind(); |
+ if (image) { |
+ bind_image_.Run(buffers[i].internal_texture_id(), |
+ VaapiPicture::GetGLTextureTarget(), image); |
+ } |
+ |
RETURN_AND_NOTIFY_ON_FAILURE( |
picture.get(), "Failed assigning picture buffer to a texture.", |
PLATFORM_FAILURE, ); |