1
Fork 0

Fix audio activity detection for downstreams

Replaced the non-existent `track` property in `RTCStatsType`
with the valid `inbound-rtp` property.
This commit is contained in:
Jackson Vieira 2023-08-26 02:29:15 -03:00 committed by Juliusz Chroboczek
parent ea49756a89
commit 1ad91adf89
2 changed files with 2 additions and 2 deletions

View File

@ -767,7 +767,7 @@ function gotDownStats(stats) {
c.pc.getReceivers().forEach(r => { c.pc.getReceivers().forEach(r => {
let tid = r.track && r.track.id; let tid = r.track && r.track.id;
let s = tid && stats[tid]; 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') if(typeof energy === 'number')
maxEnergy = Math.max(maxEnergy, energy); maxEnergy = Math.max(maxEnergy, energy);
}); });

View File

@ -1466,7 +1466,7 @@ Stream.prototype.updateStats = async function() {
if(report) { if(report) {
for(let r of report.values()) { for(let r of report.values()) {
if(rtid && r.type === 'track') { if(rtid && r.type === 'inbound-rtp') {
if(!('totalAudioEnergy' in r)) if(!('totalAudioEnergy' in r))
continue; continue;
if(!stats[rtid]) if(!stats[rtid])