mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-13 12:51:16 +00:00
d3d12videosink: Present on GstVideoOverlay::expose()
... so that updated backbuffer can be swapped and presented Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7079>
This commit is contained in:
parent
25514c8fc1
commit
69ea20b739
7 changed files with 35 additions and 1 deletions
|
@ -1532,7 +1532,7 @@ gst_d3d12_video_sink_overlay_expose (GstVideoOverlay * overlay)
|
|||
auto self = GST_D3D12_VIDEO_SINK (overlay);
|
||||
auto priv = self->priv;
|
||||
|
||||
gst_d3d12_window_set_buffer (priv->window, nullptr);
|
||||
gst_d3d12_window_expose (priv->window);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -585,6 +585,18 @@ SwapChain::present ()
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
void
|
||||
SwapChain::expose (GstD3D12Window * window)
|
||||
{
|
||||
std::lock_guard <std::recursive_mutex> lk (lock_);
|
||||
if (!resource_->swapchain || !resource_->cached_buf)
|
||||
return;
|
||||
|
||||
auto ret = set_buffer (window, resource_->cached_buf);
|
||||
if (ret == GST_FLOW_OK)
|
||||
present ();
|
||||
}
|
||||
|
||||
void
|
||||
SwapChain::before_rendering ()
|
||||
{
|
||||
|
|
|
@ -40,6 +40,7 @@ public:
|
|||
GstFlowReturn resize_buffer (GstD3D12Window * window);
|
||||
GstFlowReturn set_buffer (GstD3D12Window * window, GstBuffer * buffer);
|
||||
GstFlowReturn present ();
|
||||
void expose (GstD3D12Window * window);
|
||||
|
||||
private:
|
||||
void before_rendering ();
|
||||
|
|
|
@ -547,6 +547,14 @@ SwapChainProxy::present ()
|
|||
return sc->present ();
|
||||
}
|
||||
|
||||
void
|
||||
SwapChainProxy::expose ()
|
||||
{
|
||||
auto sc = get_swapchain ();
|
||||
if (sc)
|
||||
sc->expose (window_);
|
||||
}
|
||||
|
||||
void
|
||||
HwndServer::register_window (GstD3D12Window * window)
|
||||
{
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
GstFlowReturn resize_buffer (INT width, INT height);
|
||||
GstFlowReturn set_buffer (GstBuffer * buffer);
|
||||
GstFlowReturn present ();
|
||||
void expose ();
|
||||
|
||||
private:
|
||||
std::shared_ptr<SwapChain> get_swapchain ();
|
||||
|
|
|
@ -720,6 +720,16 @@ gst_d3d12_window_render (GstD3D12Window * self, SwapChainResource * resource,
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
void
|
||||
gst_d3d12_window_expose (GstD3D12Window * window)
|
||||
{
|
||||
auto priv = window->priv;
|
||||
auto proxy = priv->proxy.lock ();
|
||||
|
||||
if (proxy)
|
||||
proxy->expose ();
|
||||
}
|
||||
|
||||
GstFlowReturn
|
||||
gst_d3d12_window_set_buffer (GstD3D12Window * window, GstBuffer * buffer)
|
||||
{
|
||||
|
|
|
@ -76,6 +76,8 @@ void gst_d3d12_window_unlock (GstD3D12Window * window);
|
|||
|
||||
void gst_d3d12_window_unlock_stop (GstD3D12Window * window);
|
||||
|
||||
void gst_d3d12_window_expose (GstD3D12Window * window);
|
||||
|
||||
GstFlowReturn gst_d3d12_window_set_buffer (GstD3D12Window * window,
|
||||
GstBuffer * buffer);
|
||||
|
||||
|
|
Loading…
Reference in a new issue