mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-22 10:23:47 +00:00
vaapisink: don't use member variable outside lock
Thus a race condition segfault is avoided. Original-patch-by: Matt Staples <staples255@gmail.com> https://bugzilla.gnome.org/show_bug.cgi?id=777146
This commit is contained in:
parent
7fd41c4263
commit
f5360282bc
1 changed files with 16 additions and 6 deletions
|
@ -574,10 +574,8 @@ gst_vaapisink_video_overlay_expose (GstVideoOverlay * overlay)
|
||||||
{
|
{
|
||||||
GstVaapiSink *const sink = GST_VAAPISINK (overlay);
|
GstVaapiSink *const sink = GST_VAAPISINK (overlay);
|
||||||
|
|
||||||
if (sink->video_buffer) {
|
gst_vaapisink_reconfigure_window (sink);
|
||||||
gst_vaapisink_reconfigure_window (sink);
|
gst_vaapisink_show_frame (GST_VIDEO_SINK_CAST (sink), NULL);
|
||||||
gst_vaapisink_show_frame (GST_VIDEO_SINK_CAST (sink), sink->video_buffer);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1372,12 +1370,20 @@ gst_vaapisink_show_frame_unlocked (GstVaapiSink * sink, GstBuffer * src_buffer)
|
||||||
GstVaapiSurfaceProxy *proxy;
|
GstVaapiSurfaceProxy *proxy;
|
||||||
GstVaapiSurface *surface;
|
GstVaapiSurface *surface;
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
|
GstBuffer *old_buf;
|
||||||
guint flags;
|
guint flags;
|
||||||
GstVaapiRectangle *surface_rect = NULL;
|
GstVaapiRectangle *surface_rect = NULL;
|
||||||
GstVaapiRectangle tmp_rect;
|
GstVaapiRectangle tmp_rect;
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
gint32 view_id;
|
gint32 view_id;
|
||||||
|
|
||||||
|
if (!src_buffer) {
|
||||||
|
if (sink->video_buffer)
|
||||||
|
src_buffer = sink->video_buffer;
|
||||||
|
else
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
}
|
||||||
|
|
||||||
GstVideoCropMeta *const crop_meta =
|
GstVideoCropMeta *const crop_meta =
|
||||||
gst_buffer_get_video_crop_meta (src_buffer);
|
gst_buffer_get_video_crop_meta (src_buffer);
|
||||||
if (crop_meta) {
|
if (crop_meta) {
|
||||||
|
@ -1448,9 +1454,13 @@ gst_vaapisink_show_frame_unlocked (GstVaapiSink * sink, GstBuffer * src_buffer)
|
||||||
g_signal_emit (sink, gst_vaapisink_signals[HANDOFF_SIGNAL], 0, buffer);
|
g_signal_emit (sink, gst_vaapisink_signals[HANDOFF_SIGNAL], 0, buffer);
|
||||||
|
|
||||||
/* Retain VA surface until the next one is displayed */
|
/* Retain VA surface until the next one is displayed */
|
||||||
/* Need to release the lock for the duration, otherwise a deadlock is possible */
|
old_buf = sink->video_buffer;
|
||||||
|
sink->video_buffer = gst_buffer_ref (buffer);
|
||||||
|
/* Need to release the lock while releasing old buffer, otherwise a
|
||||||
|
* deadlock is possible */
|
||||||
gst_vaapi_display_unlock (GST_VAAPI_PLUGIN_BASE_DISPLAY (sink));
|
gst_vaapi_display_unlock (GST_VAAPI_PLUGIN_BASE_DISPLAY (sink));
|
||||||
gst_buffer_replace (&sink->video_buffer, buffer);
|
if (old_buf)
|
||||||
|
gst_buffer_unref (old_buf);
|
||||||
gst_vaapi_display_lock (GST_VAAPI_PLUGIN_BASE_DISPLAY (sink));
|
gst_vaapi_display_lock (GST_VAAPI_PLUGIN_BASE_DISPLAY (sink));
|
||||||
|
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
|
|
Loading…
Reference in a new issue