Commit dc969bf5 authored by Thibault Saunier's avatar Thibault Saunier 🌵 Committed by GStreamer Merge Bot

giosrc: Ensure that an error is posted when underlying file is deleted

Part-of: <!1001>
parent 2d198ff1
Pipeline #252941 waiting for manual action with stages
in 39 seconds
......@@ -105,6 +105,25 @@ static GInputStream *gst_gio_src_get_stream (GstGioBaseSrc * bsrc);
static gboolean gst_gio_src_query (GstBaseSrc * base_src, GstQuery * query);
static gboolean
gst_gio_src_check_deleted (GstGioSrc * src)
{
GstGioBaseSrc *bsrc = GST_GIO_BASE_SRC (src);
if (!g_file_query_exists (src->file, bsrc->cancel)) {
gchar *uri = g_file_get_uri (src->file);
GST_ELEMENT_ERROR (src, RESOURCE, NOT_FOUND, (NULL),
("The underlying file %s is not available anymore", uri));
g_free (uri);
return TRUE;
}
return FALSE;
}
static void
gst_gio_src_file_changed_cb (GstGioSrc * src)
{
......@@ -114,6 +133,8 @@ gst_gio_src_file_changed_cb (GstGioSrc * src)
if (src->monitoring_mainloop)
g_main_loop_quit (src->monitoring_mainloop);
GST_OBJECT_UNLOCK (src);
gst_gio_src_check_deleted (src);
}
static void
......@@ -133,6 +154,9 @@ gst_gio_src_wait_for_data (GstGioBaseSrc * bsrc)
g_return_val_if_fail (!src->monitor, FALSE);
if (gst_gio_src_check_deleted (src))
return FALSE;
GST_OBJECT_LOCK (src);
if (!src->is_growing) {
GST_OBJECT_UNLOCK (src);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment