mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
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
3 changed files with 12 additions and 21 deletions
|
@ -1094,7 +1094,6 @@ gst_d3d11_video_sink_show_frame (GstVideoSink * sink, GstBuffer * buf)
|
|||
{
|
||||
GstD3D11VideoSink *self = GST_D3D11_VIDEO_SINK (sink);
|
||||
GstFlowReturn ret = GST_FLOW_OK;
|
||||
GstVideoRectangle rect = { 0, };
|
||||
GstBuffer *fallback_buf = NULL;
|
||||
ID3D11Device *device_handle =
|
||||
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);
|
||||
|
||||
/* FIXME: add support crop meta */
|
||||
rect.w = self->video_width;
|
||||
rect.h = self->video_height;
|
||||
|
||||
if (self->draw_on_shared_texture) {
|
||||
g_rec_mutex_lock (&self->draw_lock);
|
||||
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);
|
||||
} else {
|
||||
ret = gst_d3d11_window_render (self->window,
|
||||
fallback_buf ? fallback_buf : buf, &rect);
|
||||
fallback_buf ? fallback_buf : buf);
|
||||
}
|
||||
|
||||
gst_clear_buffer (&fallback_buf);
|
||||
|
@ -1248,11 +1243,7 @@ gst_d3d11_video_sink_expose (GstVideoOverlay * overlay)
|
|||
GstD3D11VideoSink *self = GST_D3D11_VIDEO_SINK (overlay);
|
||||
|
||||
if (self->window && self->window->swap_chain) {
|
||||
GstVideoRectangle rect = { 0, };
|
||||
rect.w = GST_VIDEO_SINK_WIDTH (self);
|
||||
rect.h = GST_VIDEO_SINK_HEIGHT (self);
|
||||
|
||||
gst_d3d11_window_render (self->window, NULL, &rect);
|
||||
gst_d3d11_window_render (self->window, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -953,24 +953,25 @@ gst_d3d111_window_present (GstD3D11Window * self, GstBuffer * buffer,
|
|||
}
|
||||
|
||||
GstFlowReturn
|
||||
gst_d3d11_window_render (GstD3D11Window * window, GstBuffer * buffer,
|
||||
GstVideoRectangle * rect)
|
||||
gst_d3d11_window_render (GstD3D11Window * window, GstBuffer * buffer)
|
||||
{
|
||||
GstMemory *mem;
|
||||
GstFlowReturn ret;
|
||||
|
||||
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 (!gst_is_d3d11_memory (mem)) {
|
||||
GST_ERROR_OBJECT (window, "Invalid buffer");
|
||||
if (buffer) {
|
||||
mem = gst_buffer_peek_memory (buffer, 0);
|
||||
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_buffer_replace (&window->cached_buffer, buffer);
|
||||
if (buffer)
|
||||
gst_buffer_replace (&window->cached_buffer, buffer);
|
||||
|
||||
ret = gst_d3d111_window_present (window, window->cached_buffer,
|
||||
window->pov, window->rtv);
|
||||
|
|
|
@ -187,8 +187,7 @@ gboolean gst_d3d11_window_prepare (GstD3D11Window * window,
|
|||
GError ** error);
|
||||
|
||||
GstFlowReturn gst_d3d11_window_render (GstD3D11Window * window,
|
||||
GstBuffer * buffer,
|
||||
GstVideoRectangle * src_rect);
|
||||
GstBuffer * buffer);
|
||||
|
||||
GstFlowReturn gst_d3d11_window_render_on_shared_handle (GstD3D11Window * window,
|
||||
GstBuffer * buffer,
|
||||
|
|
Loading…
Reference in a new issue