From 68faeca918f3c2de0235c1186305fcd44bb99040 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Dzi=C4=99giel?= Date: Wed, 10 Feb 2021 17:00:02 +0100 Subject: [PATCH] API: Disallow pause on very short streams (< 1 sec) Fixes crash when trying to pause on DVD navigation --- lib/gst/clapper/gstclapper.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/lib/gst/clapper/gstclapper.c b/lib/gst/clapper/gstclapper.c index 07b341ad..6e13c755 100644 --- a/lib/gst/clapper/gstclapper.c +++ b/lib/gst/clapper/gstclapper.c @@ -2847,6 +2847,7 @@ gst_clapper_main (gpointer data) self->is_live = FALSE; self->rate = 1.0; self->seek_mode = DEFAULT_SEEK_MODE; + self->cached_duration = GST_CLOCK_TIME_NONE; GST_TRACE_OBJECT (self, "Starting main loop"); g_main_loop_run (self->loop); @@ -3053,12 +3054,15 @@ gst_clapper_pause (GstClapper * self) { g_return_if_fail (GST_IS_CLAPPER (self)); - g_mutex_lock (&self->lock); - self->inhibit_sigs = FALSE; - g_mutex_unlock (&self->lock); + /* Do not try to pause on DVD navigation */ + if (G_LIKELY (self->cached_duration > 1000000000)) { + g_mutex_lock (&self->lock); + self->inhibit_sigs = FALSE; + g_mutex_unlock (&self->lock); - g_main_context_invoke_full (self->context, G_PRIORITY_DEFAULT, - gst_clapper_pause_internal, self, NULL); + g_main_context_invoke_full (self->context, G_PRIORITY_DEFAULT, + gst_clapper_pause_internal, self, NULL); + } } static void