mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 13:25:56 +00:00
rtpbin: Sink jitterbuffer/storage before passing as parameters to signals
Otherwise signal handlers from bindings will take ownership of them as they are still floating, and we won't own a reference inside rtpbin anymore. Fixes https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/issues/515
This commit is contained in:
parent
65a7d39bd4
commit
87202cc03d
1 changed files with 14 additions and 0 deletions
|
@ -782,6 +782,9 @@ create_session (GstRtpBin * rtpbin, gint id)
|
||||||
if (!(storage = gst_element_factory_make ("rtpstorage", NULL)))
|
if (!(storage = gst_element_factory_make ("rtpstorage", NULL)))
|
||||||
goto no_storage;
|
goto no_storage;
|
||||||
|
|
||||||
|
/* need to sink the storage or otherwise signal handlers from bindings will
|
||||||
|
* take ownership of it and we don't own it anymore */
|
||||||
|
gst_object_ref_sink (storage);
|
||||||
g_signal_emit (rtpbin, gst_rtp_bin_signals[SIGNAL_NEW_STORAGE], 0, storage,
|
g_signal_emit (rtpbin, gst_rtp_bin_signals[SIGNAL_NEW_STORAGE], 0, storage,
|
||||||
id);
|
id);
|
||||||
|
|
||||||
|
@ -847,6 +850,10 @@ create_session (GstRtpBin * rtpbin, gint id)
|
||||||
gst_bin_add (GST_BIN_CAST (rtpbin), sess->rtcp_funnel);
|
gst_bin_add (GST_BIN_CAST (rtpbin), sess->rtcp_funnel);
|
||||||
gst_bin_add (GST_BIN_CAST (rtpbin), storage);
|
gst_bin_add (GST_BIN_CAST (rtpbin), storage);
|
||||||
|
|
||||||
|
/* unref the storage again, the bin has a reference now and
|
||||||
|
* we don't need it anymore */
|
||||||
|
gst_object_unref (storage);
|
||||||
|
|
||||||
GST_OBJECT_LOCK (rtpbin);
|
GST_OBJECT_LOCK (rtpbin);
|
||||||
target = GST_STATE_TARGET (rtpbin);
|
target = GST_STATE_TARGET (rtpbin);
|
||||||
GST_OBJECT_UNLOCK (rtpbin);
|
GST_OBJECT_UNLOCK (rtpbin);
|
||||||
|
@ -1850,6 +1857,9 @@ create_stream (GstRtpBinSession * session, guint32 ssrc)
|
||||||
g_object_set (buffer, "max-ts-offset-adjustment",
|
g_object_set (buffer, "max-ts-offset-adjustment",
|
||||||
rtpbin->max_ts_offset_adjustment, NULL);
|
rtpbin->max_ts_offset_adjustment, NULL);
|
||||||
|
|
||||||
|
/* need to sink the jitterbufer or otherwise signal handlers from bindings will
|
||||||
|
* take ownership of it and we don't own it anymore */
|
||||||
|
gst_object_ref_sink (buffer);
|
||||||
g_signal_emit (rtpbin, gst_rtp_bin_signals[SIGNAL_NEW_JITTERBUFFER], 0,
|
g_signal_emit (rtpbin, gst_rtp_bin_signals[SIGNAL_NEW_JITTERBUFFER], 0,
|
||||||
buffer, session->id, ssrc);
|
buffer, session->id, ssrc);
|
||||||
|
|
||||||
|
@ -1857,6 +1867,10 @@ create_stream (GstRtpBinSession * session, guint32 ssrc)
|
||||||
gst_bin_add (GST_BIN_CAST (rtpbin), demux);
|
gst_bin_add (GST_BIN_CAST (rtpbin), demux);
|
||||||
gst_bin_add (GST_BIN_CAST (rtpbin), buffer);
|
gst_bin_add (GST_BIN_CAST (rtpbin), buffer);
|
||||||
|
|
||||||
|
/* unref the jitterbuffer again, the bin has a reference now and
|
||||||
|
* we don't need it anymore */
|
||||||
|
gst_object_unref (buffer);
|
||||||
|
|
||||||
/* link stuff */
|
/* link stuff */
|
||||||
if (demux)
|
if (demux)
|
||||||
gst_element_link_pads_full (buffer, "src", demux, "sink",
|
gst_element_link_pads_full (buffer, "src", demux, "sink",
|
||||||
|
|
Loading…
Reference in a new issue