-
Notifications
You must be signed in to change notification settings - Fork 22.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTCRemoteInboundRtpStreamStats - plus alignment with outbound #32657
Changes from 30 commits
3881033
ca1e310
beb70b2
bef50e1
f076d94
3c9a7eb
6e60bce
612d7ea
a787ea3
63ddc88
913192b
0366148
2e1ff32
52b304a
48d9ec1
8cca13c
e92d083
de1961f
b51e1e4
5bfeea8
ca0fcf0
a7989af
2924d6d
1f4f368
88e529c
f590282
70661f0
2308288
b71598a
02b0831
21988c9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: Jitter | ||
slug: Glossary/Jitter | ||
page-type: glossary-definition | ||
--- | ||
|
||
{{GlossarySidebar}} | ||
|
||
**Jitter** is the term used in computer networking to refer to [packet delay variation](https://en.wikipedia.org/wiki/Packet_delay_variation) — the variance in the rate at which packets arrive at a destination (the average of the squared difference from the mean packet arrival rate). | ||
|
||
"High jitter" indicates that packets are arriving at significantly varying rates, possibly due to network congestion, packet loss, and routing of packets in a stream through different paths. | ||
|
||
High jitter can significantly degrade the performance of real-time web applications, including voice/video streaming and online gaming. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
title: "RTCRemoteInboundRtpStreamStats: codecId property" | ||
short-title: codecId | ||
slug: Web/API/RTCRemoteInboundRtpStreamStats/codecId | ||
page-type: web-api-instance-property | ||
browser-compat: api.RTCStatsReport.type_remote-outbound-rtp.codecId | ||
--- | ||
|
||
{{APIRef("WebRTC")}} | ||
|
||
The **`codecId`** property of the {{domxref("RTCRemoteInboundRtpStreamStats")}} dictionary is a string that uniquely identifies the object that was inspected to produce the data in the {{domxref("RTCCodecStats")}} for the {{Glossary("RTP")}} stream. | ||
|
||
`RTCRemoteInboundRtpStreamStats` and `RTCCodecStats` objects are correlated by iterating the {{domxref("RTCStatsReport")}} to find the statistics objects where `RTCRemoteInboundRtpStreamStats.codecId` is equal to {{domxref("RTCCodecStats.id")}}. | ||
|
||
## Value | ||
|
||
A string that contains the {{domxref("RTCCodecStats.id","id")}} of the object that was inspected to produce the {{domxref("RTCCodecStats")}} object associated with this RTP stream. | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
--- | ||
title: "RTCRemoteInboundRtpStreamStats: fractionLost property" | ||
short-title: fractionLost | ||
slug: Web/API/RTCRemoteInboundRtpStreamStats/fractionLost | ||
page-type: web-api-instance-property | ||
browser-compat: api.RTCStatsReport.type_remote-inbound-rtp.fractionLost | ||
--- | ||
|
||
{{APIRef("WebRTC")}} | ||
|
||
The **`fractionLost`** property of the {{domxref("RTCRemoteInboundRtpStreamStats")}} dictionary provides a value that can be used to determine the fraction of packets lost for this [synchronization source (SSRC)](/en-US/docs/Web/API/RTCRemoteInboundRtpStreamStats/ssrc) in the last reporting interval. | ||
|
||
To convert the value to a percentage, divide it by 256 and multiply by 100. | ||
For example, a value of 20 indicates a 7.8% packet loss. | ||
|
||
Note that the value may not be precisely accurate due to the way that it is calculated, but it does provides a quick and convenient measure of the link quality. | ||
|
||
## Value | ||
|
||
A number giving the fraction packet loss in the last reporting interval, multiplied by 256. | ||
The value is 0 if the calculated packet loss is negative. | ||
|
||
> [!NOTE] | ||
> The value comes from the 8-bit `fraction lost` field of the last Sender Report (SR) or Receiver Report (RR) RTCP packet. | ||
> The algorithm for calculating the value is defined in [RFC 3550, Appendix A.3: Determining Number of Packets Expected and Lost](https://datatracker.ietf.org/doc/html/rfc3550#appendix-A.3). | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- {{rfc("3550","SR: Sender Report RTCP Packet", "6.4.1")}} | ||
- {{rfc("3550","RR: Receiver Report RTCP Packet", "6.4.2")}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: "RTCRemoteInboundRtpStreamStats: id property" | ||
short-title: id | ||
slug: Web/API/RTCRemoteInboundRtpStreamStats/id | ||
page-type: web-api-instance-property | ||
browser-compat: api.RTCStatsReport.type_remote-inbound-rtp.id | ||
--- | ||
|
||
{{APIRef("WebRTC")}} | ||
|
||
The **`id`** property of the {{domxref("RTCRemoteInboundRtpStreamStats")}} dictionary is a string that uniquely identifies the object for which this object provides statistics. | ||
|
||
Using the `id`, you can correlate this statistics object with others, in order to monitor statistics over time for a given WebRTC object, such as an {{domxref("RTCPeerConnection")}}, or an {{domxref("RTCDataChannel")}}. | ||
|
||
## Value | ||
|
||
A string that uniquely identifies the object for which this `RTCRemoteInboundRtpStreamStats` object provides statistics. | ||
|
||
The format of the ID string is not defined by the specification, so you cannot reliably make any assumptions about the contents of the string, or assume that the format of the string will remain unchanged for a given object type. | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,113 @@ | ||
--- | ||
title: RTCRemoteInboundRtpStreamStats | ||
slug: Web/API/RTCRemoteInboundRtpStreamStats | ||
page-type: web-api-interface | ||
browser-compat: api.RTCStatsReport.type_remote-inbound-rtp | ||
--- | ||
|
||
{{APIRef("WebRTC")}} | ||
|
||
The **`RTCRemoteInboundRtpStreamStats`** dictionary of the [WebRTC API](/en-US/docs/Web/API/WebRTC_API) is used to report statistics from the remote endpoint about a particular incoming RTP stream. | ||
These will correspond to an outgoing RTP stream at the local end of the {{domxref("RTCPeerConnection")}}. | ||
|
||
The statistics can be obtained by iterating the {{domxref("RTCStatsReport")}} returned by {{domxref("RTCPeerConnection.getStats()")}} or {{domxref("RTCRtpReceiver.getStats()")}} until you find a report with the [`type`](#type) of `remote-inbound-rtp`. | ||
|
||
## Instance properties | ||
|
||
### Remote inbound specific statistics | ||
|
||
<!-- RTCRemoteInboundRtpStreamStats --> | ||
|
||
- {{domxref("RTCRemoteInboundRtpStreamStats.fractionLost", "fractionLost")}} {{optional_inline}} | ||
- : A number indicating the fraction of packets lost for this SSRC since the last sender or receiver report. | ||
- {{domxref("RTCRemoteInboundRtpStreamStats.localId", "localId")}} {{optional_inline}} | ||
- : A string that is used to find the local {{domxref("RTCOutboundRtpStreamStats")}} object that shares the same [synchronization source (SSRC)](/en-US/docs/Web/API/RTCRemoteInboundRtpStreamStats/ssrc). | ||
- {{domxref("RTCRemoteInboundRtpStreamStats.roundTripTime", "roundTripTime")}} {{optional_inline}} | ||
- : A number that indicates the estimated round trip time (RTT) for this SSRC, in seconds. | ||
This property will not exist until valid RTT data has been received. | ||
- {{domxref("RTCRemoteInboundRtpStreamStats.roundTripTimeMeasurements", "roundTripTimeMeasurements")}} {{optional_inline}} | ||
- : A positive integer indicating the total number of valid round trip time measurements received for this [synchronization source (SSRC)](#ssrc). | ||
- {{domxref("RTCRemoteInboundRtpStreamStats.totalRoundTripTime", "totalRoundTripTime")}} {{optional_inline}} | ||
- : A number indicating the cumulative sum of all round trip time measurements since the beginning of the session, in seconds. | ||
The average round trip time can be computed by dividing `totalRoundTripTime` by [`roundTripTimeMeasurements`](#roundtriptimemeasurements). | ||
|
||
### Received RTP stream statistics | ||
|
||
<!-- RTCReceivedRtpStreamStats --> | ||
|
||
- {{domxref("RTCRemoteInboundRtpStreamStats.jitter", "jitter")}} {{optional_inline}} | ||
- : A number indicating the {{glossary("jitter", "packet jitter")}} for this synchronization source, measured in seconds. | ||
- {{domxref("RTCRemoteInboundRtpStreamStats.packetsLost", "packetsLost")}} {{optional_inline}} | ||
- : An integer indicating the total number of RTP packets lost for this SSRC, as measured at the remote endpoint. | ||
This value can be negative if duplicate packets were received. | ||
- {{domxref("RTCRemoteInboundRtpStreamStats.packetsReceived", "packetsReceived")}} {{optional_inline}} | ||
- : A positive integer indicating the total number of RTP packets received for this SSRC, including retransmissions. | ||
|
||
### Common RTP stream statistics | ||
|
||
<!-- RTCRtpStreamStats --> | ||
|
||
- {{domxref("RTCRemoteInboundRtpStreamStats.codecId", "codecId")}} {{optional_inline}} | ||
- : A string that uniquely identifies the object that was inspected to produce the {{domxref("RTCCodecStats")}} object associated with this {{Glossary("RTP")}} stream. | ||
- {{domxref("RTCRemoteInboundRtpStreamStats.kind", "kind")}} | ||
- : A string indicating whether the {{domxref("MediaStreamTrack")}} associated with the stream is an audio or a video track. | ||
- {{domxref("RTCRemoteInboundRtpStreamStats.ssrc", "ssrc")}} | ||
- : A positive integer that identifies the SSRC of the RTP packets in this stream. | ||
- {{domxref("RTCRemoteInboundRtpStreamStats.transportId", "transportId")}} {{optional_inline}} | ||
- : A string that uniquely identifies the object which was inspected to produce the {{domxref("RTCTransportStats")}} object associated with this RTP stream. | ||
|
||
### Common instance properties | ||
|
||
The following properties are common to all WebRTC statistics objects. | ||
|
||
<!-- RTCStats --> | ||
|
||
- {{domxref("RTCRemoteInboundRtpStreamStats.id", "id")}} | ||
- : A string that uniquely identifies the object that is being monitored to produce this set of statistics. | ||
- {{domxref("RTCRemoteInboundRtpStreamStats.timestamp", "timestamp")}} | ||
- : A {{domxref("DOMHighResTimeStamp")}} object indicating the time at which the sample was taken for this statistics object. | ||
- {{domxref("RTCRemoteInboundRtpStreamStats.type", "type")}} | ||
- : A string with the value `"inbound-rtp"`, indicating the type of statistics that the object contains. | ||
|
||
## Examples | ||
|
||
Given a variable `peerConnection` that is an instance of an {{domxref("RTCPeerConnection")}}, the code below uses `await` to wait for the statistics report, and then iterates it using `RTCStatsReport.forEach()`. | ||
It then filters the dictionaries for just those reports that have the type of `remote-inbound-rtp` and logs the result. | ||
|
||
```js | ||
const stats = await myPeerConnection.getStats(); | ||
|
||
stats.forEach((report) => { | ||
if (report.type === "remote-inbound-rtp") { | ||
console.log("Remote Inbound RTP Stream Stats:"); | ||
console.log(`id: ${report.id}`); | ||
console.log(`timestamp: ${report.timestamp}`); | ||
console.log(`transportId: ${report.transportId}`); | ||
console.log(`ssrc: ${report.ssrc}`); | ||
console.log(`kind: ${report.kind}`); | ||
console.log(`codecId: ${report.codecId}`); | ||
console.log(`packetsReceived: ${report.packetsReceived}`); | ||
console.log(`packetsLost: ${report.packetsLost}`); | ||
console.log(`jitter: ${report.jitter}`); | ||
console.log(`totalRoundTripTime: ${report.totalRoundTripTime}`); | ||
console.log( | ||
`roundTripTimeMeasurements: ${report.roundTripTimeMeasurements}`, | ||
); | ||
console.log(`roundTripTime: ${report.roundTripTime}`); | ||
console.log(`localId: ${report.localId}`); | ||
console.log(`fractionLost: ${report.fractionLost}`); | ||
} | ||
}); | ||
``` | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- {{domxref("RTCStatsReport")}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: "RTCRemoteInboundRtpStreamStats: jitter property" | ||
short-title: jitter | ||
slug: Web/API/RTCRemoteInboundRtpStreamStats/jitter | ||
page-type: web-api-instance-property | ||
browser-compat: api.RTCStatsReport.type_remote-inbound-rtp.jitter | ||
--- | ||
|
||
{{APIRef("WebRTC")}} | ||
|
||
The **`jitter`** property of the {{domxref("RTCRemoteInboundRtpStreamStats")}} dictionary returns the {{glossary("Jitter", "packet jitter")}} for the [synchronization source (SSRC)](/en-US/docs/Web/API/RTCRemoteInboundRtpStreamStats/ssrc) as measured by the remote endpoint. | ||
|
||
High packet jitter values indicate that packet arrival rates vary significantly, which may degrade video, audio, and other real-time communications over WebRTC. | ||
|
||
## Value | ||
|
||
Packet jitter, in seconds. | ||
|
||
The value is calculated using the "interarrival jitter" algorithm described in {{RFC("3550", "", "6.4.1")}}. | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- {{domxref("RTCRemoteInboundRtpStreamStats.ssrc")}} | ||
- {{domxref("RTCInboundRtpStreamStats.jitter")}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: "RTCRemoteInboundRtpStreamStats: kind property" | ||
short-title: kind | ||
slug: Web/API/RTCRemoteInboundRtpStreamStats/kind | ||
page-type: web-api-instance-property | ||
browser-compat: api.RTCStatsReport.type_remote-inbound-rtp.kind | ||
--- | ||
|
||
{{APIRef("WebRTC")}} | ||
|
||
The **`kind`** property of the {{domxref("RTCRemoteInboundRtpStreamStats")}} dictionary is a string indicating whether the described {{Glossary("RTP")}} stream contains audio or video media. | ||
|
||
This string will always be the same as the {{domxref("MediaStreamTrack.kind", "kind")}} of the {{domxref("MediaStreamTrack")}} object carried by the stream. | ||
It will also match the media type of the codec associated with this statistics objects (i.e. the MIME type of the associated codec's {{domxref("RTCCodecStats.mimeType")}} property). | ||
|
||
## Value | ||
|
||
The kind is always one of: | ||
|
||
- `"audio"` | ||
- : The stream contains audio media. | ||
- `"video"` | ||
- : The stream contains video media. | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
--- | ||
title: "RTCRemoteInboundRtpStreamStats: localId property" | ||
short-title: localId | ||
slug: Web/API/RTCRemoteInboundRtpStreamStats/localId | ||
page-type: web-api-instance-property | ||
browser-compat: api.RTCStatsReport.type_remote-inbound-rtp.localId | ||
--- | ||
|
||
{{APIRef("WebRTC")}} | ||
|
||
The {{domxref("RTCRemoteInboundRtpStreamStats")}} dictionary's **`localId`** property is a string that can be used to identify the {{domxref("RTCOutboundRtpStreamStats")}} object whose {{domxref("RTCOutboundRtpStreamStats.remoteId", "remoteId")}} matches this value. | ||
|
||
Together, these two objects provide statistics about the inbound and outbound sides of the same [synchronization source (SSRC)](/en-US/docs/Web/API/RTCRemoteInboundRtpStreamStats/ssrc). | ||
|
||
## Value | ||
|
||
A string which can be compared to the value of an {{domxref("RTCOutboundRtpStreamStats")}} object's {{domxref("RTCOutboundRtpStreamStats.remoteId", "remoteId")}} property to see if the two represent statistics for each of the two sides of the same set of data sent by the local peer. | ||
|
||
## Usage notes | ||
|
||
You can think of the local and remote views of the same RTP stream as pairs, each of which has a reference back to the other one. | ||
Thus, if an {{domxref("RTCStatsReport")}} includes an `remote-inbound-rtp` statistics object (of type `RTCRemoteInboundRtpStreamStats`), it should also have a corresponding `outbound-rtp` object. | ||
|
||
Both of these provide information about the same batch of packets being sent from the local device to the remote peer. | ||
The difference is that `outbound-rtp` offers statistics about the outgoing data from the local peer's perspective, while `remote-inbound-rtp` provides statistics about the same data from the perspective of the remote peer, as it is received. | ||
|
||
## Examples | ||
|
||
See the example in {{domxref("RTCRemoteOutboundRtpStreamStats.localId")}}. | ||
This shows how to correlate statistics about data sent from the remote peer (from the perspective of the remote peer) with the incoming data from the perspective of the local peer. | ||
|
||
The code to correlate send data from the perspective of the local peer and received data from the perspective of the remote peer would be almost the same, and can be inferred from that example. | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--- | ||
title: "RTCRemoteInboundRtpStreamStats: packetsLost property" | ||
short-title: packetsLost | ||
slug: Web/API/RTCRemoteInboundRtpStreamStats/packetsLost | ||
page-type: web-api-instance-property | ||
browser-compat: api.RTCStatsReport.type_remote-inbound-rtp.packetsLost | ||
--- | ||
|
||
{{APIRef("WebRTC")}} | ||
|
||
The **`packetsLost`** property of the {{domxref("RTCRemoteInboundRtpStreamStats")}} dictionary returns the total number of {{Glossary("RTP")}} packets lost from the [synchronization source (SSRC)](/en-US/docs/Web/API/RTCRemoteInboundRtpStreamStats/ssrc), as reported by the remote endpoint, since the beginning of reception. | ||
|
||
## Value | ||
|
||
An integer value indicating the number of lost RTP packets. | ||
|
||
This value can be negative. | ||
It is determined by subtracting the number of packets received from the number of packets that are expected. | ||
The number of packets that are expected is calculated in a way that assumes that all packets only need to be sent once (based on sequence numbers), while the number of packets received also includes any packets that had to be resent (and hence may be bigger). | ||
For more information see the "cumulative number of packets lost" section in {{RFC("3550", "", "6.4.1")}}. | ||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- {{domxref("RTCRemoteInboundRtpStreamStats.ssrc")}} | ||
- {{domxref("RTCInboundRtpStreamStats.packetsLost")}} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
title: "RTCRemoteInboundRtpStreamStats: packetsReceived property" | ||
short-title: packetsReceived | ||
slug: Web/API/RTCRemoteInboundRtpStreamStats/packetsReceived | ||
page-type: web-api-instance-property | ||
browser-compat: api.RTCStatsReport.type_remote-inbound-rtp.packetsReceived | ||
--- | ||
|
||
{{APIRef("WebRTC")}} | ||
|
||
The **`packetsReceived`** property of the {{domxref("RTCRemoteInboundRtpStreamStats")}} dictionary returns the total number of {{Glossary("RTP")}} packets received from the [synchronization source (SSRC)](/en-US/docs/Web/API/RTCRemoteInboundRtpStreamStats/ssrc) of this stream by the remote endpoint, including retransmissions. | ||
|
||
## Value | ||
|
||
A positive integer value indicating the total number of received RTP packets at the remote endpoint. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. NOTE, I am confused here. For context So for remote inbound stats my understanding is that you're getting the But the spec states for
IF we assume that by "receiving endpoint" we mean "whatever is calculating the packets received" then this works because a receiver just counts what packets it got - and that is then way we got back from the remote end in this report. I THINK the bit about "at the sending endpoint ..." is irrelevant. I.e. you might calculate the |
||
|
||
## Specifications | ||
|
||
{{Specifications}} | ||
|
||
## Browser compatibility | ||
|
||
{{Compat}} | ||
|
||
## See also | ||
|
||
- {{domxref("RTCRemoteInboundRtpStreamStats.ssrc")}} | ||
- {{domxref("RTCInboundRtpStreamStats.packetsReceived")}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is very helpful!