From 81775882509c6db43e29aa63fcd2ad86f877ff94 Mon Sep 17 00:00:00 2001
From: Jan Schmidt <jan@centricular.com>
Date: Sat, 19 Nov 2022 19:50:38 +1100
Subject: [PATCH] examples/sendrecv: Remove extra unref of webrtcbin

The code now constructs webrtcbin with a floating ref and then
gives it to the pipeline. The extra unref is one too many.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3436>
---
 subprojects/gst-examples/webrtc/sendrecv/gst/webrtc-sendrecv.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc-sendrecv.c b/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc-sendrecv.c
index e71fe3bbac..7e1c88d905 100644
--- a/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc-sendrecv.c
+++ b/subprojects/gst-examples/webrtc/sendrecv/gst/webrtc-sendrecv.c
@@ -481,6 +481,7 @@ start_pipeline (gboolean create_offer, guint opus_pt, guint vp8_pt)
   g_assert_nonnull (webrtc1);
   gst_util_set_object_arg (G_OBJECT (webrtc1), "bundle-policy", "max-bundle");
 
+  /* Takes ownership of each: */
   gst_bin_add_many (GST_BIN (pipe1), audio_bin, video_bin, webrtc1, NULL);
 
   if (!gst_element_link (audio_bin, webrtc1)) {
@@ -547,8 +548,6 @@ start_pipeline (gboolean create_offer, guint opus_pt, guint vp8_pt)
   /* Incoming streams will be exposed via this signal */
   g_signal_connect (webrtc1, "pad-added", G_CALLBACK (on_incoming_stream),
       pipe1);
-  /* Lifetime is the same as the pipeline itself */
-  gst_object_unref (webrtc1);
 
   g_timeout_add (100, (GSourceFunc) webrtcbin_get_stats, webrtc1);