From 0405e0cfc7974cd9369747077fb388144e8bc4de Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Sat, 5 Nov 2022 21:35:08 +0900 Subject: [PATCH] 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: --- subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp index 1e4894da14..b4de7a6c34 100644 --- a/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp +++ b/subprojects/gst-plugins-bad/sys/d3d11/gstd3d11window.cpp @@ -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);