From 1ad91adf89b35b23dcaa3f696422f0a1b1438275 Mon Sep 17 00:00:00 2001 From: Jackson Vieira Date: Sat, 26 Aug 2023 02:29:15 -0300 Subject: [PATCH] Fix audio activity detection for downstreams Replaced the non-existent `track` property in `RTCStatsType` with the valid `inbound-rtp` property. --- static/galene.js | 2 +- static/protocol.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/static/galene.js b/static/galene.js index 6521641..c0b6769 100644 --- a/static/galene.js +++ b/static/galene.js @@ -767,7 +767,7 @@ function gotDownStats(stats) { c.pc.getReceivers().forEach(r => { let tid = r.track && r.track.id; let s = tid && stats[tid]; - let energy = s && s['track'] && s['track'].audioEnergy; + let energy = s && s['inbound-rtp'] && s['inbound-rtp'].audioEnergy; if(typeof energy === 'number') maxEnergy = Math.max(maxEnergy, energy); }); diff --git a/static/protocol.js b/static/protocol.js index a7ede26..cd4c6cc 100644 --- a/static/protocol.js +++ b/static/protocol.js @@ -1466,7 +1466,7 @@ Stream.prototype.updateStats = async function() { if(report) { for(let r of report.values()) { - if(rtid && r.type === 'track') { + if(rtid && r.type === 'inbound-rtp') { if(!('totalAudioEnergy' in r)) continue; if(!stats[rtid])