Index: content/common/gpu/media/vt_video_decode_accelerator_mac.cc |
diff --git a/content/common/gpu/media/vt_video_decode_accelerator_mac.cc b/content/common/gpu/media/vt_video_decode_accelerator_mac.cc |
index 144605ec3d3f744ec91bf27e1355d77caa944af6..c54be9920d6f14b35085eed87ca24b05f12e4741 100644 |
--- a/content/common/gpu/media/vt_video_decode_accelerator_mac.cc |
+++ b/content/common/gpu/media/vt_video_decode_accelerator_mac.cc |
@@ -295,11 +295,10 @@ bool VTVideoDecodeAccelerator::FrameOrder::operator()( |
} |
VTVideoDecodeAccelerator::VTVideoDecodeAccelerator( |
- const base::Callback<bool(void)>& make_context_current, |
- const base::Callback<void(uint32_t, uint32_t, scoped_refptr<gl::GLImage>)>& |
- bind_image) |
- : make_context_current_(make_context_current), |
- bind_image_(bind_image), |
+ const gpu_vda_helpers::MakeGLContextCurrentCb& make_context_current_cb, |
+ const gpu_vda_helpers::BindGLImageCb& bind_image_cb) |
+ : make_context_current_cb_(make_context_current_cb), |
+ bind_image_cb_(bind_image_cb), |
client_(nullptr), |
state_(STATE_DECODING), |
format_(nullptr), |
@@ -311,7 +310,6 @@ VTVideoDecodeAccelerator::VTVideoDecodeAccelerator( |
gpu_task_runner_(base::ThreadTaskRunnerHandle::Get()), |
decoder_thread_("VTDecoderThread"), |
weak_this_factory_(this) { |
- DCHECK(!make_context_current_.is_null()); |
callback_.decompressionOutputCallback = OutputThunk; |
callback_.decompressionOutputRefCon = this; |
weak_this_ = weak_this_factory_.GetWeakPtr(); |
@@ -325,6 +323,11 @@ bool VTVideoDecodeAccelerator::Initialize(const Config& config, |
Client* client) { |
DCHECK(gpu_thread_checker_.CalledOnValidThread()); |
+ 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; |
@@ -1037,7 +1040,7 @@ bool VTVideoDecodeAccelerator::SendFrame(const Frame& frame) { |
DCHECK(!picture_info->cv_image); |
DCHECK(!picture_info->gl_image); |
- if (!make_context_current_.Run()) { |
+ if (!make_context_current_cb_.Run()) { |
DLOG(ERROR) << "Failed to make GL context current"; |
NotifyError(PLATFORM_FAILURE, SFT_PLATFORM_ERROR); |
return false; |
@@ -1076,8 +1079,12 @@ bool VTVideoDecodeAccelerator::SendFrame(const Frame& frame) { |
} else { |
gl_image = nullptr; |
} |
- bind_image_.Run(picture_info->client_texture_id, GL_TEXTURE_RECTANGLE_ARB, |
- gl_image); |
+ if (!bind_image_cb_.Run(picture_info->client_texture_id, |
+ GL_TEXTURE_RECTANGLE_ARB, gl_image)) { |
+ DLOG(ERROR) << "Failed to bind image"; |
+ NotifyError(PLATFORM_FAILURE, SFT_PLATFORM_ERROR); |
+ return false; |
+ } |
// Assign the new image(s) to the the picture info. |
picture_info->gl_image = gl_image; |
@@ -1154,7 +1161,9 @@ void VTVideoDecodeAccelerator::Destroy() { |
QueueFlush(TASK_DESTROY); |
} |
-bool VTVideoDecodeAccelerator::CanDecodeOnIOThread() { |
+bool VTVideoDecodeAccelerator::TryInitializeDecodeOnSeparateThread( |
+ const base::WeakPtr<Client>& decode_client, |
+ const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) { |
return false; |
} |