Skip to content
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

Expose roundTripTime, jitter metric for audio and video stream #2173

Merged
merged 2 commits into from
Apr 27, 2022
Merged

Conversation

LeviSklaroff
Copy link
Contributor

@LeviSklaroff LeviSklaroff commented Apr 18, 2022

Issue #:
RTT and uplink audio jitter were not observable metrics
Description of changes:

  • Added RTT, downlink audio jitter and uplink audio jitter

Testing:

  • Tested that values are outputted by creating temporary logging of the values

Can these tested using a demo application? Please provide reproducible step-by-step instructions. No

Checklist:

  1. Have you successfully run npm run build:release locally? Yes

  2. Do you add, modify, or delete public API definitions? If yes, has that been reviewed and approved? Yes

  3. Do you change the wire protocol, e.g. the request method? If yes, has that been reviewed and approved? No

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@LeviSklaroff LeviSklaroff requested a review from a team as a code owner April 18, 2022 22:56
@LeviSklaroff LeviSklaroff changed the title Added rtt and uplink audio jitter to observable metrics Added rtt, downlink audio jitter, and uplink audio jitter to observable metrics Apr 18, 2022
CHANGELOG.md Outdated
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add `roundTripTime`, `audioUplinkJitter`, and `audioDownlinkJitter` to observable metrics
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this require any browser specific documentation or existing doc updates?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't have any doc for metricsDidReceive event for WebRTC metrics. I think it's fine.

@@ -37,7 +37,7 @@ export default class ClientMetricReport {
};

decoderLossPercent = (metricName?: string, ssrc?: number): number => {
const metricReport = ssrc ? this.streamMetricReports[ssrc] : this.globalMetricReport;
const metricReport = this.streamMetricReports[ssrc];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only for streamMetricReport, and the metric does not exist in globalMetricReport, so removed the code to reduce confusion.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have a snippet in our Quality, Bandwidth, and Connectivity guide that we can update. I think it would be good to add some more details on how it works, but I will be reworking this guide in my upcoming change if we wanna wait till then.

@@ -55,7 +55,7 @@ export default class ClientMetricReport {
};

packetLossPercent = (sourceMetricName?: string, ssrc?: number): number => {
const metricReport = ssrc ? this.streamMetricReports[ssrc] : this.globalMetricReport;
const metricReport = this.streamMetricReports[ssrc];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only for streamMetricReport, and the metric does not exist in globalMetricReport, so removed the code to reduce confusion.

@@ -162,7 +162,10 @@ export default class ClientMetricReport {
transform: this.identityValue,
type: SdkMetric.Type.VIDEO_AVAILABLE_SEND_BANDWIDTH,
},
currentRoundTripTime: { transform: this.identityValue, type: SdkMetric.Type.STUN_RTT_MS },
currentRoundTripTime: {
transform: this.secondsToMilliseconds,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type is named as STUN_RTT_MS, which means the metrics should be converted to millisecond based.

@@ -175,7 +178,7 @@ export default class ClientMetricReport {
jitter: { transform: this.secondsToMilliseconds, type: SdkMetric.Type.RTC_MIC_JITTER_MS },
packetsSent: { transform: this.countPerSecond, type: SdkMetric.Type.RTC_MIC_PPS },
bytesSent: { transform: this.bitsPerSecond, type: SdkMetric.Type.RTC_MIC_BITRATE },
roundTripTime: { transform: this.identityValue, type: SdkMetric.Type.RTC_MIC_RTT_MS },
roundTripTime: { transform: this.secondsToMilliseconds, type: SdkMetric.Type.RTC_MIC_RTT_MS },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type is named as RTC_MIC_RTT_MS, which means the metrics should be converted to millisecond based.

@@ -227,7 +230,10 @@ export default class ClientMetricReport {
source?: string;
};
} = {
roundTripTime: { transform: this.identityValue, type: SdkMetric.Type.VIDEO_SENT_RTT_MS },
roundTripTime: {
transform: this.secondsToMilliseconds,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type is named as VIDEO_SENT_RTT_MS, which means the metrics should be converted to millisecond based.

@@ -243,6 +249,9 @@ export default class ClientMetricReport {
qpSum: { transform: this.countPerSecond, type: SdkMetric.Type.VIDEO_SENT_QP_SUM },
frameHeight: { transform: this.identityValue, type: SdkMetric.Type.VIDEO_ENCODE_HEIGHT },
frameWidth: { transform: this.identityValue, type: SdkMetric.Type.VIDEO_ENCODE_WIDTH },
jitter: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we already have jitter for audio upstream/downstream and video downstream. So add the same for video upstream.
There is no type for this metrics so leave it empty and do not send to Tincan.

Comment on lines +536 to +537
return source
? transform(source, ssrcNum)
: transform(observableVideoMetricSpec.source, ssrcNum);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the video stream related metrics only exists in streamMetricReport and it requires ssrc to locate the corresponding streamMetricReport.
Remove the code path to get metric from globalMetricReport to reduce confusion.

Copy link
Contributor

@xuesichao xuesichao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peer reviewed this PR with Levi.

@xuesichao xuesichao merged commit 5009e6e into main Apr 27, 2022
@xuesichao xuesichao deleted the addRTT branch April 27, 2022 00:51
@xuesichao xuesichao changed the title Added rtt, downlink audio jitter, and uplink audio jitter to observable metrics Expose roundTripTime, jitter metric for audio and video stream Apr 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants