fix(capture): use ffmpeg rolling fps value for currentFps display — fixes wrong framerate shown on recorder tiles
This commit is contained in:
parent
d654f7c8a1
commit
97d725537b
1 changed files with 7 additions and 6 deletions
|
|
@ -1091,12 +1091,13 @@ exit "$BMXRC"
|
||||||
if (m) {
|
if (m) {
|
||||||
this.state.framesReceived = parseInt(m[1], 10);
|
this.state.framesReceived = parseInt(m[1], 10);
|
||||||
this.state.lastFrameAt = new Date().toISOString();
|
this.state.lastFrameAt = new Date().toISOString();
|
||||||
if (this.state.recordingStartedAt) {
|
// Use ffmpeg's own rolling fps value — it is a short-window average
|
||||||
const elapsedSec = (Date.now() - this.state.recordingStartedAt) / 1000;
|
// computed by ffmpeg itself and correctly reflects the true encode rate.
|
||||||
if (elapsedSec > 0) {
|
// The previous frame/elapsed cumulative calculation dragged low during
|
||||||
this.state.currentFps = Math.round((this.state.framesReceived / elapsedSec) * 100) / 100;
|
// startup and was permanently wrong for growing-path (bash orchestrator
|
||||||
}
|
// stderr doesn't emit frame= lines until ffmpeg flushes them).
|
||||||
}
|
const ffmpegFps = parseFloat(m[2]);
|
||||||
|
if (ffmpegFps > 0) this.state.currentFps = Math.round(ffmpegFps * 100) / 100;
|
||||||
}
|
}
|
||||||
if (/Connection refused|No route to host|Connection failed|Input\/output error|Server returned|404 Not Found|Connection timed out/i.test(text)) {
|
if (/Connection refused|No route to host|Connection failed|Input\/output error|Server returned|404 Not Found|Connection timed out/i.test(text)) {
|
||||||
this.state.lastError = text.trim().slice(0, 240);
|
this.state.lastError = text.trim().slice(0, 240);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue