Browse Source

上传扫描超时检查和微软合成失败问题

newdev_shunjiawei
liwei1dao 12 months ago
parent
commit
23e66530c0
  1. 8
      lib/modules/pairing/controllers/pairing_controller.dart
  2. 6
      local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureTtsHelper.swift

8
lib/modules/pairing/controllers/pairing_controller.dart

@ -732,7 +732,13 @@ class PairingController extends GetxController with WidgetsBindingObserver {
try { try {
// 设置超时定时器 // 设置超时定时器
_bleTimeoutTimer?.cancel(); _bleTimeoutTimer?.cancel();
_bleTimeoutTimer = Timer(const Duration(seconds: 20), () { _bleTimeoutTimer = Timer(const Duration(seconds: 10), () async {
final currentBleState = await _bleManager.getConnectionState();
if (currentBleState == 2) {
_bleTimeoutTimer?.cancel();
_transition(PairingState.completed);
return;
}
if (_currentState.value == PairingState.waitingBle) { if (_currentState.value == PairingState.waitingBle) {
_setError(ErrorType.bleTimeout, _setError(ErrorType.bleTimeout,
'bleConnectionTimeoutRetry'.tr); //BLE连接超时,请重启耳机后再试 'bleConnectionTimeoutRetry'.tr); //BLE连接超时,请重启耳机后再试

6
local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/AzureTtsHelper.swift

@ -266,8 +266,11 @@ public class AzureTtsHelper: NSObject, ITtsService {
lastSpokenText = "" lastSpokenText = ""
// 重置计数器 // 重置计数器
pendingTextCount = 0 pendingTextCount = 0
// 清空所有待处理任务并重置处理状态
taskLock.lock() taskLock.lock()
pendingTasks.removeAll() pendingTasks.removeAll()
isProcessing = false // 重置处理状态
taskLock.unlock() taskLock.unlock()
do { do {
@ -474,6 +477,9 @@ public class AzureTtsHelper: NSObject, ITtsService {
*/ */
private func recreateSynthesizer() { private func recreateSynthesizer() {
do { do {
// 强制释放旧的合成器
synthesizer = nil
// 创建音频配置 // 创建音频配置
let audioConfig: SPXAudioConfiguration? let audioConfig: SPXAudioConfiguration?
if !useInternalPlayer || customAudioOutputStream != nil { if !useInternalPlayer || customAudioOutputStream != nil {

Loading…
Cancel
Save