Index: media/gpu/dxva_picture_buffer_win.cc |
diff --git a/media/gpu/dxva_picture_buffer_win.cc b/media/gpu/dxva_picture_buffer_win.cc |
index a6f417da2907d4f2ac8039d49494fb1c1c843d83..44f27f950a43c5f2bf2da1c6493deae677d50fbf 100644 |
--- a/media/gpu/dxva_picture_buffer_win.cc |
+++ b/media/gpu/dxva_picture_buffer_win.cc |
@@ -11,6 +11,7 @@ |
#include "ui/gl/gl_context.h" |
#include "ui/gl/gl_fence.h" |
#include "ui/gl/gl_image.h" |
+#include "ui/gl/gl_image_dxgi.h" |
#include "ui/gl/gl_surface_egl.h" |
#include "ui/gl/scoped_binders.h" |
@@ -75,20 +76,6 @@ class GLImagePbuffer : public DummyGLImage { |
EGLSurface surface_; |
}; |
-class GLImageEGLStream : public DummyGLImage { |
- public: |
- GLImageEGLStream(const gfx::Size& size, EGLStreamKHR stream) |
- : DummyGLImage(size), stream_(stream) {} |
- |
- private: |
- ~GLImageEGLStream() override { |
- EGLDisplay egl_display = gl::GLSurfaceEGL::GetHardwareDisplay(); |
- eglDestroyStreamKHR(egl_display, stream_); |
- } |
- |
- EGLStreamKHR stream_; |
-}; |
- |
} // namespace |
#define RETURN_ON_FAILURE(result, log, ret) \ |
@@ -432,7 +419,7 @@ bool EGLStreamPictureBuffer::Initialize() { |
}; |
stream_ = eglCreateStreamKHR(egl_display, stream_attributes); |
RETURN_ON_FAILURE(!!stream_, "Could not create stream", false); |
- gl_image_ = make_scoped_refptr(new GLImageEGLStream(size(), stream_)); |
+ gl_image_ = make_scoped_refptr(new gl::GLImageDXGI(size(), stream_)); |
gl::ScopedActiveTexture texture0(GL_TEXTURE0); |
gl::ScopedTextureBinder texture0_binder( |
GL_TEXTURE_EXTERNAL_OES, picture_buffer_.service_texture_ids()[0]); |
@@ -513,6 +500,11 @@ bool EGLStreamPictureBuffer::BindSampleToTexture( |
RETURN_ON_FAILURE(result, "Could not post texture", false); |
result = eglStreamConsumerAcquireKHR(egl_display, stream_); |
RETURN_ON_FAILURE(result, "Could not post acquire stream", false); |
+ gl::GLImageDXGI* gl_image_dxgi = |
+ gl::GLImageDXGI::FromGLImage(gl_image_.get()); |
+ DCHECK(gl_image_dxgi); |
+ |
+ gl_image_dxgi->SetTexture(dx11_decoding_texture_, subresource); |
return true; |
} |
@@ -539,7 +531,7 @@ bool EGLStreamCopyPictureBuffer::Initialize( |
}; |
stream_ = eglCreateStreamKHR(egl_display, stream_attributes); |
RETURN_ON_FAILURE(!!stream_, "Could not create stream", false); |
- gl_image_ = make_scoped_refptr(new GLImageEGLStream(size(), stream_)); |
+ gl_image_ = make_scoped_refptr(new gl::GLImageDXGI(size(), stream_)); |
gl::ScopedActiveTexture texture0(GL_TEXTURE0); |
gl::ScopedTextureBinder texture0_binder( |
GL_TEXTURE_EXTERNAL_OES, picture_buffer_.service_texture_ids()[0]); |
@@ -653,6 +645,11 @@ bool EGLStreamCopyPictureBuffer::CopySurfaceComplete( |
RETURN_ON_FAILURE(result, "Could not post stream", false); |
result = eglStreamConsumerAcquireKHR(egl_display, stream_); |
RETURN_ON_FAILURE(result, "Could not post acquire stream", false); |
+ gl::GLImageDXGI* gl_image_dxgi = |
+ gl::GLImageDXGI::FromGLImage(gl_image_.get()); |
+ DCHECK(gl_image_dxgi); |
+ |
+ gl_image_dxgi->SetTexture(angle_copy_texture_, 0); |
return true; |
} |