修复对讲视频第二次卡顿问题

This commit is contained in:
Daisy 2024-01-08 11:25:36 +08:00
parent d9c76d8708
commit 2c94fb9310
3 changed files with 20 additions and 10 deletions

View File

@ -406,5 +406,6 @@ class LockMonitoringLogic extends BaseGetXController {
state.oneMinuteTimeTimer.cancel();
}
stopProcessing();
state.listData.value = Uint8List(0);
}
}

View File

@ -24,9 +24,9 @@ class LockMonitoringState {
late final VoiceProcessor? voiceProcessor;
late Timer oneMinuteTimeTimer;// 60
var oneMinuteTime = 0.obs;//
late Timer oneMinuteTimeTimer =
Timer(const Duration(seconds: 1), () {}); // 60
var oneMinuteTime = 0.obs; //
// 10
late Timer answerTimer;

View File

@ -41,6 +41,7 @@ class CallTalk {
Future<void> getAVData(Uint8List bb, int len) async {
//
if (bb[61] == 1) {
// print('音频数据来了');
Uint8List g711Data = bb.sublist(77, bb.length);
List<int> pcmBytes;
@ -62,6 +63,7 @@ class CallTalk {
}
//
else {
// print('********视频数据来了');
//
var bagLen = bb[POS_blen + 2] + bb[POS_blen + 3] * 256;
// print('音视频数据开始下标 bagLen$bagLen');
@ -69,7 +71,7 @@ class CallTalk {
// 63
int getIframeIndex =
bb[POS_iframe_index] + bb[POS_iframe_index + 1] * 256;
// print('获取帧序号 getIframeIndex$getIframeIndex');
print('获取帧序号 getIframeIndex$getIframeIndex');
// 65
// int alen = bb[POS_alen] & 0xff;
@ -82,10 +84,10 @@ class CallTalk {
// 71
int getBagIndex = bb[POS_bag_index] & 0xff;
// print('当前包号 getBagIndex$getBagIndex');
print('当前包号 getBagIndex$getBagIndex');
// 69
int getBagNum = bb[POS_bag_num] & 0xff;
// print('总包数 getBagNum$getBagNum');
print('总包数 getBagNum$getBagNum');
// 73
int blen = bb[POS_blen] + bb[POS_blen + 1] * 256;
// print('数据长度 blen$blen');
@ -114,10 +116,11 @@ class CallTalk {
// print('播放第${iframe!.iframeIndex}帧 一帧图片的hexStringData: ${Uint8List.fromList(growableList)}');
//
if (iframe!.iframeIndex == 0) {
getFirstFrame = true;
eventBus.fire(GetFirstFrameGoPush(getFirstFrame));
}
// if (iframe!.iframeIndex == 0) {
// print('得到第一帧了么');
// getFirstFrame = true;
// eventBus.fire(GetFirstFrameGoPush(getFirstFrame));
// }
eventBus.fire(GetTVDataRefreshUI(growableList));
}
@ -157,5 +160,11 @@ class CallTalk {
FlutterPcmSound.pause();
FlutterPcmSound.clear();
FlutterPcmSound.stop();
iframe = IframeInfo();
iframe!.iframeIndex = 0;
iframe!.bagNum = 0;
iframe!.bagReceive = 0;
growableList = [];
}
}