Add new statistics type for 'remote-outbound-rtp' 10/272710/4
authorSangchul Lee <sc11.lee@samsung.com>
Wed, 23 Mar 2022 02:48:18 +0000 (11:48 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Fri, 25 Mar 2022 01:34:03 +0000 (10:34 +0900)
New statistics type is added as below.
 - WEBRTC_STATS_TYPE_REMOTE_OUTBOUND_RTP

Property enum is added as below for this type
 - WEBRTC_STATS_PROP_REMOTE_TIMESTAMP

Example codes are also added to the doxygen of
webrtc_foreach_stats().

[Version] 0.3.74
[Issue Type] API

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

index 0b5d3c73fbdadcc7259d73440804fac407b6db7e..dbf3f1de3001d3641353b8fac2b925fa7a18259c 100644 (file)
@@ -281,7 +281,8 @@ typedef enum {
        WEBRTC_STATS_TYPE_CODEC                = 0x0001,   /**< Codec */
        WEBRTC_STATS_TYPE_INBOUND_RTP          = 0x0002,   /**< Inbound RTP */
        WEBRTC_STATS_TYPE_OUTBOUND_RTP         = 0x0004,   /**< Outbound RTP */
-       WEBRTC_STATS_TYPE_REMOTE_INBOUND_RTP   = 0x0008    /**< Remote inbound RTP */
+       WEBRTC_STATS_TYPE_REMOTE_INBOUND_RTP   = 0x0008,   /**< Remote inbound RTP */
+       WEBRTC_STATS_TYPE_REMOTE_OUTBOUND_RTP  = 0x000F    /**< Remote outbound RTP */
 } webrtc_stats_type_e;
 
 /**
@@ -293,7 +294,8 @@ typedef enum {
        WEBRTC_STATS_TYPE_CODEC | \
        WEBRTC_STATS_TYPE_INBOUND_RTP | \
        WEBRTC_STATS_TYPE_OUTBOUND_RTP | \
-       WEBRTC_STATS_TYPE_REMOTE_INBOUND_RTP
+       WEBRTC_STATS_TYPE_REMOTE_INBOUND_RTP | \
+       WEBRTC_STATS_TYPE_REMOTE_OUTBOUND_RTP
 
 /**
  * @brief Definition for mask value used by #webrtc_stats_prop_e that represents properties of RTC stats.
@@ -359,6 +361,14 @@ typedef enum {
  */
 #define WEBRTC_STATS_REMOTE_INBOUND_RTP_STREAM    0x00004000
 
+/**
+ * @brief Definition for mask value used by #webrtc_stats_prop_e that represents properties of RTC remote outbound RTP stream stats.
+ * @since_tizen 7.0
+ * @remarks It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcremoteoutboundrtpstreamstats.
+ * @see webrtc_stats_prop_e
+ */
+#define WEBRTC_STATS_REMOTE_OUTBOUND_RTP_STREAM    0x00008000
+
 /**
  * @brief Enumeration for WebRTC statistics property.
  * @since_tizen 7.0
@@ -387,9 +397,10 @@ typedef enum {
        WEBRTC_STATS_PROP_FIR_COUNT          = WEBRTC_STATS_INBOUND_RTP_STREAM | WEBRTC_STATS_OUTBOUND_RTP_STREAM | 0x02, /**< FIR packets */
        WEBRTC_STATS_PROP_PLI_COUNT          = WEBRTC_STATS_INBOUND_RTP_STREAM | WEBRTC_STATS_OUTBOUND_RTP_STREAM | 0x03, /**< PLI packets */
        WEBRTC_STATS_PROP_NACK_COUNT         = WEBRTC_STATS_INBOUND_RTP_STREAM | WEBRTC_STATS_OUTBOUND_RTP_STREAM | 0x04, /**< NACK packets */
-       WEBRTC_STATS_PROP_LOCAL_ID           = WEBRTC_STATS_REMOTE_INBOUND_RTP_STREAM | 0x01, /**< Local id */
-       WEBRTC_STATS_PROP_ROUND_TRIP_TIME    = WEBRTC_STATS_REMOTE_INBOUND_RTP_STREAM | 0x02, /**< Round trip time */
-       WEBRTC_STATS_PROP_FRACTION_LOST      = WEBRTC_STATS_REMOTE_INBOUND_RTP_STREAM | 0x03, /**< Fraction lost */
+       WEBRTC_STATS_PROP_ROUND_TRIP_TIME    = WEBRTC_STATS_REMOTE_INBOUND_RTP_STREAM | 0x01, /**< Round trip time */
+       WEBRTC_STATS_PROP_FRACTION_LOST      = WEBRTC_STATS_REMOTE_INBOUND_RTP_STREAM | 0x02, /**< Fraction lost */
+       WEBRTC_STATS_PROP_REMOTE_TIMESTAMP   = WEBRTC_STATS_REMOTE_OUTBOUND_RTP_STREAM | 0x01, /**< Remote timestamp */
+       WEBRTC_STATS_PROP_LOCAL_ID           = WEBRTC_STATS_REMOTE_INBOUND_RTP_STREAM | WEBRTC_STATS_REMOTE_OUTBOUND_RTP_STREAM | 0x01, /**< Local id */
 } webrtc_stats_prop_e;
 
 /**
@@ -2606,6 +2617,15 @@ int webrtc_data_channel_unset_buffered_amount_low_cb(webrtc_data_channel_h chann
  * @retval #WEBRTC_ERROR_INVALID_STATE Invalid state
  * @pre @a webrtc state must be set to #WEBRTC_STATE_PLAYING.
  * @post webrtc_stats_cb() will be invoked.
+ * @par Example
+ * @code
+       if (webrtc_foreach_stats(webrtc, WEBRTC_STATS_TYPE_ALL, __stats_cb, user_data) != WEBRTC_ERROR_NONE)
+               return error;
+       ... or ...
+       if (webrtc_foreach_stats(webrtc, WEBRTC_STATS_TYPE_INBOUND_RTP | WEBRTC_STATS_TYPE_REMOTE_OUTBOUND_RTP,
+               __stats_cb, user_data) != WEBRTC_ERROR_NONE)
+               return error;
+ * @endcode
  */
 int webrtc_foreach_stats(webrtc_h webrtc, int type_mask, webrtc_stats_cb callback, void *user_data);
 
index c2cd6eebd0d597ccf8fe9aa823ce4924028039bd..74421c2d07b8dc79fd16d5ec436d41aa90905885 100644 (file)
@@ -1,6 +1,6 @@
 Name:       capi-media-webrtc
 Summary:    A WebRTC library in Tizen Native API
-Version:    0.3.73
+Version:    0.3.74
 Release:    0
 Group:      Multimedia/API
 License:    Apache-2.0
index a6ab3e6f9c1f256c99fd16c9ffd87b2ca930408b..ccbc36e7adb85a1f3a1fe2052c8795ce47054518 100644 (file)
@@ -174,8 +174,8 @@ static stats_field_s __stats_remote_inbound_rtp_stream_fields[] = {
  *  "remote-timestamp"    G_TYPE_DOUBLE               the remote timestamp at which these statistics were sent by the remote endpoint
  */
 static stats_field_s __stats_remote_outbound_rtp_stream_fields[] = {
-       { "local-id", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
-       { "remote-timestamp", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
+       { "local-id", WEBRTC_STATS_PROP_LOCAL_ID, 0 },
+       { "remote-timestamp", WEBRTC_STATS_PROP_REMOTE_TIMESTAMP, 0 },
        { NULL, 0, 0 }
 };
 
@@ -507,7 +507,7 @@ static void __stats_remote_inbound_rtp_invoke_callback(const GstStructure *s, we
 
 static void __stats_remote_outbound_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 };
        RET_IF(user_data == NULL, "user_data is NULL");
 
        LOG_DEBUG_ENTER();
@@ -621,7 +621,6 @@ typedef struct {
 } parse_stats_s;
 
 /* Definitions below are not exported types due to the incompletion. */
-#define WEBRTC_STATS_TYPE_REMOTE_OUTBOUND_RTP  0x000F   /**< Remote Outbound RTP */
 #define WEBRTC_STATS_TYPE_PEER_CONNECTION      0x0010   /**< Peer Connection */
 #define WEBRTC_STATS_TYPE_CSRC                 0x0020   /**< CSRC */
 #define WEBRTC_STATS_TYPE_DATA_CHANNEL         0x0040   /**< Data Channel */