From: Vivia Nikolaidou Date: Wed, 11 Apr 2018 14:54:38 +0000 (+0300) Subject: splitmuxsink: Don't send fragment-opened-closed message if the reference ctx is NULL X-Git-Tag: 1.19.3~509^2~1612 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7d7c90bf5cecd3eb06122d10c572ca605c07d574;p=platform%2Fupstream%2Fgstreamer.git splitmuxsink: Don't send fragment-opened-closed message if the reference ctx is NULL It can happen during teardown that the reference context becomes NULL. In that case, trying to send the fragment-opened-closed message would lead to a crash. --- diff --git a/gst/multifile/gstsplitmuxsink.c b/gst/multifile/gstsplitmuxsink.c index 4b8ef02..debf81f 100644 --- a/gst/multifile/gstsplitmuxsink.c +++ b/gst/multifile/gstsplitmuxsink.c @@ -692,12 +692,16 @@ send_fragment_opened_closed_msg (GstSplitMuxSink * splitmux, gboolean opened) g_object_get (splitmux->sink, "location", &location, NULL); - msg = gst_message_new_element (GST_OBJECT (splitmux), - gst_structure_new (msg_name, - "location", G_TYPE_STRING, location, - "running-time", GST_TYPE_CLOCK_TIME, - splitmux->reference_ctx->out_running_time, NULL)); - gst_element_post_message (GST_ELEMENT_CAST (splitmux), msg); + /* If it's in the middle of a teardown, the reference_ctc might have become + * NULL */ + if (splitmux->reference_ctx) { + msg = gst_message_new_element (GST_OBJECT (splitmux), + gst_structure_new (msg_name, + "location", G_TYPE_STRING, location, + "running-time", GST_TYPE_CLOCK_TIME, + splitmux->reference_ctx->out_running_time, NULL)); + gst_element_post_message (GST_ELEMENT_CAST (splitmux), msg); + } g_free (location); }