appsrc: Post a bus error if a segment can't be applied
authorJan Schmidt <jan@centricular.com>
Mon, 10 Aug 2020 17:45:32 +0000 (03:45 +1000)
committerGStreamer Merge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Tue, 11 Aug 2020 07:35:56 +0000 (07:35 +0000)
When applying segments from the input samples, post a bus
error and fail loudly if the segment fails to configure, instead of
just posting debug output.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/783>

gst-libs/gst/app/gstappsrc.c

index a6e335f..2df2e73 100644 (file)
@@ -1324,8 +1324,8 @@ gst_app_src_create (GstBaseSrc * bsrc, guint64 offset, guint size,
           if (!gst_base_src_new_segment (bsrc, segment)) {
             GST_ERROR_OBJECT (appsrc,
                 "Couldn't set new segment %" GST_PTR_FORMAT, event);
-            ret = GST_FLOW_ERROR;
-            break;
+            gst_event_unref (event);
+            goto invalid_segment;
           }
           gst_segment_copy_into (segment, &priv->current_segment);
         }
@@ -1405,6 +1405,14 @@ seek_error:
         GST_ERROR_SYSTEM);
     return GST_FLOW_ERROR;
   }
+
+invalid_segment:
+  {
+    g_mutex_unlock (&priv->mutex);
+    GST_ELEMENT_ERROR (appsrc, LIBRARY, SETTINGS,
+        (NULL), ("Failed to configure the provided input segment."));
+    return GST_FLOW_ERROR;
+  }
 }
 
 /* external API */