Browse Source

修复通话卡顿

newdev_shunjiawei
fdp 1 year ago
parent
commit
b516385ac5
  1. 27
      local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/IntegratedSpeechTranslationService.swift

27
local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/IntegratedSpeechTranslationService.swift

@ -485,22 +485,13 @@ import os.log
// 合成进行中事件 - 修改为返回音频数据
synthesizer?.addSynthesizingEventHandler { [weak self] (synthesizer, event) in
guard let self = self else { return }
// 安全解包audioData
// 安全解包audioData
guard let audioData = event.result.audioData else {
os_log("合成进行中事件,音频数据为空", log: self.log, type: .debug)
return
}
os_log("合成进行中事件,音频数据长度: %d bytes", log: self.log, type: .debug, audioData.count)
os_log("合成进行中事件,音频数据长度: %d bytes", log: self.log, type: .debug, audioData.count)
DispatchQueue.main.async {
// 立即返回当前生成的音频数据
self.eventCallback?.onSynthesisAudioGenerated(text: "", audioData: audioData)
}
}
// 合成完成事件
@ -508,11 +499,19 @@ import os.log
guard let self = self else { return }
os_log("合成完成事件", log: self.log, type: .info)
// 安全解包audioData
guard let audioData = event.result.audioData else {
os_log("合成完成事件,音频数据为空", log: self.log, type: .debug)
return
}
os_log("合成完成事件,音频数据长度: %d bytes", log: self.log, type: .debug, audioData.count)
DispatchQueue.main.async {
self.serviceState.isSynthesizing = false
self.eventCallback?.onStateChanged(component: "Synthesis", isActive: false)
self.serviceState.isSynthesizing = false
// 立即返回当前生成的音频数据
self.eventCallback?.onSynthesisAudioGenerated(text: "", audioData: audioData)
self.eventCallback?.onStateChanged(component: "Synthesis", isActive: false)
}
}
// 合成取消事件

Loading…
Cancel
Save