fix: rust_asr_asrx handles MLX Whisper non-finite JSON literals

- MLX Whisper emits 'avg_logprob: NaN' / 'compression_ratio: Infinity' when a
  clip has no intelligible audio (e.g. near-silent test clips). serde_json
  strictly refuses those literals, so rust_asr_asrx failed with
  'expected value at line 1 column 151' and asrx never completed.
- Sanitize NaN / Infinity / -Infinity literals outside strings into null
  before parsing (sanitize_json_nonfinite).
- Add no-audio-track early-out. Clean up .wav byproduct after success.

Verified on dev (m5max48): 002.mp4 asrx re-scan now completes and produces
output/df6376c8....asrx.json; processor_results asrx = completed.
This commit is contained in:
Accusys
2026-11-09 12:02:19 +08:00
parent 5caecb887f
commit c1ede4ade8
2 changed files with 170 additions and 2 deletions
+17
View File
@@ -76,9 +76,26 @@ pub async fn process_asr_asrx(
})
.unwrap_or_default();
// Clean up wav byproduct after successful processing.
cleanup_wav_byproduct(video_path);
Ok(AsrAsrxResult {
language,
segments,
recovery,
})
}
/// Clean up the .wav audio byproduct left by rust_asr_asrx.
/// The wav file is created next to the video with the same base name.
fn cleanup_wav_byproduct(video_path: &str) {
let mut wav_path = std::path::PathBuf::from(video_path);
wav_path.set_extension("wav");
if wav_path.exists() {
if let Err(e) = std::fs::remove_file(&wav_path) {
tracing::warn!("[ASR_ASRX] Failed to cleanup {}: {}", wav_path.display(), e);
} else {
tracing::info!("[ASR_ASRX] Cleaned up wav byproduct: {}", wav_path.display());
}
}
}