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

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(); state.oneMinuteTimeTimer.cancel();
} }
stopProcessing(); stopProcessing();
state.listData.value = Uint8List(0);
} }
} }

View File

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

View File

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