mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
webrtcbin: Store the rtpjitterbuffer instances to extract stats from them
Store them as web refs to avoid having to worry about freeing later and because the new-jitterbuffer is on a different thread Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1766>
This commit is contained in:
parent
d9d7814182
commit
fc0f6db856
3 changed files with 26 additions and 2 deletions
|
@ -4888,6 +4888,11 @@ _set_description_task (GstWebRTCBin * webrtc, struct set_description *sd)
|
|||
ssrc_item.media_idx = i;
|
||||
ssrc_item.ssrc = ssrc;
|
||||
g_array_append_val (item->remote_ssrcmap, ssrc_item);
|
||||
|
||||
/* Must be done aftrer the value has been appended because
|
||||
* a weak ref cannot be moved. */
|
||||
g_weak_ref_init (&g_array_index (item->remote_ssrcmap, SsrcMapItem,
|
||||
item->remote_ssrcmap->len - 1).rtpjitterbuffer, NULL);
|
||||
}
|
||||
g_strfreev (split);
|
||||
}
|
||||
|
@ -5981,15 +5986,26 @@ static void
|
|||
on_rtpbin_new_jitterbuffer (GstElement * rtpbin, GstElement * jitterbuffer,
|
||||
guint session_id, guint ssrc, GstWebRTCBin * webrtc)
|
||||
{
|
||||
GstWebRTCRTPTransceiver *trans;
|
||||
WebRTCTransceiver *trans;
|
||||
guint i;
|
||||
|
||||
trans = _find_transceiver (webrtc, &session_id,
|
||||
trans = (WebRTCTransceiver *) _find_transceiver (webrtc, &session_id,
|
||||
(FindTransceiverFunc) transceiver_match_for_mline);
|
||||
|
||||
if (trans) {
|
||||
/* We don't set do-retransmission on rtpbin as we want per-session control */
|
||||
g_object_set (jitterbuffer, "do-retransmission",
|
||||
WEBRTC_TRANSCEIVER (trans)->do_nack, NULL);
|
||||
|
||||
for (i = 0; i < trans->stream->remote_ssrcmap->len; i++) {
|
||||
SsrcMapItem *item =
|
||||
&g_array_index (trans->stream->remote_ssrcmap, SsrcMapItem, i);
|
||||
|
||||
if (item->ssrc == ssrc) {
|
||||
g_weak_ref_set (&item->rtpjitterbuffer, jitterbuffer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
|
|
@ -289,6 +289,11 @@ clear_ptmap_item (PtMapItem * item)
|
|||
if (item->caps)
|
||||
gst_caps_unref (item->caps);
|
||||
}
|
||||
static void
|
||||
clear_ssrcmap_item (SsrcMapItem * item)
|
||||
{
|
||||
g_weak_ref_clear (&item->rtpjitterbuffer);
|
||||
}
|
||||
|
||||
static void
|
||||
transport_stream_init (TransportStream * stream)
|
||||
|
@ -296,6 +301,8 @@ transport_stream_init (TransportStream * stream)
|
|||
stream->ptmap = g_array_new (FALSE, TRUE, sizeof (PtMapItem));
|
||||
g_array_set_clear_func (stream->ptmap, (GDestroyNotify) clear_ptmap_item);
|
||||
stream->remote_ssrcmap = g_array_new (FALSE, TRUE, sizeof (SsrcMapItem));
|
||||
g_array_set_clear_func (stream->remote_ssrcmap,
|
||||
(GDestroyNotify) clear_ssrcmap_item);
|
||||
}
|
||||
|
||||
TransportStream *
|
||||
|
|
|
@ -41,6 +41,7 @@ typedef struct
|
|||
{
|
||||
guint32 ssrc;
|
||||
guint media_idx;
|
||||
GWeakRef rtpjitterbuffer; /* for stats */
|
||||
} SsrcMapItem;
|
||||
|
||||
struct _TransportStream
|
||||
|
|
Loading…
Reference in a new issue