mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
giosrc: Ensure that an error is posted when underlying file is deleted
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/1001>
This commit is contained in:
parent
2d198ff10b
commit
dc969bf538
1 changed files with 24 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue