rtpsession: Fix twcc stats structure leaks
authorPhilippe Normand <philn@igalia.com>
Wed, 4 Dec 2024 16:10:46 +0000 (16:10 +0000)
committerBackport Bot <gitlab-backport-bot@gstreamer-foundation.org>
Mon, 9 Dec 2024 15:56:10 +0000 (15:56 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/8115>

subprojects/gst-plugins-good/gst/rtpmanager/gstrtpsession.c
subprojects/gst-plugins-good/gst/rtpmanager/rtpsession.c
subprojects/gst-plugins-good/gst/rtpmanager/rtpsession.h

index 760144f51ac95d592e7d126de1abd72fc45afee5..15dc2fc2d2f60eea51526430d8bd888057448ba7 100644 (file)
@@ -3007,6 +3007,8 @@ gst_rtp_session_notify_twcc (RTPSession * sess,
     event = gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM, twcc_packets);
     gst_pad_push_event (send_rtp_sink, event);
     gst_object_unref (send_rtp_sink);
+  } else {
+    gst_structure_free (twcc_packets);
   }
 
   g_object_notify (G_OBJECT (rtpsession), "twcc-stats");
index 70f69db881837529613c38c3b6604b4311fc68ce..9dbf424fc0c267865476de2421709ffa3bf4f60f 100644 (file)
@@ -2998,8 +2998,12 @@ rtp_session_process_twcc (RTPSession * sess, guint32 sender_ssrc,
 
   RTP_SESSION_UNLOCK (sess);
   if (sess->callbacks.notify_twcc)
-    sess->callbacks.notify_twcc (sess, twcc_packets_s, twcc_stats_s,
-        sess->notify_twcc_user_data);
+    sess->callbacks.notify_twcc (sess, g_steal_pointer (&twcc_packets_s),
+        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);
 }
 
index d91fa4ac4df7aa7a52aff2a1328f675be52b3153..79f0b1f2fb0b7ad3dda8c23698d66e790068b705 100644 (file)
@@ -159,6 +159,9 @@ typedef void (*RTPSessionNotifyNACK) (RTPSession *sess,
 
 /**
  * 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
  *
  * Notifies of Transport-wide congestion control packets and stats.