Skip to content

Commit

Permalink
Fix quality test on iOS (#267)
Browse files Browse the repository at this point in the history
Safari on iOS uses the latest webrtc-stats spec, which uses kind, not mediaType: https://www.w3.org/TR/webrtc-stats/.

I am leaving the old `mediaType` property check in, in case some browsers use it.
  • Loading branch information
jeffswartz authored Feb 14, 2024
1 parent fb6d04e commit 0a2c0fc
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/NetworkTest/testQuality/helpers/getPublisherRtcStatsReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const extractOutboundRtpStats = (
const videoStats = [];
const audioStats = [];
for (const stats of outboundRtpStats) {
if (stats.mediaType === 'video') {
if (stats.kind === 'video' || stats.mediaType === 'video') {
const kbs = calculateVideoBitrate(stats, previousStats);
const { ssrc, bytesSent: byteSent, timestamp: currentTimestamp } = stats;
const baseStats = { kbs, ssrc, byteSent, currentTimestamp };
Expand All @@ -82,7 +82,7 @@ const extractOutboundRtpStats = (
pliCount: stats.pliCount || 0,
nackCount: stats.nackCount || 0,
});
} else if (stats.mediaType === 'audio') {
} else if (stats.kind === 'audio' || stats.mediaType === 'audio') {
const kbs = calculateAudioBitrate(stats, previousStats);
const { ssrc, bytesSent: byteSent, timestamp: currentTimestamp } = stats;
const baseStats = { kbs, ssrc, byteSent, currentTimestamp };
Expand Down Expand Up @@ -126,15 +126,6 @@ const extractPublisherStats = (
const transportProtocol = localCandidate?.protocol || 'N/A';
const timestamp = localCandidate?.timestamp || 0;

/**
console.info("availableOutgoingBitrate: ", availableOutgoingBitrate);
console.info("currentRoundTripTime: ", currentRoundTripTime);
console.info("simulcastEnabled: ", simulcastEnabled);
console.info("transportProtocol: ", transportProtocol);
console.info("availableOutgoingBitrate: ", availableOutgoingBitrate);
console.info("videoByteSent: ", videoByteSent);
**/

return {
videoStats,
audioStats,
Expand Down

0 comments on commit 0a2c0fc

Please sign in to comment.