1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
//! Statistics module for WebRTC.
//!
//! This module provides:
//! - `stats` - W3C WebRTC Statistics API types
//! - `report` - Statistics report generation
//!
//! # Feeding what the engine cannot measure
//!
//! The engine is a transport: members that need an encoder, a decoder, capture or playout are
//! left out of the report until the application supplies them, through
//! [`RTCPeerConnection::update_decoder_stats`](crate::peer_connection::RTCPeerConnection::update_decoder_stats),
//! [`update_audio_receiver_stats`](crate::peer_connection::RTCPeerConnection::update_audio_receiver_stats),
//! [`update_encoder_stats`](crate::peer_connection::RTCPeerConnection::update_encoder_stats),
//! [`update_audio_source_stats`](crate::peer_connection::RTCPeerConnection::update_audio_source_stats),
//! [`update_video_source_stats`](crate::peer_connection::RTCPeerConnection::update_video_source_stats)
//! and
//! [`update_audio_playout_stats`](crate::peer_connection::RTCPeerConnection::update_audio_playout_stats).
//! The socket is the application's too: what it could not send and what its receive-side
//! congestion control estimates reach the candidate pair in use through
//! [`on_send_discarded`](crate::peer_connection::RTCPeerConnection::on_send_discarded) and
//! [`update_available_incoming_bitrate`](crate::peer_connection::RTCPeerConnection::update_available_incoming_bitrate).
//!
//! # Ids and timestamps
//!
//! An id is opaque: it is stable for its object for the life of the peer connection, differs
//! from one connection to the next, and is found by following a reference from another object
//! of the report or through the report's typed accessors, never built by hand. Every timestamp
//! of a report is epoch milliseconds on one wall-clock anchor, so two timestamps differ by
//! exactly the time between the instants they describe; a remote-inbound or remote-outbound
//! object is stamped with the arrival of the RTCP report it was built from.
//!
//! # Stats Selection
//!
//! When calling `get_stats()`, you can optionally provide a [`StatsSelector`]
//! to filter the returned statistics to only those relevant to a specific
//! sender or receiver.
//!
//! # Examples
//!
//! ```
//! use rtci::peer_connection::RTCPeerConnection;
//! use rtci::rtp_transceiver::RTCRtpSenderId;
//! use rtci::statistics::StatsSelector;
//! use std::time::Instant;
//!
//! # fn example(pc: &mut RTCPeerConnection, sender_id: RTCRtpSenderId) {
//! // Get all stats
//! let all_stats = pc.get_stats(Instant::now(), StatsSelector::None);
//!
//! // Get stats for a specific sender
//! let sender_stats = pc.get_stats(Instant::now(), StatsSelector::Sender(sender_id));
//! # }
//! ```
use crate;
pub
// What the application measures and the engine cannot (encoding, decoding, capture,
// playout), for the `update_*_stats` methods of `RTCPeerConnection` (see `feed`).
pub use ;
/// Selector for filtering statistics in `get_stats()`.
///
/// This enum corresponds to the optional `selector` parameter in the
/// W3C WebRTC `getStats()` method. When provided, it filters the returned
/// statistics to only those relevant to the specified sender or receiver.
///
/// # Specification
///
/// See [The stats selection algorithm](https://www.w3.org/TR/webrtc/#the-stats-selection-algorithm)
///
/// # Variants
///
/// - `None` - Return all statistics for the entire connection
/// - `Sender` - Return statistics for a specific RTP sender and referenced objects
/// - `Receiver` - Return statistics for a specific RTP receiver and referenced objects