sendrecv: Don't set pipeline state if it's NULL
authorNirbheek Chauhan <nirbheek@centricular.com>
Sat, 31 Mar 2018 04:58:51 +0000 (10:28 +0530)
committerNirbheek Chauhan <nirbheek@centricular.com>
Sat, 31 Mar 2018 04:58:51 +0000 (10:28 +0530)
Avoids ugly CRITICAL warnings when erroring out.

webrtc/sendrecv/gst/webrtc-sendrecv.c

index 607732e..6ccefaa 100644 (file)
@@ -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;
 }