d3d11videosink: Always clear back buffer on resize

Swapchain may not need to be resized if the size of backbuffer
is equal to the previous size. Then previously rendered frame will be stay
on the screen. Do clear back buffer whenever resize() is called

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3341>
This commit is contained in:
Seungha Yang 2022-11-05 21:35:08 +09:00 committed by GStreamer Marge Bot
parent 24a0e5bdfd
commit 0405e0cfc7

View file

@ -299,8 +299,10 @@ gst_d3d11_window_on_resize_default (GstD3D11Window * self, guint width,
GstMemory *mem;
GstD3D11Memory *dmem;
ID3D11RenderTargetView *rtv;
ID3D11DeviceContext *context;
gsize size;
GstD3D11DeviceLockGuard lk (device);
const FLOAT clear_color[] = { 0.0, 0.0, 0.0, 1.0 };
gst_clear_buffer (&self->backbuffer);
if (!self->swap_chain)
@ -348,6 +350,9 @@ gst_d3d11_window_on_resize_default (GstD3D11Window * self, guint width,
return;
}
context = gst_d3d11_device_get_device_context_handle (self->device);
context->ClearRenderTargetView (rtv, clear_color);
self->backbuffer = gst_buffer_new ();
gst_buffer_append_memory (self->backbuffer, mem);