Include SRT into viewer stats

This commit is contained in:
Ingo Oppermann 2022-07-21 13:46:13 +02:00
parent 2f40d96412
commit 0ee4e42360
No known key found for this signature in database
GPG Key ID: 2AB32426E9DD229E

View File

@ -1340,7 +1340,7 @@ class Restreamer {
bitrate_kbit: 0,
};
const [val, err] = await this._call(this.api.ActiveSessions, ['ffmpeg', 'hls', 'rtmp']);
const [val, err] = await this._call(this.api.ActiveSessions, ['ffmpeg', 'hls', 'rtmp', 'srt']);
if (err !== null) {
return sessions;
}
@ -1389,6 +1389,21 @@ class Restreamer {
sessions.bitrate_kbit += val.rtmp[i].bandwidth_tx_kbit;
}
// SRT sessions
if (!val.srt) {
val.srt = [];
}
for (let i = 0; i < val.srt.length; i++) {
if (!val.srt[i].reference.startsWith(this.channel.channelid)) {
continue;
}
sessions.sessions++;
sessions.bitrate_kbit += val.srt[i].bandwidth_tx_kbit;
}
return sessions;
}