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 3bcfe211bc1861f01018c621378200aa12bff35b..88676b3a848758250cc813cb0b21fa21a9a87a09 100644 |
--- a/content/common/gpu/media/vaapi_video_decode_accelerator.cc |
+++ b/content/common/gpu/media/vaapi_video_decode_accelerator.cc |
@@ -292,10 +292,9 @@ VaapiPicture* VaapiVideoDecodeAccelerator::PictureById( |
} |
VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( |
- const MakeContextCurrentCallback& make_context_current, |
- const BindImageCallback& bind_image) |
- : make_context_current_(make_context_current), |
- state_(kUninitialized), |
+ const MakeGLContextCurrentCallback& make_context_current_cb, |
+ const BindGLImageCallback& bind_image_cb) |
+ : state_(kUninitialized), |
input_ready_(&lock_), |
surfaces_available_(&lock_), |
message_loop_(base::MessageLoop::current()), |
@@ -305,7 +304,8 @@ VaapiVideoDecodeAccelerator::VaapiVideoDecodeAccelerator( |
finish_flush_pending_(false), |
awaiting_va_surfaces_recycle_(false), |
requested_num_pics_(0), |
- bind_image_(bind_image), |
+ make_context_current_cb_(make_context_current_cb), |
+ bind_image_cb_(bind_image_cb), |
weak_this_factory_(this) { |
weak_this_ = weak_this_factory_.GetWeakPtr(); |
va_surface_release_cb_ = media::BindToCurrentLoop( |
@@ -320,6 +320,11 @@ bool VaapiVideoDecodeAccelerator::Initialize(const Config& config, |
Client* client) { |
DCHECK_EQ(message_loop_, base::MessageLoop::current()); |
+ if (make_context_current_cb_.is_null() || bind_image_cb_.is_null()) { |
+ NOTREACHED() << "GL callbacks are required for this VDA"; |
+ return false; |
+ } |
+ |
if (config.is_encrypted) { |
NOTREACHED() << "Encrypted streams are not supported for this VDA"; |
return false; |
@@ -742,14 +747,16 @@ void VaapiVideoDecodeAccelerator::AssignPictureBuffers( |
<< " VASurfaceID: " << va_surface_ids[i]; |
linked_ptr<VaapiPicture> picture(VaapiPicture::CreatePicture( |
- vaapi_wrapper_, make_context_current_, buffers[i].id(), |
+ vaapi_wrapper_, make_context_current_cb_, buffers[i].id(), |
buffers[i].texture_ids()[0], requested_pic_size_)); |
scoped_refptr<gl::GLImage> image = picture->GetImageToBind(); |
if (image) { |
DCHECK_LE(1u, buffers[i].internal_texture_ids().size()); |
- bind_image_.Run(buffers[i].internal_texture_ids()[0], |
- VaapiPicture::GetGLTextureTarget(), image, true); |
+ RETURN_AND_NOTIFY_ON_FAILURE( |
+ bind_image_cb_.Run(buffers[i].internal_texture_ids()[0], |
+ VaapiPicture::GetGLTextureTarget(), image, true), |
+ "Failed to bind image", PLATFORM_FAILURE, ); |
} |
RETURN_AND_NOTIFY_ON_FAILURE( |
@@ -964,7 +971,9 @@ void VaapiVideoDecodeAccelerator::Destroy() { |
delete this; |
} |
-bool VaapiVideoDecodeAccelerator::CanDecodeOnIOThread() { |
+bool VaapiVideoDecodeAccelerator::TryToSetupDecodeOnSeparateThread( |
+ const base::WeakPtr<Client>& decode_client, |
+ const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) { |
return false; |
} |