修复对讲发送录音帧序号不连续的问题

This commit is contained in:
Daisy 2024-04-12 15:23:04 +08:00
parent cbdcdab317
commit b51a53a9bd
3 changed files with 5 additions and 3 deletions

View File

@ -202,6 +202,8 @@ class LockMonitoringLogic extends BaseGetXController {
state.isButtonDisabled.value = true;
try {
await state.voiceProcessor?.stop();
state.voiceProcessor?.removeFrameListener(_onFrame);
state.udpSendDataFrameNumber = 0;
} on PlatformException catch (ex) {
state.errorMessage.value = "Failed to stop recorder: $ex";
} finally {
@ -294,7 +296,7 @@ class LockMonitoringLogic extends BaseGetXController {
topBytes[7] = ((state.udpSendDataFrameNumber & 0x0000FF00) >> 8);
// print(
// "udpSendDataFrameNumber:${state.udpSendDataFrameNumber} topBytes[63]:${topBytes[6]} topBytes[64]:${topBytes[7]}");
// "udpSendDataFrameNumber:${state.udpSendDataFrameNumber} topBytes[63]:${topBytes[6]} topBytes[64]:${topBytes[7]}");
topBytes.addAll(bytes);
Get.log("G711编码后为:$topBytes");

View File

@ -26,7 +26,7 @@ class LockMonitoringState {
var listAudioData = <int>[].obs; //
//
late final VoiceProcessor? voiceProcessor;
late VoiceProcessor? voiceProcessor;
var isProcessing = false.obs; //
var isButtonDisabled = false.obs; //
final int frameLength = 320; //320

View File

@ -151,7 +151,7 @@ class CallTalk {
FlutterPcmSound.pause();
FlutterPcmSound.clear();
FlutterPcmSound.stop();
print('已停止播放声音');
// print('已停止播放声音');
iframe = IframeInfo();
iframe!.iframeIndex = 0;