rtpsource: Report for which local SSRC is a remote RB reporting on 75/262775/2 accepted/tizen/6.5/unified/20211029.013354 accepted/tizen/unified/20210826.014227 submit/tizen/20210824.072619 submit/tizen_6.5/20211028.163401 tizen_6.5.m2_release
authorOlivier CrĂȘte <olivier.crete@collabora.com>
Fri, 16 Oct 2020 01:42:40 +0000 (21:42 -0400)
committerSangchul Lee <sc11.lee@samsung.com>
Mon, 23 Aug 2021 10:47:35 +0000 (10:47 +0000)
This is useful in the Bundle case because there may be multiple local
and remote SSRCs in the same session.

Change-Id: I069e36b0e16e5b0056fbfc7014d664846e25d442
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/776>

gst/rtpmanager/rtpsession.c
gst/rtpmanager/rtpsource.c
gst/rtpmanager/rtpsource.h
gst/rtpmanager/rtpstats.h

index 7aa50a6..034eb54 100644 (file)
@@ -2401,7 +2401,7 @@ rtp_session_process_rb (RTPSession * sess, RTPSource * source,
        * the sender of the RTCP message. We could also compare our stats against
        * the other sender to see if we are better or worse. */
       /* FIXME, need to keep track who the RB block is from */
-      rtp_source_process_rb (source, pinfo->ntpnstime, fractionlost,
+      rtp_source_process_rb (source, ssrc, pinfo->ntpnstime, fractionlost,
           packetslost, exthighestseq, jitter, lsr, dlsr);
     }
   }
@@ -2734,7 +2734,8 @@ rtp_session_request_local_key_unit (RTPSession * sess, RTPSource * src,
 {
   guint32 round_trip = 0;
 
-  rtp_source_get_last_rb (src, NULL, NULL, NULL, NULL, NULL, NULL, &round_trip);
+  rtp_source_get_last_rb (src, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+      &round_trip);
 
   if (src->last_keyframe_request != GST_CLOCK_TIME_NONE && round_trip) {
     GstClockTime round_trip_in_ns = gst_util_uint64_scale (round_trip,
@@ -3702,6 +3703,7 @@ session_report_blocks (const gchar * key, RTPSource * source, ReportData * data)
 
   /* store last generated RR packet */
   source->last_rr.is_valid = TRUE;
+  source->last_rr.ssrc = data->source->ssrc;
   source->last_rr.fractionlost = fractionlost;
   source->last_rr.packetslost = packetslost;
   source->last_rr.exthighestseq = exthighestseq;
index 12aa125..628005e 100644 (file)
@@ -373,6 +373,7 @@ rtp_source_create_stats (RTPSource * src)
   gboolean internal = src->internal;
   gchar *address_str;
   gboolean have_rb;
+  guint32 ssrc = 0;
   guint8 fractionlost = 0;
   gint32 packetslost = 0;
   guint32 exthighestseq = 0;
@@ -453,11 +454,12 @@ rtp_source_create_stats (RTPSource * src)
         (guint) src->last_rr.dlsr, NULL);
 
     /* get the last RB */
-    have_rb = rtp_source_get_last_rb (src, &fractionlost, &packetslost,
-        &exthighestseq, &jitter, &lsr, &dlsr, &round_trip);
+    have_rb = rtp_source_get_last_rb (src, &ssrc, &fractionlost,
+        &packetslost, &exthighestseq, &jitter, &lsr, &dlsr, &round_trip);
 
     gst_structure_set (s,
         "have-rb", G_TYPE_BOOLEAN, have_rb,
+        "rb-ssrc", G_TYPE_UINT, ssrc,
         "rb-fractionlost", G_TYPE_UINT, (guint) fractionlost,
         "rb-packetslost", G_TYPE_INT, (gint) packetslost,
         "rb-exthighestseq", G_TYPE_UINT, (guint) exthighestseq,
@@ -1445,6 +1447,7 @@ rtp_source_process_sr (RTPSource * src, GstClockTime time, guint64 ntptime,
 /**
  * rtp_source_process_rb:
  * @src: an #RTPSource
+ * @ssrc: SSRC of the local source for this this RB was sent
  * @ntpnstime: the current time in nanoseconds since 1970
  * @fractionlost: fraction lost since last SR/RR
  * @packetslost: the cumulative number of packets lost
@@ -1458,7 +1461,7 @@ rtp_source_process_sr (RTPSource * src, GstClockTime time, guint64 ntptime,
  * Update the report block in @src.
  */
 void
-rtp_source_process_rb (RTPSource * src, guint64 ntpnstime,
+rtp_source_process_rb (RTPSource * src, guint32 ssrc, guint64 ntpnstime,
     guint8 fractionlost, gint32 packetslost, guint32 exthighestseq,
     guint32 jitter, guint32 lsr, guint32 dlsr)
 {
@@ -1479,6 +1482,7 @@ rtp_source_process_rb (RTPSource * src, guint64 ntpnstime,
 
   /* update current */
   curr->is_valid = TRUE;
+  curr->ssrc = ssrc;
   curr->fractionlost = fractionlost;
   curr->packetslost = packetslost;
   curr->exthighestseq = exthighestseq;
@@ -1732,6 +1736,7 @@ rtp_source_get_last_sr (RTPSource * src, GstClockTime * time, guint64 * ntptime,
 /**
  * rtp_source_get_last_rb:
  * @src: an #RTPSource
+ * @ssrc: SSRC of the local source for this this RB was sent
  * @fractionlost: fraction lost since last SR/RR
  * @packetslost: the cumulative number of packets lost
  * @exthighestseq: the extended last sequence number received
@@ -1748,9 +1753,9 @@ rtp_source_get_last_sr (RTPSource * src, GstClockTime * time, guint64 * ntptime,
  * Returns: %TRUE if there was a valid SB report.
  */
 gboolean
-rtp_source_get_last_rb (RTPSource * src, guint8 * fractionlost,
-    gint32 * packetslost, guint32 * exthighestseq, guint32 * jitter,
-    guint32 * lsr, guint32 * dlsr, guint32 * round_trip)
+rtp_source_get_last_rb (RTPSource * src, guint32 * ssrc,
+    guint8 * fractionlost, gint32 * packetslost, guint32 * exthighestseq,
+    guint32 * jitter, guint32 * lsr, guint32 * dlsr, guint32 * round_trip)
 {
   RTPReceiverReport *curr;
 
@@ -1760,6 +1765,8 @@ rtp_source_get_last_rb (RTPSource * src, guint8 * fractionlost,
   if (!curr->is_valid)
     return FALSE;
 
+  if (ssrc)
+    *ssrc = curr->ssrc;
   if (fractionlost)
     *fractionlost = curr->fractionlost;
   if (packetslost)
index dff7b31..20e65f1 100644 (file)
@@ -249,7 +249,7 @@ GstFlowReturn   rtp_source_send_rtp            (RTPSource *src, RTPPacketInfo *p
 /* RTCP messages */
 void            rtp_source_process_sr          (RTPSource *src, GstClockTime time, guint64 ntptime,
                                                 guint32 rtptime, guint32 packet_count, guint32 octet_count);
-void            rtp_source_process_rb          (RTPSource *src, guint64 ntpnstime, guint8 fractionlost,
+void            rtp_source_process_rb          (RTPSource *src, guint32 ssrc, guint64 ntpnstime, guint8 fractionlost,
                                                 gint32 packetslost, guint32 exthighestseq, guint32 jitter,
                                                 guint32 lsr, guint32 dlsr);
 
@@ -263,7 +263,7 @@ gboolean        rtp_source_get_new_rb          (RTPSource *src, GstClockTime tim
 gboolean        rtp_source_get_last_sr         (RTPSource *src, GstClockTime *time, guint64 *ntptime,
                                                 guint32 *rtptime, guint32 *packet_count,
                                                guint32 *octet_count);
-gboolean        rtp_source_get_last_rb         (RTPSource *src, guint8 *fractionlost, gint32 *packetslost,
+gboolean        rtp_source_get_last_rb         (RTPSource *src, guint32 * ssrc, guint8 *fractionlost, gint32 *packetslost,
                                                 guint32 *exthighestseq, guint32 *jitter,
                                                 guint32 *lsr, guint32 *dlsr, guint32 *round_trip);
 
index 776651f..1804aa6 100644 (file)
@@ -51,7 +51,7 @@ typedef struct {
  */
 typedef struct {
   gboolean is_valid;
-  guint32 ssrc; /* who the report is from */
+  guint32 ssrc; /* which source is the report about */
   guint8  fractionlost;
   guint32 packetslost;
   guint32 exthighestseq;