From 0e2efb2de4f36078fb4e890376fad319ae8e9b77 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 7 Nov 2024 13:06:03 -0500 Subject: [PATCH] waylandsink: Properly handle unrecoverable errors Allocation failures cannot be recovered and should lead to an error being posted on the bus. Otherwise the pipeline will just stall. Part-of: --- .../gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c | 14 +++++++++----- .../gst-plugins-bad/ext/wayland/gstwaylandsink.c | 14 +++++++++----- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/subprojects/gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c b/subprojects/gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c index f038cca0cc..32250caa4d 100644 --- a/subprojects/gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c +++ b/subprojects/gst-plugins-bad/ext/gtk/gstgtkwaylandsink.c @@ -1289,25 +1289,29 @@ no_window_size: } no_buffer: { - GST_WARNING_OBJECT (self, "could not create buffer"); + GST_ELEMENT_ERROR (self, RESOURCE, FAILED, + ("could not create buffer"), (NULL)); + ret = GST_FLOW_ERROR; goto done; } no_wl_buffer_shm: { - GST_ERROR_OBJECT (self, "could not create wl_buffer out of wl_shm memory"); + GST_ELEMENT_ERROR (self, RESOURCE, FAILED, + ("could not create wl_buffer out of wl_shm memory"), (NULL)); ret = GST_FLOW_ERROR; goto done; } no_wl_buffer: { - GST_ERROR_OBJECT (self, - "buffer %" GST_PTR_FORMAT " cannot have a wl_buffer", buffer); + GST_ELEMENT_ERROR (self, RESOURCE, FAILED, + ("buffer %" GST_PTR_FORMAT " cannot have a wl_buffer", buffer), (NULL)); ret = GST_FLOW_ERROR; goto done; } activate_failed: { - GST_ERROR_OBJECT (self, "failed to activate bufferpool."); + GST_ELEMENT_ERROR (self, RESOURCE, FAILED, + ("failed to activate bufferpool."), (NULL)); ret = GST_FLOW_ERROR; goto done; } diff --git a/subprojects/gst-plugins-bad/ext/wayland/gstwaylandsink.c b/subprojects/gst-plugins-bad/ext/wayland/gstwaylandsink.c index 21b183a472..964c26363b 100644 --- a/subprojects/gst-plugins-bad/ext/wayland/gstwaylandsink.c +++ b/subprojects/gst-plugins-bad/ext/wayland/gstwaylandsink.c @@ -1070,25 +1070,29 @@ no_window_size: } no_buffer: { - GST_WARNING_OBJECT (self, "could not create buffer"); + GST_ELEMENT_ERROR (self, RESOURCE, FAILED, + ("could not create buffer"), (NULL)); + ret = GST_FLOW_ERROR; goto done; } no_wl_buffer_shm: { - GST_ERROR_OBJECT (self, "could not create wl_buffer out of wl_shm memory"); + GST_ELEMENT_ERROR (self, RESOURCE, FAILED, + ("could not create wl_buffer out of wl_shm memory"), (NULL)); ret = GST_FLOW_ERROR; goto done; } no_wl_buffer: { - GST_ERROR_OBJECT (self, - "buffer %" GST_PTR_FORMAT " cannot have a wl_buffer", buffer); + GST_ELEMENT_ERROR (self, RESOURCE, FAILED, + ("buffer %" GST_PTR_FORMAT " cannot have a wl_buffer", buffer), (NULL)); ret = GST_FLOW_ERROR; goto done; } activate_failed: { - GST_ERROR_OBJECT (self, "failed to activate bufferpool."); + GST_ELEMENT_ERROR (self, RESOURCE, FAILED, + ("failed to activate bufferpool."), (NULL)); ret = GST_FLOW_ERROR; goto done; }