Skip to content

Commit 6218612

Browse files
committed
add send jitter metric
1 parent 4bf9218 commit 6218612

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

scripts/get-user-media.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ if (navigator.getUserMedia) {
154154
if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
155155
const nativeGetUserMedia = navigator.mediaDevices.getUserMedia.bind(navigator.mediaDevices)
156156
navigator.mediaDevices.getUserMedia = async function (constraints, ...args) {
157-
log(`getUserMedia:`, constraints)
157+
log(`getUserMedia:`, JSON.stringify(constraints, null, 2))
158158
try {
159159
overrideGetUserMedia(constraints)
160160
} catch (err) {
@@ -192,7 +192,7 @@ if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {
192192
if (navigator.mediaDevices && navigator.mediaDevices.getDisplayMedia) {
193193
const nativeGetDisplayMedia = navigator.mediaDevices.getDisplayMedia.bind(navigator.mediaDevices)
194194
navigator.mediaDevices.getDisplayMedia = async function (constraints, ...args) {
195-
log(`getDisplayMedia:`, constraints)
195+
log(`getDisplayMedia:`, JSON.stringify(constraints, null, 2))
196196
let stopFakeScreenshare = null
197197
if (window.PARAMS?.fakeScreenshare) {
198198
stopFakeScreenshare = await webrtcperf.setupFakeScreenshare(window.PARAMS?.fakeScreenshare)

scripts/peer-connection-stats.js

+4
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ async function getPeerConnectionStats(id, pc, now, raw = false, verbose = false)
127127
s.packetsLost = remoteInboundRtpStreamStats.packetsLost
128128
s.totalRoundTripTime = remoteInboundRtpStreamStats.totalRoundTripTime
129129
s.roundTripTimeMeasurements = remoteInboundRtpStreamStats.roundTripTimeMeasurements
130+
s.jitter = remoteInboundRtpStreamStats.jitter
130131
}
131132
const {
132133
kind,
@@ -146,6 +147,7 @@ async function getPeerConnectionStats(id, pc, now, raw = false, verbose = false)
146147
nackCount,
147148
totalRoundTripTime,
148149
roundTripTimeMeasurements,
150+
jitter,
149151
totalEncodeTime,
150152
totalPacketSendDelay,
151153
} = s
@@ -165,6 +167,7 @@ async function getPeerConnectionStats(id, pc, now, raw = false, verbose = false)
165167
pliCountReceived: pliCount,
166168
totalRoundTripTime,
167169
roundTripTimeMeasurements,
170+
jitter,
168171
totalEncodeTime,
169172
totalPacketSendDelay,
170173
qualityLimitationResolutionChanges,
@@ -201,6 +204,7 @@ async function getPeerConnectionStats(id, pc, now, raw = false, verbose = false)
201204
'pliCountReceived',
202205
'totalRoundTripTime',
203206
'roundTripTimeMeasurements',
207+
'jitter',
204208
'totalEncodeTime',
205209
'totalPacketSendDelay',
206210
].forEach(prop => maxOptional(values.outboundRtp, outboundRtp, prop))

scripts/screenshare.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ webrtcperf.setupFakeScreenshare = ({
3939
wrapper.setAttribute('id', 'webrtcperf-fake-screenshare')
4040
wrapper.setAttribute(
4141
'style',
42-
`position: fixed; top: 0; left: 0; width: ${width}px; height: ${height}px; z-index: -1; background-color: black; isolation: isolate; transform-style: flat;`,
42+
`all: unset; position: fixed; top: 0; left: 0; width: ${width}px; height: ${height}px; z-index: -1; background-color: black; isolation: isolate; transform-style: flat;`,
4343
)
4444
document.body.appendChild(wrapper)
4545
window.GET_DISPLAY_MEDIA_CROP = '#webrtcperf-fake-screenshare'
@@ -60,7 +60,7 @@ webrtcperf.setupFakeScreenshare = ({
6060
img.setAttribute('src', `https://picsum.photos/seed/${i + 1}/${width}/${height}`)
6161
img.setAttribute(
6262
'style',
63-
`position: absolute; width: ${width}px; height: ${height}px; transform: translateX(100%); opacity: 0;`,
63+
`all: unset; position: absolute; width: ${width}px; height: ${height}px; transform: translateX(100%); opacity: 0;`,
6464
)
6565
wrapper.appendChild(img)
6666
slidesElements.push(img)

src/rtcstats.ts

+7
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ export enum RtcStatsMetricNames {
110110
audioSentNackCountRecv = 'audioSentNackCountRecv',
111111
/** The sent audio round trip time. */
112112
audioSentRoundTripTime = 'audioSentRoundTripTime',
113+
/** The sent audio jitter. */
114+
audioSentJitter = 'audioSentJitter',
113115
/** The audio RTC transport round trip time. */
114116
audioSentTransportRoundTripTime = 'audioSentTransportRoundTripTime',
115117
/** The sent audio encoding max bitrate. */
@@ -161,6 +163,8 @@ export enum RtcStatsMetricNames {
161163
videoSentRoundTripTime = 'videoSentRoundTripTime',
162164
/** The transport send video round trip time. */
163165
videoSentTransportRoundTripTime = 'videoSentTransportRoundTripTime',
166+
/** The video sent jitter. */
167+
videoSentJitter = 'videoSentJitter',
164168
/** The sent video RTX packets. */
165169
videoSentRetransmittedPackets = 'videoSentRetransmittedPackets',
166170

@@ -208,6 +212,8 @@ export enum RtcStatsMetricNames {
208212
screenSentRoundTripTime = 'screenSentRoundTripTime',
209213
/** The transport sent screen round trip time. */
210214
screenSentTransportRoundTripTime = 'screenSentTransportRoundTripTime',
215+
/** The screen sent jitter. */
216+
screenSentJitter = 'screenSentJitter',
211217
/** The screen audio RTX packets. */
212218
screenSentRetransmittedPackets = 'screenSentRetransmittedPackets',
213219

@@ -439,6 +445,7 @@ export function updateRtcStats(
439445
setStats(stats, (prefix + 'SentNackCountRecv') as RtcStatsMetricNames, key, outboundRtp.nackCount)
440446
//setStats(stats, prefix + 'SentPacketsLostCount', key, outboundRtp.packetsLost)
441447
setStats(stats, (prefix + 'SentRoundTripTime') as RtcStatsMetricNames, key, outboundRtp.roundTripTime)
448+
setStats(stats, (prefix + 'SentJitter') as RtcStatsMetricNames, key, outboundRtp.jitter)
442449
setStats(
443450
stats,
444451
(prefix + 'SentTransportRoundTripTime') as RtcStatsMetricNames,

0 commit comments

Comments
 (0)