fix: TKG FPS calculation for ASRX fallback segments

When ASRX falls back to ASR segments, end_frame may be 0.
The FPS calculation now handles this case correctly by checking
both end_frame > 0 and end_time > 0 before dividing.

This prevents division by zero and incorrect FPS values when
processing videos with ASRX fallback segments.
This commit is contained in:
Accusys
2026-07-06 16:08:32 +08:00
parent dd63dbff9b
commit 765db8ae9f
+4 -1
View File
@@ -1401,8 +1401,11 @@ async fn build_speaker_face_edges_from_pg(
.collect();
let last = asrx.segments.last().unwrap();
let fps = if last.end_time > 0.0 {
let fps = if last.end_frame > 0 && last.end_time > 0.0 {
last.end_frame as f64 / last.end_time
} else if last.end_time > 0.0 {
// Fallback: estimate FPS from probe or use 30
30.0
} else {
30.0
};