From e83888302d0716e1089a11475d964bac59229eb2 Mon Sep 17 00:00:00 2001 From: "Jan Alexander Steffens (heftig)" Date: Tue, 3 Mar 2020 10:49:08 +0100 Subject: [PATCH] rtmp2: Only grab stats on close when connection exists If the connection attempt failed, self->connection is NULL. --- gst/rtmp2/gstrtmp2sink.c | 4 +++- gst/rtmp2/gstrtmp2src.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/gst/rtmp2/gstrtmp2sink.c b/gst/rtmp2/gstrtmp2sink.c index 441cb6f247..8f6c794361 100644 --- a/gst/rtmp2/gstrtmp2sink.c +++ b/gst/rtmp2/gstrtmp2sink.c @@ -911,7 +911,9 @@ gst_rtmp2_sink_task_func (gpointer user_data) g_main_loop_run (loop); g_mutex_lock (&self->lock); - self->stats = gst_rtmp_connection_get_stats (self->connection); + if (self->connection) { + self->stats = gst_rtmp_connection_get_stats (self->connection); + } g_clear_pointer (&self->loop, g_main_loop_unref); g_clear_pointer (&self->connection, gst_rtmp_connection_close_and_unref); diff --git a/gst/rtmp2/gstrtmp2src.c b/gst/rtmp2/gstrtmp2src.c index ea79a7caf2..4ed4f98dbf 100644 --- a/gst/rtmp2/gstrtmp2src.c +++ b/gst/rtmp2/gstrtmp2src.c @@ -646,7 +646,9 @@ gst_rtmp2_src_task_func (gpointer user_data) g_main_loop_run (loop); g_mutex_lock (&self->lock); - self->stats = gst_rtmp_connection_get_stats (self->connection); + if (self->connection) { + self->stats = gst_rtmp_connection_get_stats (self->connection); + } g_clear_pointer (&self->loop, g_main_loop_unref); g_clear_pointer (&self->connection, gst_rtmp_connection_close_and_unref);