refactor(kling): 优化时长匹配逻辑,使用固定阈值替代比例计算
This commit is contained in:
@@ -135,10 +135,13 @@ const isExceed = computed(() => props.audioDurationMs > props.faceDurationMs)
|
||||
|
||||
const diffMs = computed(() => Math.abs(props.audioDurationMs - props.faceDurationMs))
|
||||
|
||||
/** 时长差异阈值:3秒内视为匹配 */
|
||||
const MATCH_THRESHOLD_MS = 3000
|
||||
|
||||
const diffStatus = computed(() => {
|
||||
if (props.audioDurationMs === 0) return 'none'
|
||||
if (props.audioDurationMs > props.faceDurationMs) return 'exceed'
|
||||
if (props.audioDurationMs < props.faceDurationMs * 0.5) return 'short'
|
||||
if (props.faceDurationMs - props.audioDurationMs > MATCH_THRESHOLD_MS) return 'short'
|
||||
return 'match'
|
||||
})
|
||||
|
||||
|
||||
@@ -156,7 +156,7 @@ export const useDigitalHumanStore = defineStore('digitalHuman', () => {
|
||||
if (!timeline.value || timeline.value.audioDurationMs === 0) return 'none'
|
||||
const { videoDurationMs, audioDurationMs } = timeline.value
|
||||
if (audioDurationMs > videoDurationMs) return 'exceed'
|
||||
if (audioDurationMs < videoDurationMs * 0.3) return 'too-short'
|
||||
if (videoDurationMs - audioDurationMs > 3000) return 'too-short'
|
||||
return 'match'
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user