Tizen Native API
7.0
|
The Statistics API provides a function to retrieve all the statistics properties.
Required Header
#include <webrtc.h>
Overview
The WebRTC Statistics API provides a function to get statistics information to monitor the status of the underlying network and pipeline. You can get various properties for each statistics type as below.
- WEBRTC_STATS_TYPE_CODEC is for a codec currently being used by RTP streams
- WEBRTC_STATS_TYPE_INBOUND_RTP is for RTP stream currently received
- WEBRTC_STATS_TYPE_OUTBOUND_RTP is for RTP stream currently sent
- WEBRTC_STATS_TYPE_REMOTE_INBOUND_RTP is for the remote peer's inbound RTP stream corresponding to an outbound RTP stream
- WEBRTC_STATS_TYPE_REMOTE_OUTBOUND_RTP is for the remote peer's outbound RTP stream corresponding to an inbound RTP stream
Foreach Operations
FOREACH | CALLBACK | DESCRIPTION |
---|---|---|
webrtc_foreach_stats() | webrtc_stats_cb() | It retrieves all the statistics properties |
Functions | |
int | webrtc_foreach_stats (webrtc_h webrtc, int type_mask, webrtc_stats_cb callback, void *user_data) |
Retrieves all the statistics properties. | |
Typedefs | |
typedef bool(* | webrtc_stats_cb )(webrtc_stats_type_e type, const webrtc_stats_prop_info_s *prop_info, void *user_data) |
Called iteratively to report all the statistics properties. | |
Defines | |
#define | WEBRTC_STATS_TYPE_ALL |
Definition for all the supported statistics types mask. | |
#define | WEBRTC_STATS_COMMON 0x00000100 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC stats. | |
#define | WEBRTC_STATS_CODEC 0x00000200 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC codec stats. | |
#define | WEBRTC_STATS_RTP_STREAM 0x00000400 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC RTP stream stats. | |
#define | WEBRTC_STATS_RECEIVED_RTP_STREAM 0x00000800 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC received RTP stream stats. | |
#define | WEBRTC_STATS_INBOUND_RTP_STREAM 0x00001000 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC inbound RTP stream stats. | |
#define | WEBRTC_STATS_SENT_RTP_STREAM 0x00002000 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC sent RTP stream stats. | |
#define | WEBRTC_STATS_OUTBOUND_RTP_STREAM 0x00004000 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC outbound RTP stream stats. | |
#define | WEBRTC_STATS_REMOTE_INBOUND_RTP_STREAM 0x00008000 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC remote inbound RTP stream stats. | |
#define | WEBRTC_STATS_REMOTE_OUTBOUND_RTP_STREAM 0x00010000 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC remote outbound RTP stream stats. |
Define Documentation
#define WEBRTC_STATS_CODEC 0x00000200 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC codec stats.
- Since :
- 7.0
- Remarks:
- It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtccodecstats.
- See also:
- webrtc_stats_prop_e
#define WEBRTC_STATS_COMMON 0x00000100 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC stats.
- Since :
- 7.0
- Remarks:
- It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcstats.
- See also:
- webrtc_stats_prop_e
#define WEBRTC_STATS_INBOUND_RTP_STREAM 0x00001000 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC inbound RTP stream stats.
- Since :
- 7.0
- Remarks:
- It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcinboundrtpstreamstats.
- See also:
- webrtc_stats_prop_e
#define WEBRTC_STATS_OUTBOUND_RTP_STREAM 0x00004000 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC outbound RTP stream stats.
- Since :
- 7.0
- Remarks:
- It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcoutboundrtpstreamstats.
- See also:
- webrtc_stats_prop_e
#define WEBRTC_STATS_RECEIVED_RTP_STREAM 0x00000800 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC received RTP stream stats.
- Since :
- 7.0
- Remarks:
- It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcreceivedrtpstreamstats.
- See also:
- webrtc_stats_prop_e
#define WEBRTC_STATS_REMOTE_INBOUND_RTP_STREAM 0x00008000 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC remote inbound RTP stream stats.
- Since :
- 7.0
- Remarks:
- It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcremoteinboundrtpstreamstats.
- See also:
- webrtc_stats_prop_e
#define WEBRTC_STATS_REMOTE_OUTBOUND_RTP_STREAM 0x00010000 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC remote outbound RTP stream stats.
- Since :
- 7.0
- Remarks:
- It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcremoteoutboundrtpstreamstats.
- See also:
- webrtc_stats_prop_e
#define WEBRTC_STATS_RTP_STREAM 0x00000400 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC RTP stream stats.
- Since :
- 7.0
- Remarks:
- It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcrtpstreamstats.
- See also:
- webrtc_stats_prop_e
#define WEBRTC_STATS_SENT_RTP_STREAM 0x00002000 |
Definition for mask value used by webrtc_stats_prop_e that represents properties of RTC sent RTP stream stats.
- Since :
- 7.0
- Remarks:
- It corresponds with the values described in https://www.w3.org/TR/webrtc-stats/#dom-rtcsentrtpstreamstats.
- See also:
- webrtc_stats_prop_e
#define WEBRTC_STATS_TYPE_ALL |
WEBRTC_STATS_TYPE_CODEC | \ WEBRTC_STATS_TYPE_INBOUND_RTP | \ WEBRTC_STATS_TYPE_OUTBOUND_RTP | \ WEBRTC_STATS_TYPE_REMOTE_INBOUND_RTP | \ WEBRTC_STATS_TYPE_REMOTE_OUTBOUND_RTP
Definition for all the supported statistics types mask.
- Since :
- 7.0
- See also:
- webrtc_foreach_stats()
Typedef Documentation
typedef bool(* webrtc_stats_cb)(webrtc_stats_type_e type, const webrtc_stats_prop_info_s *prop_info, void *user_data) |
Called iteratively to report all the statistics properties.
- Since :
- 7.0
- Remarks:
- The prop_info can be used only in the callback. To use outside, make a copy.
- Parameters:
-
[in] type The statistics type [in] prop_info The statistics property information [in] user_data The user data passed from the callback registration function
- Returns:
true
to continue with the next iteration of the loop, otherwisefalse
to break out of the loop
- See also:
- webrtc_foreach_stats()
- Example
bool __stats_cb(webrtc_stats_type_e type, const webrtc_stats_prop_info_s *prop_info, void *user_data) { switch (prop_info->type) { case WEBRTC_STATS_PROP_TYPE_BOOL: printf("type[0x%x] prop[%s, 0x%08x, value:%d]\n", type, prop_info->name, prop_info->prop, prop_info->v_bool); break; case WEBRTC_STATS_PROP_TYPE_INT: printf("type[0x%x] prop[%s, 0x%08x, value:%d]\n", type, prop_info->name, prop_info->prop, prop_info->v_int); break; case WEBRTC_STATS_PROP_TYPE_INT64: printf("type[0x%x] prop[%s, 0x%08x, value:%"PRId64"]\n", type, prop_info->name, prop_info->prop, prop_info->v_int64); break; case WEBRTC_STATS_PROP_TYPE_UINT: printf("type[0x%x] prop[%s, 0x%08x, value:%u]\n", type, prop_info->name, prop_info->prop, prop_info->v_uint); break; case WEBRTC_STATS_PROP_TYPE_UINT64: printf("type[0x%x] prop[%s, 0x%08x, value:%"PRIu64"]\n", type, prop_info->name, prop_info->prop, prop_info->v_uint64); break; case WEBRTC_STATS_PROP_TYPE_FLOAT: printf("type[0x%x] prop[%s, 0x%08x, value:%f]\n", type, prop_info->name, prop_info->prop, prop_info->v_float); break; case WEBRTC_STATS_PROP_TYPE_DOUBLE: printf("type[0x%x] prop[%s, 0x%08x, value:%lf]\n", type, prop_info->name, prop_info->prop, prop_info->v_double); break; case WEBRTC_STATS_PROP_TYPE_STRING: printf("type[0x%x] prop[%s, 0x%08x, value:%s]\n", type, prop_info->name, prop_info->prop, prop_info->v_string); break; } return true; }
Enumeration Type Documentation
enum webrtc_stats_prop_e |
Enumeration for WebRTC statistics property.
- Since :
- 7.0
- Enumerator:
Enumeration for statistics property data type.
- Since :
- 7.0
- Enumerator:
enum webrtc_stats_type_e |
Function Documentation
int webrtc_foreach_stats | ( | webrtc_h | webrtc, |
int | type_mask, | ||
webrtc_stats_cb | callback, | ||
void * | user_data | ||
) |
Retrieves all the statistics properties.
- Since :
- 7.0
- Remarks:
- The registered callback will be invoked in an internal thread of the webrtc.
- Parameters:
-
[in] webrtc WebRTC handle [in] type_mask The mask values of webrtc_stats_type_e combined with bitwise 'or' [in] callback Callback function pointer [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
WEBRTC_ERROR_NONE Successful WEBRTC_ERROR_INVALID_PARAMETER Invalid parameter WEBRTC_ERROR_INVALID_STATE Invalid state
- Precondition:
- webrtc state must be set to WEBRTC_STATE_PLAYING.
- Postcondition:
- webrtc_stats_cb() will be invoked.
- Example
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;