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_e;
/**
*/
#define WEBRTC_STATS_TYPE_ALL \
WEBRTC_STATS_TYPE_CODEC | \
- WEBRTC_STATS_TYPE_INBOUND_RTP
+ WEBRTC_STATS_TYPE_INBOUND_RTP | \
+ WEBRTC_STATS_TYPE_OUTBOUND_RTP
/**
* @brief Definition for mask value used by #webrtc_stats_prop_e that represents properties of RTC stats.
*/
#define WEBRTC_STATS_INBOUND_RTP_STREAM 0x00000F00
+/**
+ * @brief Definition for mask value used by #webrtc_stats_prop_e that represents properties of RTC sent RTP stream stats.
+ * @since_tizen 7.0
+ * @remarks It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcsentrtpstreamstats.
+ * @see webrtc_stats_prop_e
+ */
+#define WEBRTC_STATS_SENT_RTP_STREAM 0x00001000
+
+/**
+ * @brief Definition for mask value used by #webrtc_stats_prop_e that represents properties of RTC outbound RTP stream stats.
+ * @since_tizen 7.0
+ * @remarks It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcoutboundrtpstreamstats.
+ * @see webrtc_stats_prop_e
+ */
+#define WEBRTC_STATS_OUTBOUND_RTP_STREAM 0x00002000
+
/**
* @brief Enumeration for WebRTC statistics property.
* @since_tizen 7.0
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_BYTES_RECEIVED = WEBRTC_STATS_INBOUND_RTP_STREAM | 0x01, /**< Bytes received */
+ WEBRTC_STATS_PROP_PACKETS_DUPLICATED = WEBRTC_STATS_INBOUND_RTP_STREAM | 0x02, /**< Packets duplicated */
+ WEBRTC_STATS_PROP_BYTES_SENT = WEBRTC_STATS_SENT_RTP_STREAM | 0x01, /**< Bytes sent */
+ WEBRTC_STATS_PROP_PACKETS_SENT = WEBRTC_STATS_SENT_RTP_STREAM | 0x02, /**< Packets sent */
+ WEBRTC_STATS_PROP_REMOTE_ID = WEBRTC_STATS_INBOUND_RTP_STREAM | WEBRTC_STATS_OUTBOUND_RTP_STREAM | 0x01, /**< Remote id */
+ 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_e;
/**
* "bytes-sent" G_TYPE_UINT64 number of packets sent (only for local outbound)
*/
static stats_field_s __stats_sent_rtp_stream_fields[] = {
- { "packets-sent", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
- { "bytes-sent", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
+ { "packets-sent", WEBRTC_STATS_PROP_PACKETS_SENT, 0 },
+ { "bytes-sent", WEBRTC_STATS_PROP_BYTES_SENT, 0 },
{ NULL, 0, 0 }
};
* RTCOutboundRTPStreamStats supported fields (https://w3c.github.io/webrtc-stats/#outboundrtpstats-dict*)
*
* "remote-id" G_TYPE_STRING identifier for the associated RTCRemoteInboundRTPSTreamStats
+ * "fir-count" G_TYPE_UINT FIR packets received by the sender
+ * "pli-count" G_TYPE_UINT PLI packets received by the sender
+ * "nack-count" G_TYPE_UINT NACK packets received by the sender
*/
static stats_field_s __stats_outbound_rtp_stream_fields[] = {
- { "remote-id", WEBRTC_STATS_PROP_NOT_EXPORTED, 0 },
+ { "remote-id", WEBRTC_STATS_PROP_REMOTE_ID, 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 }
};
static void __stats_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 };
GstStructure *rtpsource_stats;
RET_IF(user_data == NULL, "user_data is NULL");
gst_structure_foreach(s, __stats_field_foreach_cb, &stats_userdata);
+ stats_userdata.export = false; /* to skip invoking callback stats below */
gst_structure_get(s, "gst-rtpsource-stats", GST_TYPE_STRUCTURE, &rtpsource_stats, NULL);
LOG_DEBUG("gst-rtpsource-stats ---> ");
gst_structure_foreach(rtpsource_stats, __stats_field_foreach_cb, &stats_userdata);
} parse_stats_s;
/* Definitions below are not exported types due to the incompletion. */
-#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 */
#define WEBRTC_STATS_TYPE_PEER_CONNECTION 0x0010 /**< Peer Connection */