quality monitor, delay displays as 0 when fps is 0 (#8441)

Signed-off-by: 21pages <sunboeasy@gmail.com>
This commit is contained in:
21pages 2024-06-22 09:39:02 +08:00 committed by GitHub
parent 1a21dff5d4
commit 3742b51d58
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 7 deletions

View File

@ -498,8 +498,10 @@ class QualityMonitor extends StatelessWidget {
children: [
_row("Speed", qualityMonitorModel.data.speed ?? '-'),
_row("FPS", qualityMonitorModel.data.fps ?? '-'),
// let delay be 0 if fps is 0
_row(
"Delay", "${qualityMonitorModel.data.delay ?? '-'}ms",
"Delay",
"${qualityMonitorModel.data.delay == null ? '-' : (qualityMonitorModel.data.fps ?? "").replaceAll(' ', '').replaceAll('0', '').isEmpty ? 0 : qualityMonitorModel.data.delay}ms",
rightColor: Colors.green),
_row("Target Bitrate",
"${qualityMonitorModel.data.targetBitrate ?? '-'}kb"),

View File

@ -519,12 +519,12 @@ class QualityMonitor: Reactor.Component
$(#quality-monitor).content(<QualityMonitor />);
handler.updateQualityStatus = function(speed, fps, delay, bitrate, codec_format, chroma) {
speed ? qualityMonitorData[0] = speed:null;
fps ? qualityMonitorData[1] = fps:null;
delay ? qualityMonitorData[2] = delay:null;
bitrate ? qualityMonitorData[3] = bitrate:null;
codec_format ? qualityMonitorData[4] = codec_format:null;
chroma ? qualityMonitorData[5] = chroma:null;
if (speed !== null) qualityMonitorData[0] = speed;
if (fps !== null) qualityMonitorData[1] = fps;
if (delay !== null) qualityMonitorData[2] = qualityMonitorData[1] === 0 ? 0 : delay;
if (bitrate !== null) qualityMonitorData[3] = bitrate;
if (codec_format !== null) qualityMonitorData[4] = codec_format;
if (chroma !== null) qualityMonitorData[5] = chroma;
qualityMonitor.update();
}