Index: content/common/gpu/media/dxva_video_decode_accelerator_win.cc |
diff --git a/content/common/gpu/media/dxva_video_decode_accelerator_win.cc b/content/common/gpu/media/dxva_video_decode_accelerator_win.cc |
index adbc1055cecd4df580d2a8bb5ee1997b113d6b64..cfa3bea30d1e00fa4504752c4342eb81fb1a5191 100644 |
--- a/content/common/gpu/media/dxva_video_decode_accelerator_win.cc |
+++ b/content/common/gpu/media/dxva_video_decode_accelerator_win.cc |
@@ -675,8 +675,8 @@ DXVAVideoDecodeAccelerator::PendingSampleInfo::PendingSampleInfo( |
DXVAVideoDecodeAccelerator::PendingSampleInfo::~PendingSampleInfo() {} |
DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( |
- const base::Callback<bool(void)>& make_context_current, |
- gfx::GLContext* gl_context) |
+ const gpu_vda_helpers::GetGLContextCb& get_gl_context_cb, |
+ const gpu_vda_helpers::MakeGLContextCurrentCb& make_context_current_cb) |
: client_(NULL), |
dev_manager_reset_token_(0), |
dx11_dev_manager_reset_token_(0), |
@@ -685,14 +685,14 @@ DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( |
pictures_requested_(false), |
inputs_before_decode_(0), |
sent_drain_message_(false), |
- make_context_current_(make_context_current), |
+ get_gl_context_cb_(get_gl_context_cb), |
+ make_context_current_cb_(make_context_current_cb), |
codec_(media::kUnknownVideoCodec), |
decoder_thread_("DXVAVideoDecoderThread"), |
pending_flush_(false), |
use_dx11_(false), |
use_keyed_mutex_(false), |
dx11_video_format_converter_media_type_needs_init_(true), |
- gl_context_(gl_context), |
using_angle_device_(false), |
weak_this_factory_(this) { |
weak_ptr_ = weak_this_factory_.GetWeakPtr(); |
@@ -706,6 +706,11 @@ DXVAVideoDecodeAccelerator::~DXVAVideoDecodeAccelerator() { |
bool DXVAVideoDecodeAccelerator::Initialize(const Config& config, |
Client* client) { |
+ if (get_gl_context_cb_.is_null() || make_context_current_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; |
@@ -1066,7 +1071,7 @@ void DXVAVideoDecodeAccelerator::ReusePictureBuffer(int32_t picture_buffer_id) { |
base::Unretained(this))); |
} |
} else { |
- RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_.Run(), |
+ RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_cb_.Run(), |
"Failed to make context current", |
PLATFORM_FAILURE, ); |
it->second->ResetReuseFence(); |
@@ -1088,7 +1093,7 @@ void DXVAVideoDecodeAccelerator::WaitForOutputBuffer(int32_t picture_buffer_id, |
DCHECK(picture_buffer->waiting_to_reuse()); |
gfx::GLFence* fence = picture_buffer->reuse_fence(); |
- RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_.Run(), |
+ RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_cb_.Run(), |
"Failed to make context current", |
PLATFORM_FAILURE, ); |
if (count <= kMaxIterationsForANGLEReuseFlush && !fence->HasCompleted()) { |
@@ -1182,7 +1187,9 @@ void DXVAVideoDecodeAccelerator::Destroy() { |
delete this; |
} |
-bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() { |
+bool DXVAVideoDecodeAccelerator::TryInitializeDecodeOnSeparateThread( |
+ const base::WeakPtr<Client>& decode_client, |
+ const scoped_refptr<base::SingleThreadTaskRunner>& decode_task_runner) { |
return false; |
} |
@@ -1367,15 +1374,16 @@ bool DXVAVideoDecodeAccelerator::CheckDecoderDxvaSupport() { |
DVLOG(1) << "Failed to set Low latency mode on decoder. Error: " << hr; |
} |
+ auto gl_context = get_gl_context_cb_.Run(); |
+ RETURN_ON_FAILURE(gl_context, "Couldn't get GL context", false); |
+ |
// The decoder should use DX11 iff |
// 1. The underlying H/W decoder supports it. |
// 2. We have a pointer to the MFCreateDXGIDeviceManager function needed for |
// this. This should always be true for Windows 8+. |
// 3. ANGLE is using DX11. |
- DCHECK(gl_context_); |
if (create_dxgi_device_manager_ && |
- (gl_context_->GetGLRenderer().find("Direct3D11") != |
- std::string::npos)) { |
+ (gl_context->GetGLRenderer().find("Direct3D11") != std::string::npos)) { |
UINT32 dx11_aware = 0; |
attributes->GetUINT32(MF_SA_D3D11_AWARE, &dx11_aware); |
use_dx11_ = !!dx11_aware; |
@@ -1577,8 +1585,9 @@ void DXVAVideoDecodeAccelerator::ProcessPendingSamples() { |
if (!output_picture_buffers_.size()) |
return; |
- RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_.Run(), |
- "Failed to make context current", PLATFORM_FAILURE,); |
+ RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_cb_.Run(), |
+ "Failed to make context current", |
+ PLATFORM_FAILURE, ); |
OutputBuffers::iterator index; |
@@ -2076,8 +2085,9 @@ void DXVAVideoDecodeAccelerator::CopySurfaceComplete( |
if (picture_buffer->available()) |
return; |
- RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_.Run(), |
- "Failed to make context current", PLATFORM_FAILURE,); |
+ RETURN_AND_NOTIFY_ON_FAILURE(make_context_current_cb_.Run(), |
+ "Failed to make context current", |
+ PLATFORM_FAILURE, ); |
DCHECK(!output_picture_buffers_.empty()); |