Add new statistics type for 'inbound-rtp' 06/272606/8
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 21 Mar 2022 13:12:24 +0000 (22:12 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 25 Mar 2022 01:24:01 +0000 (10:24 +0900)
New statistics type is added as below.
 - WEBRTC_STATS_TYPE_INBOUND_RTP

Property enums are added as below for this type
 - WEBRTC_STATS_PROP_SSRC
 - WEBRTC_STATS_PROP_TRANSPORT_ID
 - WEBRTC_STATS_PROP_CODEC_ID
 - WEBRTC_STATS_PROP_PACKETS_RECEIVED
 - WEBRTC_STATS_PROP_PACKETS_LOST
 - WEBRTC_STATS_PROP_PACKETS_DISCARDED
 - WEBRTC_STATS_PROP_JITTER
 - WEBRTC_STATS_PROP_REMOTE_ID
 - WEBRTC_STATS_PROP_BYTES_RECEIVED
 - WEBRTC_STATS_PROP_PACKETS_DUPLICATED
 - WEBRTC_STATS_PROP_FIR_COUNT
 - WEBRTC_STATS_PROP_PLI_COUNT
 - WEBRTC_STATS_PROP_NACK_COUNT

[Version] 0.3.71
[Issue Type] API

Change-Id: I2e1d4f7bd65659dcdb9931c6df7505e3180836e9
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
include/webrtc.h
packaging/capi-media-webrtc.spec
src/webrtc_stats.c

index 852d0ce445129fb7cc8fc92a4c7d8c99ca58e874..1c00f8cfea0c7d6dda2055f43255a017f5d78507 100644 (file)
@@ -279,6 +279,7 @@ typedef enum {
  */
 typedef enum {
        WEBRTC_STATS_TYPE_CODEC                = 0x0001,   /**< Codec */
+       WEBRTC_STATS_TYPE_INBOUND_RTP          = 0x0002,   /**< Inbound RTP */
 } webrtc_stats_type_e;
 
 /**
@@ -286,10 +287,12 @@ typedef enum {
  * @since_tizen 7.0
  * @see webrtc_foreach_stats()
  */
-#define WEBRTC_STATS_TYPE_ALL  WEBRTC_STATS_TYPE_CODEC
+#define WEBRTC_STATS_TYPE_ALL \
+       WEBRTC_STATS_TYPE_CODEC | \
+       WEBRTC_STATS_TYPE_INBOUND_RTP
 
 /**
- * @brief Definition for mask value used by #webrtc_stats_prop_e that represents properties of rtc stats.
+ * @brief Definition for mask value used by #webrtc_stats_prop_e that represents properties of RTC stats.
  * @since_tizen 7.0
  * @remarks It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcstats.
  * @see webrtc_stats_prop_e
@@ -297,26 +300,63 @@ typedef enum {
 #define WEBRTC_STATS_COMMON    0x00000100
 
 /**
- * @brief Definition for mask value used by #webrtc_stats_prop_e that represents properties of rtc codec stats.
+ * @brief Definition for mask value used by #webrtc_stats_prop_e that represents properties of RTC codec stats.
  * @since_tizen 7.0
  * @remarks It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtccodecstats.
  * @see webrtc_stats_prop_e
  */
-#define WEBRTC_STATS_CODEC     0x00000200
+#define WEBRTC_STATS_CODEC    0x00000200
+
+/**
+ * @brief Definition for mask value used by #webrtc_stats_prop_e that represents properties of RTC RTP stream stats.
+ * @since_tizen 7.0
+ * @remarks It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcrtpstreamstats.
+ * @see webrtc_stats_prop_e
+ */
+#define WEBRTC_STATS_RTP_STREAM    0x00000400
+
+/**
+ * @brief Definition for mask value used by #webrtc_stats_prop_e that represents properties of RTC received RTP stream stats.
+ * @since_tizen 7.0
+ * @remarks It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcreceivedrtpstreamstats.
+ * @see webrtc_stats_prop_e
+ */
+#define WEBRTC_STATS_RECEIVED_RTP_STREAM    0x00000800
+
+/**
+ * @brief Definition for mask value used by #webrtc_stats_prop_e that represents properties of RTC inbound RTP stream stats.
+ * @since_tizen 7.0
+ * @remarks It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcinboundrtpstreamstats.
+ * @see webrtc_stats_prop_e
+ */
+#define WEBRTC_STATS_INBOUND_RTP_STREAM    0x00000F00
 
 /**
  * @brief Enumeration for WebRTC statistics property.
  * @since_tizen 7.0
  */
 typedef enum {
-       WEBRTC_STATS_PROP_TIMESTAMP        = WEBRTC_STATS_COMMON | 0x01,  /**< Timestamp */
-       WEBRTC_STATS_PROP_ID               = WEBRTC_STATS_COMMON | 0x02,  /**< Id */
-       WEBRTC_STATS_PROP_PAYLOAD_TYPE     = WEBRTC_STATS_CODEC | 0x01,   /**< Payload type */
-       WEBRTC_STATS_PROP_CLOCK_RATE       = WEBRTC_STATS_CODEC | 0x02,   /**< Clock rate */
-       WEBRTC_STATS_PROP_CHANNELS         = WEBRTC_STATS_CODEC | 0x03,   /**< Channels */
-       WEBRTC_STATS_PROP_MIME_TYPE        = WEBRTC_STATS_CODEC | 0x04,   /**< MIME type */
-       WEBRTC_STATS_PROP_CODEC_TYPE       = WEBRTC_STATS_CODEC | 0x05,   /**< Codec type */
-       WEBRTC_STATS_PROP_SDP_FMTP_LINE    = WEBRTC_STATS_CODEC | 0x06,   /**< SDP FMTP line */
+       WEBRTC_STATS_PROP_TIMESTAMP          = WEBRTC_STATS_COMMON | 0x01,  /**< Timestamp */
+       WEBRTC_STATS_PROP_ID                 = WEBRTC_STATS_COMMON | 0x02,  /**< Id */
+       WEBRTC_STATS_PROP_PAYLOAD_TYPE       = WEBRTC_STATS_CODEC | 0x01,   /**< Payload type */
+       WEBRTC_STATS_PROP_CLOCK_RATE         = WEBRTC_STATS_CODEC | 0x02,   /**< Clock rate */
+       WEBRTC_STATS_PROP_CHANNELS           = WEBRTC_STATS_CODEC | 0x03,   /**< Channels */
+       WEBRTC_STATS_PROP_MIME_TYPE          = WEBRTC_STATS_CODEC | 0x04,   /**< MIME type */
+       WEBRTC_STATS_PROP_CODEC_TYPE         = WEBRTC_STATS_CODEC | 0x05,   /**< Codec type */
+       WEBRTC_STATS_PROP_SDP_FMTP_LINE      = WEBRTC_STATS_CODEC | 0x06,   /**< SDP FMTP line */
+       WEBRTC_STATS_PROP_SSRC               = WEBRTC_STATS_RTP_STREAM | 0x01, /**< SSRC */
+       WEBRTC_STATS_PROP_TRANSPORT_ID       = WEBRTC_STATS_RTP_STREAM | 0x02, /**< Transport id */
+       WEBRTC_STATS_PROP_CODEC_ID           = WEBRTC_STATS_RTP_STREAM | 0x03, /**< Codec id */
+       WEBRTC_STATS_PROP_PACKETS_RECEIVED   = WEBRTC_STATS_RECEIVED_RTP_STREAM | 0x01, /**< Packets received */
+       WEBRTC_STATS_PROP_PACKETS_LOST       = WEBRTC_STATS_RECEIVED_RTP_STREAM | 0x02, /**< Packets lost */
+       WEBRTC_STATS_PROP_PACKETS_DISCARDED  = WEBRTC_STATS_RECEIVED_RTP_STREAM | 0x03, /**< Packets discarded */
+       WEBRTC_STATS_PROP_JITTER             = WEBRTC_STATS_RECEIVED_RTP_STREAM | 0x05, /**< Jitter */
+       WEBRTC_STATS_PROP_REMOTE_ID          = WEBRTC_STATS_INBOUND_RTP_STREAM | 0x01, /**< Remote id */
+       WEBRTC_STATS_PROP_BYTES_RECEIVED     = WEBRTC_STATS_INBOUND_RTP_STREAM | 0x02, /**< Bytes received */
+       WEBRTC_STATS_PROP_PACKETS_DUPLICATED = WEBRTC_STATS_INBOUND_RTP_STREAM | 0x03, /**< Packets duplicated */
+       WEBRTC_STATS_PROP_FIR_COUNT          = WEBRTC_STATS_INBOUND_RTP_STREAM | 0x04, /**< FIR packets */
+       WEBRTC_STATS_PROP_PLI_COUNT          = WEBRTC_STATS_INBOUND_RTP_STREAM | 0x05, /**< PLI packets */
+       WEBRTC_STATS_PROP_NACK_COUNT         = WEBRTC_STATS_INBOUND_RTP_STREAM | 0x06, /**< NACK packets */
 } webrtc_stats_prop_e;
 
 /**
index 44e0745ad658aff0fff55e891254c8f772101ad5..113ec52dd5beafd6c9a0342d8c1c2d1e48818eae 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.70
+Version:    0.3.71
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index ccde4ff51cd68ef1916c228a5b4c2a04bf5d4193..a8f2498e0e4ab2dae9e76b3029ba71a853dd393e 100644 (file)
@@ -73,17 +73,11 @@ static stats_field_s __stats_codec_fields[] = {
  *  "ssrc"                G_TYPE_STRING               the rtp sequence src in use
  *  "transport-id"        G_TYPE_STRING               identifier for the associated RTCTransportStats for this stream
  *  "codec-id"            G_TYPE_STRING               identifier for the associated RTCCodecStats for this stream
- *  "fir-count"           G_TYPE_UINT                 FIR requests received by the sender (only for local statistics)
- *  "pli-count"           G_TYPE_UINT                 PLI requests received by the sender (only for local statistics)
- *  "nack-count"          G_TYPE_UINT                 NACK requests received by the sender (only for local statistics)
  */
 static stats_field_s __stats_rtp_stream_fields[] = {
-       { "ssrc", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "transport-id", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "codec-id", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "fir-count", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "pli-count", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "nack-count", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
+       { "ssrc", WEBRTC_STATS_PROP_SSRC, 0 },
+       { "transport-id", WEBRTC_STATS_PROP_TRANSPORT_ID, 0 },
+       { "codec-id", WEBRTC_STATS_PROP_CODEC_ID, 0 },
        { NULL, 0, 0 }
 };
 
@@ -91,17 +85,18 @@ static stats_field_s __stats_rtp_stream_fields[] = {
  * Description below is extracted from GstWebRTCBin::get-stats:
  * RTCReceivedStreamStats supported fields (https://w3c.github.io/webrtc-stats/#receivedrtpstats-dict*)
  *
- *  "packets-received"     G_TYPE_UINT64              number of packets received (only for local inbound)
- *  "bytes-received"       G_TYPE_UINT64              number of bytes received (only for local inbound)
- *  "packets-lost"         G_TYPE_UINT                number of packets lost
- *  "jitter"               G_TYPE_DOUBLE              packet jitter measured in seconds
+ *  "packets-received"    G_TYPE_UINT64               number of packets received (only for local inbound)
+ *  "packets-lost"        G_TYPE_UINT64               number of packets lost
+ *  "packets-discarded"   G_TYPE_UINT64               number of packets discarded
+ *  "packets-repaired"    G_TYPE_UINT64               number of packets repaired
+ *  "jitter"              G_TYPE_DOUBLE               packet jitter measured in seconds
  */
 static stats_field_s __stats_received_rtp_stream_fields[] = {
-       { "packets-received", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "packets-lost", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "packets-discarded", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "packets-repaired", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "jitter", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
+       { "packets-received", WEBRTC_STATS_PROP_PACKETS_RECEIVED, 0 },
+       { "packets-lost", WEBRTC_STATS_PROP_PACKETS_LOST, 0 },
+       { "packets-discarded", WEBRTC_STATS_PROP_PACKETS_DISCARDED, 0 },
+       { "packets-repaired", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 }, /* It'll be exported after RTX verficiation */
+       { "jitter", WEBRTC_STATS_PROP_JITTER, 0 },
        { NULL, 0, 0 }
 };
 
@@ -110,14 +105,19 @@ static stats_field_s __stats_received_rtp_stream_fields[] = {
  * RTCInboundRTPStreamStats supported fields (https://w3c.github.io/webrtc-stats/#inboundrtpstats-dict*)
  *
  *  "remote-id"           G_TYPE_STRING               identifier for the associated RTCRemoteOutboundRTPStreamStats
+ *  "bytes-received"      G_TYPE_UINT64               number of bytes received (only for local inbound)
+ *  "packets-duplicated"  G_TYPE_UINT64               number of packets duplicated
+ *  "fir-count"           G_TYPE_UINT                 FIR requests sent by the receiver
+ *  "pli-count"           G_TYPE_UINT                 PLI requests sent by the receiver
+ *  "nack-count"          G_TYPE_UINT                 NACK requests sent by the receiver
  */
 static stats_field_s __stats_inbound_rtp_stream_fields[] = {
-       { "remote-id", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "bytes-received", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "packets-duplicated", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "fir-count", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "pli-count", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "nack-count", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
+       { "remote-id", WEBRTC_STATS_PROP_REMOTE_ID, 0 },
+       { "bytes-received", WEBRTC_STATS_PROP_BYTES_RECEIVED, 0 },
+       { "packets-duplicated", WEBRTC_STATS_PROP_PACKETS_DUPLICATED, 0 },
+       { "fir-count", WEBRTC_STATS_PROP_FIR_COUNT, 0 },
+       { "pli-count", WEBRTC_STATS_PROP_PLI_COUNT, 0 },
+       { "nack-count", WEBRTC_STATS_PROP_NACK_COUNT, 0 },
        { NULL, 0, 0 }
 };
 
@@ -449,7 +449,7 @@ static void __stats_codec_invoke_callback(const GstStructure *s, webrtc_stats_ty
 
 static void __stats_inbound_rtp_invoke_callback(const GstStructure *s, webrtc_stats_type_e type, stats_field_s **fields_list, promise_userdata_s *user_data)
 {
-       stats_userdata_s stats_userdata = { .p_userdata = user_data, .type = type, .fields_list = fields_list };
+       stats_userdata_s stats_userdata = { .p_userdata = user_data, .type = type, .fields_list = fields_list, .export = true };
        GstStructure *rtpjitterbuffer_stats;
        GstStructure *rtpsource_stats;
 
@@ -463,6 +463,8 @@ static void __stats_inbound_rtp_invoke_callback(const GstStructure *s, webrtc_st
                "gst-rtpjitterbuffer-stats", GST_TYPE_STRUCTURE, &rtpjitterbuffer_stats,
                "gst-rtpsource-stats", GST_TYPE_STRUCTURE, &rtpsource_stats,
                NULL);
+
+       stats_userdata.export = false; /* to skip invoking callback stats below */
        LOG_DEBUG("gst-rtpjitterbuffer-stats ---> ");
        gst_structure_foreach(rtpjitterbuffer_stats, __stats_field_foreach_cb, &stats_userdata);
        LOG_DEBUG("gst-rtpsource-stats ---> ");
@@ -612,7 +614,6 @@ typedef struct {
 } parse_stats_s;
 
 /* Definitions below are not exported types due to the incompletion. */
-#define WEBRTC_STATS_TYPE_INBOUND_RTP          0x0002   /**< Inbound RTP */
 #define WEBRTC_STATS_TYPE_OUTBOUND_RTP         0x0004   /**< Outbound RTP */
 #define WEBRTC_STATS_TYPE_REMOTE_INBOUND_RTP   0x0008   /**< Remote Inbound RTP */
 #define WEBRTC_STATS_TYPE_REMOTE_OUTBOUND_RTP  0x000F   /**< Remote Outbound RTP */