Commit aaec1bcc authored by ananta@chromium.org's avatar ananta@chromium.org

Ensure that the correct open gl context is made current before attempting to write to the open

gl textures in the DXVA decoder on windows. 

This fixes the problem with flashing in HTML5 videos with gpu compositing turned on.

BUG=141233
R=fischman
Review URL: https://chromiumcodereview.appspot.com/10826238

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151089 0039d316-1c4b-4281-b951-d872f2087c98
parent d998a442
...@@ -499,12 +499,14 @@ bool DXVAVideoDecodeAccelerator::CreateD3DDevManager() { ...@@ -499,12 +499,14 @@ bool DXVAVideoDecodeAccelerator::CreateD3DDevManager() {
} }
DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator( DXVAVideoDecodeAccelerator::DXVAVideoDecodeAccelerator(
media::VideoDecodeAccelerator::Client* client) media::VideoDecodeAccelerator::Client* client,
const base::Callback<bool(void)>& make_context_current)
: client_(client), : client_(client),
egl_config_(NULL), egl_config_(NULL),
state_(kUninitialized), state_(kUninitialized),
pictures_requested_(false), pictures_requested_(false),
inputs_before_decode_(0) { inputs_before_decode_(0),
make_context_current_(make_context_current) {
memset(&input_stream_info_, 0, sizeof(input_stream_info_)); memset(&input_stream_info_, 0, sizeof(input_stream_info_));
memset(&output_stream_info_, 0, sizeof(output_stream_info_)); memset(&output_stream_info_, 0, sizeof(output_stream_info_));
} }
...@@ -965,6 +967,11 @@ void DXVAVideoDecodeAccelerator::ProcessPendingSamples() { ...@@ -965,6 +967,11 @@ void DXVAVideoDecodeAccelerator::ProcessPendingSamples() {
if (pending_output_samples_.empty()) if (pending_output_samples_.empty())
return; return;
if (!make_context_current_.Run()) {
StopOnError(media::VideoDecodeAccelerator::PLATFORM_FAILURE);
return;
}
OutputBuffers::iterator index; OutputBuffers::iterator index;
for (index = output_picture_buffers_.begin(); for (index = output_picture_buffers_.begin();
......
...@@ -40,7 +40,8 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator ...@@ -40,7 +40,8 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator
// Does not take ownership of |client| which must outlive |*this|. // Does not take ownership of |client| which must outlive |*this|.
explicit DXVAVideoDecodeAccelerator( explicit DXVAVideoDecodeAccelerator(
media::VideoDecodeAccelerator::Client* client); media::VideoDecodeAccelerator::Client* client,
const base::Callback<bool(void)>& make_context_current);
virtual ~DXVAVideoDecodeAccelerator(); virtual ~DXVAVideoDecodeAccelerator();
// media::VideoDecodeAccelerator implementation. // media::VideoDecodeAccelerator implementation.
...@@ -200,6 +201,9 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator ...@@ -200,6 +201,9 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator
// 1. All required decoder dlls were successfully loaded. // 1. All required decoder dlls were successfully loaded.
// 2. The device manager initialization completed. // 2. The device manager initialization completed.
static bool pre_sandbox_init_done_; static bool pre_sandbox_init_done_;
// Callback to set the correct gl context.
base::Callback<bool(void)> make_context_current_;
}; };
#endif // CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_ #endif // CONTENT_COMMON_GPU_MEDIA_DXVA_VIDEO_DECODE_ACCELERATOR_H_
...@@ -169,7 +169,8 @@ void GpuVideoDecodeAccelerator::Initialize( ...@@ -169,7 +169,8 @@ void GpuVideoDecodeAccelerator::Initialize(
return; return;
} }
DLOG(INFO) << "Initializing DXVA HW decoder for windows."; DLOG(INFO) << "Initializing DXVA HW decoder for windows.";
video_decode_accelerator_.reset(new DXVAVideoDecodeAccelerator(this)); video_decode_accelerator_.reset(new DXVAVideoDecodeAccelerator(
this, make_context_current_));
#elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
video_decode_accelerator_.reset(new OmxVideoDecodeAccelerator( video_decode_accelerator_.reset(new OmxVideoDecodeAccelerator(
gfx::GLSurfaceEGL::GetHardwareDisplay(), gfx::GLSurfaceEGL::GetHardwareDisplay(),
......
...@@ -310,7 +310,7 @@ GLRenderingVDAClient::~GLRenderingVDAClient() { ...@@ -310,7 +310,7 @@ GLRenderingVDAClient::~GLRenderingVDAClient() {
SetState(CS_DESTROYED); SetState(CS_DESTROYED);
} }
#if !defined(OS_WIN) && !defined(OS_MACOSX) #if !defined(OS_MACOSX)
static bool DoNothingReturnTrue() { return true; } static bool DoNothingReturnTrue() { return true; }
#endif #endif
...@@ -318,7 +318,8 @@ void GLRenderingVDAClient::CreateDecoder() { ...@@ -318,7 +318,8 @@ void GLRenderingVDAClient::CreateDecoder() {
CHECK(decoder_deleted()); CHECK(decoder_deleted());
CHECK(!decoder_.get()); CHECK(!decoder_.get());
#if defined(OS_WIN) #if defined(OS_WIN)
decoder_.reset(new DXVAVideoDecodeAccelerator(this)); decoder_.reset(new DXVAVideoDecodeAccelerator(
this, base::Bind(&DoNothingReturnTrue)));
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
decoder_.reset(new MacVideoDecodeAccelerator( decoder_.reset(new MacVideoDecodeAccelerator(
static_cast<CGLContextObj>(rendering_helper_->GetGLContext()), this)); static_cast<CGLContextObj>(rendering_helper_->GetGLContext()), this));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment