From 563826deaf63a156f41bfb0e7dc3fd4a0476d02a Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Sat, 31 Mar 2018 10:28:51 +0530 Subject: [PATCH] sendrecv: Don't set pipeline state if it's NULL Avoids ugly CRITICAL warnings when erroring out. --- webrtc/sendrecv/gst/webrtc-sendrecv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/webrtc/sendrecv/gst/webrtc-sendrecv.c b/webrtc/sendrecv/gst/webrtc-sendrecv.c index 607732e9d9..6ccefaa1f5 100644 --- a/webrtc/sendrecv/gst/webrtc-sendrecv.c +++ b/webrtc/sendrecv/gst/webrtc-sendrecv.c @@ -647,11 +647,13 @@ main (int argc, char *argv[]) connect_to_websocket_server_async (); g_main_loop_run (loop); + g_main_loop_unref (loop); - gst_element_set_state (GST_ELEMENT (pipe1), GST_STATE_NULL); - g_print ("Pipeline stopped\n"); - - gst_object_unref (pipe1); + if (pipe1) { + gst_element_set_state (GST_ELEMENT (pipe1), GST_STATE_NULL); + g_print ("Pipeline stopped\n"); + gst_object_unref (pipe1); + } return 0; }