d3d11videosink: Fix warning around GstVideoOverlay::expose()
When expose() is called, d3d11videosink needs to redraw using cached buffer, so gst_d3d11_window_render() should allow null buffer. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2450>
This commit is contained in:
parent
185d8d1951
commit
a096207f85
@ -1094,7 +1094,6 @@ gst_d3d11_video_sink_show_frame (GstVideoSink * sink, GstBuffer * buf)
|
|||||||
{
|
{
|
||||||
GstD3D11VideoSink *self = GST_D3D11_VIDEO_SINK (sink);
|
GstD3D11VideoSink *self = GST_D3D11_VIDEO_SINK (sink);
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
GstVideoRectangle rect = { 0, };
|
|
||||||
GstBuffer *fallback_buf = NULL;
|
GstBuffer *fallback_buf = NULL;
|
||||||
ID3D11Device *device_handle =
|
ID3D11Device *device_handle =
|
||||||
gst_d3d11_device_get_device_handle (self->device);
|
gst_d3d11_device_get_device_handle (self->device);
|
||||||
@ -1162,10 +1161,6 @@ gst_d3d11_video_sink_show_frame (GstVideoSink * sink, GstBuffer * buf)
|
|||||||
|
|
||||||
gst_d3d11_window_show (self->window);
|
gst_d3d11_window_show (self->window);
|
||||||
|
|
||||||
/* FIXME: add support crop meta */
|
|
||||||
rect.w = self->video_width;
|
|
||||||
rect.h = self->video_height;
|
|
||||||
|
|
||||||
if (self->draw_on_shared_texture) {
|
if (self->draw_on_shared_texture) {
|
||||||
g_rec_mutex_lock (&self->draw_lock);
|
g_rec_mutex_lock (&self->draw_lock);
|
||||||
self->current_buffer = fallback_buf ? fallback_buf : buf;
|
self->current_buffer = fallback_buf ? fallback_buf : buf;
|
||||||
@ -1183,7 +1178,7 @@ gst_d3d11_video_sink_show_frame (GstVideoSink * sink, GstBuffer * buf)
|
|||||||
g_rec_mutex_unlock (&self->draw_lock);
|
g_rec_mutex_unlock (&self->draw_lock);
|
||||||
} else {
|
} else {
|
||||||
ret = gst_d3d11_window_render (self->window,
|
ret = gst_d3d11_window_render (self->window,
|
||||||
fallback_buf ? fallback_buf : buf, &rect);
|
fallback_buf ? fallback_buf : buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_clear_buffer (&fallback_buf);
|
gst_clear_buffer (&fallback_buf);
|
||||||
@ -1248,11 +1243,7 @@ gst_d3d11_video_sink_expose (GstVideoOverlay * overlay)
|
|||||||
GstD3D11VideoSink *self = GST_D3D11_VIDEO_SINK (overlay);
|
GstD3D11VideoSink *self = GST_D3D11_VIDEO_SINK (overlay);
|
||||||
|
|
||||||
if (self->window && self->window->swap_chain) {
|
if (self->window && self->window->swap_chain) {
|
||||||
GstVideoRectangle rect = { 0, };
|
gst_d3d11_window_render (self->window, NULL);
|
||||||
rect.w = GST_VIDEO_SINK_WIDTH (self);
|
|
||||||
rect.h = GST_VIDEO_SINK_HEIGHT (self);
|
|
||||||
|
|
||||||
gst_d3d11_window_render (self->window, NULL, &rect);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -953,24 +953,25 @@ gst_d3d111_window_present (GstD3D11Window * self, GstBuffer * buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GstFlowReturn
|
GstFlowReturn
|
||||||
gst_d3d11_window_render (GstD3D11Window * window, GstBuffer * buffer,
|
gst_d3d11_window_render (GstD3D11Window * window, GstBuffer * buffer)
|
||||||
GstVideoRectangle * rect)
|
|
||||||
{
|
{
|
||||||
GstMemory *mem;
|
GstMemory *mem;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_D3D11_WINDOW (window), GST_FLOW_ERROR);
|
g_return_val_if_fail (GST_IS_D3D11_WINDOW (window), GST_FLOW_ERROR);
|
||||||
g_return_val_if_fail (rect != NULL, GST_FLOW_ERROR);
|
|
||||||
|
|
||||||
mem = gst_buffer_peek_memory (buffer, 0);
|
if (buffer) {
|
||||||
if (!gst_is_d3d11_memory (mem)) {
|
mem = gst_buffer_peek_memory (buffer, 0);
|
||||||
GST_ERROR_OBJECT (window, "Invalid buffer");
|
if (!gst_is_d3d11_memory (mem)) {
|
||||||
|
GST_ERROR_OBJECT (window, "Invalid buffer");
|
||||||
|
|
||||||
return GST_FLOW_ERROR;
|
return GST_FLOW_ERROR;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_d3d11_device_lock (window->device);
|
gst_d3d11_device_lock (window->device);
|
||||||
gst_buffer_replace (&window->cached_buffer, buffer);
|
if (buffer)
|
||||||
|
gst_buffer_replace (&window->cached_buffer, buffer);
|
||||||
|
|
||||||
ret = gst_d3d111_window_present (window, window->cached_buffer,
|
ret = gst_d3d111_window_present (window, window->cached_buffer,
|
||||||
window->pov, window->rtv);
|
window->pov, window->rtv);
|
||||||
|
@ -187,8 +187,7 @@ gboolean gst_d3d11_window_prepare (GstD3D11Window * window,
|
|||||||
GError ** error);
|
GError ** error);
|
||||||
|
|
||||||
GstFlowReturn gst_d3d11_window_render (GstD3D11Window * window,
|
GstFlowReturn gst_d3d11_window_render (GstD3D11Window * window,
|
||||||
GstBuffer * buffer,
|
GstBuffer * buffer);
|
||||||
GstVideoRectangle * src_rect);
|
|
||||||
|
|
||||||
GstFlowReturn gst_d3d11_window_render_on_shared_handle (GstD3D11Window * window,
|
GstFlowReturn gst_d3d11_window_render_on_shared_handle (GstD3D11Window * window,
|
||||||
GstBuffer * buffer,
|
GstBuffer * buffer,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user