fix(server): 完善列车接近音频的处理与日志记录

新增列车接近音频入队和构建失败的日志输出
调整音频任务优先级为1,中断模式改为ifLower
修复音频构建为空时的静默失败问题
This commit is contained in:
2026-08-03 10:22:04 +08:00
parent 101d392840
commit a36b21cfaf
2 changed files with 20 additions and 12 deletions
+5 -2
View File
@@ -2027,18 +2027,21 @@ function handleTrainApproaching(ws, data) {
const audioId = `approaching-${stationCode}-${Date.now()}`;
const built = buildSequenceWavFile(seq);
if (built) {
log('INFO', `Pre-arrival audio queued for ${stationName}: ${audioId} (${built.durationSec.toFixed(2)}s)`);
enqueueStationAudioTask(stationName, ws, {
audioFormat: built.audioFormat,
sourcePath: built.sourcePath,
streamUrl: built.streamUrl,
durationSec: built.durationSec,
priority: 0,
interruptMode: 'none',
priority: 1,
interruptMode: 'ifLower',
source: 'train_approaching',
audioId,
consoleStreamStart: { type: 'stream_start', station: stationName, seq, streamName: getStationStreamName(stationName), hlsUrl: getStationHlsUrl(getStationStreamName(stationName)) },
consoleStreamEnd: { type: 'stream_end', station: stationName }
});
} else {
log('WARN', `Pre-arrival audio build returned empty for ${stationName}: ${audioId}`);
}
}