rtpsession: Fix twcc stats structure leaks

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8073>
This commit is contained in:
Philippe Normand 2024-12-04 16:10:46 +00:00 committed by GStreamer Marge Bot
parent 4d2e27dcf3
commit eb07c4e6b3
3 changed files with 11 additions and 2 deletions

View file

@ -3007,6 +3007,8 @@ gst_rtp_session_notify_twcc (RTPSession * sess,
event = gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM, twcc_packets); event = gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM, twcc_packets);
gst_pad_push_event (send_rtp_sink, event); gst_pad_push_event (send_rtp_sink, event);
gst_object_unref (send_rtp_sink); gst_object_unref (send_rtp_sink);
} else {
gst_structure_free (twcc_packets);
} }
g_object_notify (G_OBJECT (rtpsession), "twcc-stats"); g_object_notify (G_OBJECT (rtpsession), "twcc-stats");

View file

@ -3002,8 +3002,12 @@ rtp_session_process_twcc (RTPSession * sess, guint32 sender_ssrc,
RTP_SESSION_UNLOCK (sess); RTP_SESSION_UNLOCK (sess);
if (sess->callbacks.notify_twcc) if (sess->callbacks.notify_twcc)
sess->callbacks.notify_twcc (sess, twcc_packets_s, twcc_stats_s, sess->callbacks.notify_twcc (sess, g_steal_pointer (&twcc_packets_s),
sess->notify_twcc_user_data); g_steal_pointer (&twcc_stats_s), sess->notify_twcc_user_data);
else {
gst_structure_free (twcc_packets_s);
gst_structure_free (twcc_stats_s);
}
RTP_SESSION_LOCK (sess); RTP_SESSION_LOCK (sess);
} }

View file

@ -159,6 +159,9 @@ typedef void (*RTPSessionNotifyNACK) (RTPSession *sess,
/** /**
* RTPSessionNotifyTWCC: * RTPSessionNotifyTWCC:
* @sess: an #RTPSession
* @twcc_packets: (transfer full): TWCC packets #GstStructure
* @twcc_stats: (transfer full): TWCC stats #GstStructure
* @user_data: user data specified when registering * @user_data: user data specified when registering
* *
* Notifies of Transport-wide congestion control packets and stats. * Notifies of Transport-wide congestion control packets and stats.