diff options
5 files changed, 25 insertions, 0 deletions
diff --git a/content/common/gpu/media/dxva_video_decode_accelerator.cc b/content/common/gpu/media/dxva_video_decode_accelerator.cc index 5574fa7..aaf3925 100644 --- a/content/common/gpu/media/dxva_video_decode_accelerator.cc +++ b/content/common/gpu/media/dxva_video_decode_accelerator.cc @@ -298,6 +298,7 @@ DXVAVideoDecodeAccelerator::DXVAPictureBuffer::Create( "Failed to query ANGLE surface pointer", linked_ptr<DXVAPictureBuffer>(NULL)); + // TODO(dshwang): after moving to D3D11, use RGBA surface. crbug.com/438691 HRESULT hr = decoder.device_->CreateTexture( buffer.size().width(), buffer.size().height(), @@ -723,6 +724,10 @@ bool DXVAVideoDecodeAccelerator::CanDecodeOnIOThread() { return false; } +GLenum DXVAVideoDecodeAccelerator::GetSurfaceInternalFormat() const { + return GL_BGRA_EXT; +} + bool DXVAVideoDecodeAccelerator::InitDecoder(media::VideoCodecProfile profile) { HMODULE decoder_dll = NULL; diff --git a/content/common/gpu/media/dxva_video_decode_accelerator.h b/content/common/gpu/media/dxva_video_decode_accelerator.h index 4984fcb..cf30727 100644 --- a/content/common/gpu/media/dxva_video_decode_accelerator.h +++ b/content/common/gpu/media/dxva_video_decode_accelerator.h @@ -65,6 +65,7 @@ class CONTENT_EXPORT DXVAVideoDecodeAccelerator virtual void Reset() override; virtual void Destroy() override; virtual bool CanDecodeOnIOThread() override; + GLenum GetSurfaceInternalFormat() const override; private: typedef void* EGLConfig; diff --git a/content/common/gpu/media/gpu_video_decode_accelerator.cc b/content/common/gpu/media/gpu_video_decode_accelerator.cc index df8ec5b..ecb0694 100644 --- a/content/common/gpu/media/gpu_video_decode_accelerator.cc +++ b/content/common/gpu/media/gpu_video_decode_accelerator.cc @@ -395,6 +395,14 @@ void GpuVideoDecodeAccelerator::OnAssignPictureBuffers( NotifyError(media::VideoDecodeAccelerator::INVALID_ARGUMENT); return; } + + // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 + GLenum format = + video_decode_accelerator_.get()->GetSurfaceInternalFormat(); + if (format != GL_RGBA) { + texture_manager->SetLevelInfo(texture_ref, texture_target_, 0, format, + width, height, 1, 0, format, 0, false); + } } uint32 service_texture_id; if (!command_decoder->GetServiceTextureId( diff --git a/media/video/video_decode_accelerator.cc b/media/video/video_decode_accelerator.cc index a72912c..21b1d00 100644 --- a/media/video/video_decode_accelerator.cc +++ b/media/video/video_decode_accelerator.cc @@ -4,6 +4,7 @@ #include "media/video/video_decode_accelerator.h" +#include <GLES2/gl2.h> #include "base/logging.h" namespace media { @@ -16,6 +17,10 @@ bool VideoDecodeAccelerator::CanDecodeOnIOThread() { return false; // not reached } +GLenum VideoDecodeAccelerator::GetSurfaceInternalFormat() const { + return GL_RGBA; +} + } // namespace media namespace base { diff --git a/media/video/video_decode_accelerator.h b/media/video/video_decode_accelerator.h index 4df3b1c..547e1bb 100644 --- a/media/video/video_decode_accelerator.h +++ b/media/video/video_decode_accelerator.h @@ -13,6 +13,8 @@ #include "media/video/picture.h" #include "ui/gfx/size.h" +typedef unsigned int GLenum; + namespace media { // Video decoder interface. @@ -143,6 +145,10 @@ class MEDIA_EXPORT VideoDecodeAccelerator { // the first time so it can be cleared. virtual bool CanDecodeOnIOThread(); + // Windows creates a BGRA texture. + // TODO(dshwang): after moving to D3D11, remove this. crbug.com/438691 + virtual GLenum GetSurfaceInternalFormat() const; + protected: // Do not delete directly; use Destroy() or own it with a scoped_ptr, which // will Destroy() it properly by default. |