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.

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
Value:
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]typeThe statistics type
[in]prop_infoThe statistics property information
[in]user_dataThe user data passed from the callback registration function
Returns:
true to continue with the next iteration of the loop, otherwise false 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

Enumeration for WebRTC statistics property.

Since :
7.0
Enumerator:
WEBRTC_STATS_PROP_TIMESTAMP 

Timestamp

WEBRTC_STATS_PROP_ID 

Id

WEBRTC_STATS_PROP_PAYLOAD_TYPE 

Payload type

WEBRTC_STATS_PROP_CLOCK_RATE 

Clock rate

WEBRTC_STATS_PROP_CHANNELS 

Channels

WEBRTC_STATS_PROP_MIME_TYPE 

MIME type

WEBRTC_STATS_PROP_CODEC_TYPE 

Codec type

WEBRTC_STATS_PROP_SDP_FMTP_LINE 

SDP FMTP line

WEBRTC_STATS_PROP_SSRC 

SSRC

WEBRTC_STATS_PROP_TRANSPORT_ID 

Transport id

WEBRTC_STATS_PROP_CODEC_ID 

Codec id

WEBRTC_STATS_PROP_PACKETS_RECEIVED 

Packets received

WEBRTC_STATS_PROP_PACKETS_LOST 

Packets lost

WEBRTC_STATS_PROP_PACKETS_DISCARDED 

Packets discarded

WEBRTC_STATS_PROP_JITTER 

Jitter

WEBRTC_STATS_PROP_BYTES_RECEIVED 

Bytes received

WEBRTC_STATS_PROP_PACKETS_DUPLICATED 

Packets duplicated

WEBRTC_STATS_PROP_BYTES_SENT 

Bytes sent

WEBRTC_STATS_PROP_PACKETS_SENT 

Packets sent

WEBRTC_STATS_PROP_REMOTE_ID 

Remote id

WEBRTC_STATS_PROP_FIR_COUNT 

FIR packets

WEBRTC_STATS_PROP_PLI_COUNT 

PLI packets

WEBRTC_STATS_PROP_NACK_COUNT 

NACK packets

WEBRTC_STATS_PROP_ROUND_TRIP_TIME 

Round trip time

WEBRTC_STATS_PROP_FRACTION_LOST 

Fraction lost

WEBRTC_STATS_PROP_REMOTE_TIMESTAMP 

Remote timestamp

WEBRTC_STATS_PROP_LOCAL_ID 

Local id

Enumeration for statistics property data type.

Since :
7.0
Enumerator:
WEBRTC_STATS_PROP_TYPE_BOOL 

Boolean type

WEBRTC_STATS_PROP_TYPE_INT 

Signed integer type

WEBRTC_STATS_PROP_TYPE_UINT 

Unsigned integer type

WEBRTC_STATS_PROP_TYPE_INT64 

64-bit signed integer type

WEBRTC_STATS_PROP_TYPE_UINT64 

64-bit unsigned integer type

WEBRTC_STATS_PROP_TYPE_FLOAT 

Float type

WEBRTC_STATS_PROP_TYPE_DOUBLE 

Double type

WEBRTC_STATS_PROP_TYPE_STRING 

String type

Enumeration for WebRTC statistics type.

Since :
7.0
Enumerator:
WEBRTC_STATS_TYPE_CODEC 

Codec

WEBRTC_STATS_TYPE_INBOUND_RTP 

Inbound RTP

WEBRTC_STATS_TYPE_OUTBOUND_RTP 

Outbound RTP

WEBRTC_STATS_TYPE_REMOTE_INBOUND_RTP 

Remote inbound RTP

WEBRTC_STATS_TYPE_REMOTE_OUTBOUND_RTP 

Remote outbound RTP


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]webrtcWebRTC handle
[in]type_maskThe mask values of webrtc_stats_type_e combined with bitwise 'or'
[in]callbackCallback function pointer
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
WEBRTC_ERROR_NONESuccessful
WEBRTC_ERROR_INVALID_PARAMETERInvalid parameter
WEBRTC_ERROR_INVALID_STATEInvalid 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;