diff --git a/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart b/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart index 44c1fcbd..c8313cf0 100755 --- a/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart +++ b/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_logic.dart @@ -77,6 +77,9 @@ class ConfiguringWifiLogic extends BaseGetXController { if (reply is GatewayGetStatusReply) { _replyGatewayGetStatusReply(reply); } + if (reply is GatewayGetStatusReply) { + _replyStatusInfo(reply); + } }); } @@ -329,4 +332,6 @@ class ConfiguringWifiLogic extends BaseGetXController { break; } } + + void _replyStatusInfo(reply) {} } diff --git a/lib/main/lockDetail/videoLog/videoLogDetail/controlsOverlay_page.dart b/lib/main/lockDetail/videoLog/videoLogDetail/controlsOverlay_page.dart index 9b25cdad..665aed93 100755 --- a/lib/main/lockDetail/videoLog/videoLogDetail/controlsOverlay_page.dart +++ b/lib/main/lockDetail/videoLog/videoLogDetail/controlsOverlay_page.dart @@ -151,39 +151,39 @@ class _ControlsOverlayState extends State { DateTool().dateToYMDHNString( widget.recordData.operateDate.toString()), style: TextStyle(color: Colors.white, fontSize: 20.sp)), - Expanded(child: SizedBox(width: 10.w)), - Container( - width: 50.w, - height: 50.w, - padding: EdgeInsets.all(10.w), - child: Image( - width: 50.w, - height: 50.w, - image: const AssetImage( - 'images/main/icon_lockDetail_monitoringShareVideo_white.png')), - ), - SizedBox(width: 20.w), - Container( - width: 50.w, - height: 50.w, - padding: EdgeInsets.all(10.w), - child: Image( - width: 50.w, - height: 50.w, - image: const AssetImage( - 'images/main/icon_lockDetail_monitoringDownloadVideo_white.png')), - ), - SizedBox(width: 20.w), - Container( - width: 50.w, - height: 50.w, - padding: EdgeInsets.all(10.w), - child: Image( - width: 50.w, - height: 50.w, - image: const AssetImage( - 'images/main/icon_lockDetail_monitoringDeletVideo_white.png')), - ), + // Expanded(child: SizedBox(width: 10.w)), + // Container( + // width: 50.w, + // height: 50.w, + // padding: EdgeInsets.all(10.w), + // child: Image( + // width: 50.w, + // height: 50.w, + // image: const AssetImage( + // 'images/main/icon_lockDetail_monitoringShareVideo_white.png')), + // ), + // SizedBox(width: 20.w), + // Container( + // width: 50.w, + // height: 50.w, + // padding: EdgeInsets.all(10.w), + // child: Image( + // width: 50.w, + // height: 50.w, + // image: const AssetImage( + // 'images/main/icon_lockDetail_monitoringDownloadVideo_white.png')), + // ), + // SizedBox(width: 20.w), + // Container( + // width: 50.w, + // height: 50.w, + // padding: EdgeInsets.all(10.w), + // child: Image( + // width: 50.w, + // height: 50.w, + // image: const AssetImage( + // 'images/main/icon_lockDetail_monitoringDeletVideo_white.png')), + // ), ], ), ), diff --git a/lib/main/lockMian/lockMain/lockMain_page.dart b/lib/main/lockMian/lockMain/lockMain_page.dart index 0c655d42..6b875202 100755 --- a/lib/main/lockMian/lockMain/lockMain_page.dart +++ b/lib/main/lockMian/lockMain/lockMain_page.dart @@ -1,14 +1,17 @@ import 'dart:async'; import 'dart:convert'; +import 'dart:io'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; +import 'package:flutter_pcm_sound/flutter_pcm_sound.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get.dart'; import 'package:star_lock/app_settings/app_colors.dart'; import 'package:star_lock/blue/blue_manage.dart'; import 'package:star_lock/main/lockMian/lockList/lockList_xhj_page.dart'; import 'package:star_lock/main/lockMian/lockMain/lockMain_state.dart'; +import 'package:star_lock/talk/call/g711.dart'; import 'package:star_lock/talk/startChart/proto/talk_data.pb.dart'; import 'package:star_lock/talk/startChart/proto/talk_expect.pb.dart'; import 'package:star_lock/talk/startChart/proto/talk_request.pb.dart'; diff --git a/lib/talk/startChart/handle/other/talke_ping_over_time_timer_manager.dart b/lib/talk/startChart/handle/other/talke_ping_over_time_timer_manager.dart index 12cc2e51..4d0e0601 100644 --- a/lib/talk/startChart/handle/other/talke_ping_over_time_timer_manager.dart +++ b/lib/talk/startChart/handle/other/talke_ping_over_time_timer_manager.dart @@ -36,6 +36,7 @@ class TalkePingOverTimeTimerManager { StartChartManage().sendTalkHangupMessage(); talkStatus.setNotTalkPing(); talkStatus.setEnd(); + Get.back(); } } diff --git a/lib/talk/startChart/views/talkView/talk_view_logic.dart b/lib/talk/startChart/views/talkView/talk_view_logic.dart index 2c11489e..65adc0b5 100644 --- a/lib/talk/startChart/views/talkView/talk_view_logic.dart +++ b/lib/talk/startChart/views/talkView/talk_view_logic.dart @@ -1,5 +1,7 @@ import 'dart:async'; +import 'dart:ffi'; import 'dart:io'; +import 'dart:math'; import 'dart:typed_data'; import 'dart:ui' as ui; @@ -11,6 +13,7 @@ import 'package:flutter_screen_recording/flutter_screen_recording.dart'; import 'package:flutter_voice_processor/flutter_voice_processor.dart'; import 'package:gallery_saver/gallery_saver.dart'; import 'package:get/get.dart'; +import 'package:get_storage/get_storage.dart'; import 'package:image_gallery_saver/image_gallery_saver.dart'; import 'package:path_provider/path_provider.dart'; import 'package:permission_handler/permission_handler.dart'; @@ -23,15 +26,12 @@ import 'package:star_lock/main/lockDetail/lockDetail/lockDetail_state.dart'; import 'package:star_lock/main/lockDetail/lockDetail/lockNetToken_entity.dart'; import 'package:star_lock/network/api_repository.dart'; import 'package:star_lock/talk/call/g711.dart'; - import 'package:star_lock/talk/startChart/constant/talk_status.dart'; import 'package:star_lock/talk/startChart/proto/talk_data.pb.dart'; import 'package:star_lock/talk/startChart/proto/talk_data.pbenum.dart'; import 'package:star_lock/talk/startChart/proto/talk_expect.pb.dart'; import 'package:star_lock/talk/startChart/start_chart_manage.dart'; - import 'package:star_lock/talk/startChart/views/talkView/talk_view_state.dart'; - import 'package:star_lock/tools/bugly/bugly_tool.dart'; import 'package:star_lock/tools/storage.dart'; @@ -43,7 +43,8 @@ class TalkViewLogic extends BaseGetXController { Timer? _syncTimer; // 音视频播放刷新率定时器 Timer? _audioTimer; // 音视频播放刷新率定时器 int _startTime = 0; // 开始播放时间戳,用于判断帧数据中的时间戳位置 - int bufferSize = 50; // 缓冲区大小(以帧为单位) + int bufferSize = 40; // 缓冲区大小(以帧为单位) + int audioBufferSize = 500; // 缓冲区大小(以帧为单位) int frameIntervalMs = 45; // 初始帧间隔设置为45毫秒(约22FPS) int audioFrameIntervalMs = 20; // 初始帧间隔设置为45毫秒(约22FPS) @@ -85,18 +86,13 @@ class TalkViewLogic extends BaseGetXController { void _startListenTalkData() { state.talkDataRepository.talkDataStream.listen((TalkData talkData) async { final contentType = talkData.contentType; - int currentTimestamp = DateTime.now().millisecondsSinceEpoch; // 判断数据类型,进行分发处理 switch (contentType) { case TalkData_ContentTypeE.G711: - if (state.audioBuffer.length >= bufferSize) { + if (state.audioBuffer.length >= audioBufferSize) { state.audioBuffer.removeAt(0); // 丢弃最旧的数据 - // readAudioBufferSize.removeAt(0); // 丢弃最旧的数据 } state.audioBuffer.add(talkData); // 添加新数据 - - // readAudioBufferSize.add(talkData.content); - break; case TalkData_ContentTypeE.Image: if (state.videoBuffer.length >= bufferSize) { @@ -132,9 +128,8 @@ class TalkViewLogic extends BaseGetXController { /// 播放音频数据 void _playAudioData(TalkData talkData) async { if (state.isOpenVoice.value) { - // final list = G711().convertList(talkData.content); - final list = G711().convertList(talkData.content); - // final list = G711().decodeAndDenoise(talkData.content, true,8000, 300, 50); + final list = + G711().decodeAndDenoise(talkData.content, true, 8000, 300, 150); // // 将 PCM 数据转换为 PcmArrayInt16 final PcmArrayInt16 fromList = PcmArrayInt16.fromList(list); FlutterPcmSound.feed(fromList); @@ -166,9 +161,9 @@ class TalkViewLogic extends BaseGetXController { void _adjustFrameInterval() { int newFrameIntervalMs = frameIntervalMs; if (state.networkStatus.value == NetworkStatus.lagging) { - bufferSize = 30; // 增大缓冲区 + bufferSize = 60; // 增大缓冲区 } else { - bufferSize = 20; // 恢复默认缓冲区大小 + bufferSize = 40; // 恢复默认缓冲区大小 } if (state.videoBuffer.length < 10 && frameIntervalMs < maxFrameIntervalMs) { @@ -445,6 +440,9 @@ class TalkViewLogic extends BaseGetXController { state.videoBuffer.clear(); // 清空视频缓冲区 _syncTimer?.cancel(); // 取消定时器 _syncTimer = null; // 释放定时器引用 + _audioTimer?.cancel(); + _audioTimer = null; // 释放定时器引用 + stopProcessingAudio(); super.onClose(); } diff --git a/lib/talk/startChart/views/talkView/talk_view_state.dart b/lib/talk/startChart/views/talkView/talk_view_state.dart index 6ffeae75..ccf85967 100644 --- a/lib/talk/startChart/views/talkView/talk_view_state.dart +++ b/lib/talk/startChart/views/talkView/talk_view_state.dart @@ -84,9 +84,10 @@ class TalkViewState { late VoiceProcessor? voiceProcessor; // 音频处理器、录音 final int frameLength = 320; //录音视频帧长度为640 final int sampleRate = 8000; //录音频采样率为8000 - List> recordingAudioAllFrames = >[]; // 录制音频的所有帧 + List recordingAudioAllFrames = []; // 录制音频的所有帧 + List lockRecordingAudioAllFrames = []; // 录制音频的所有帧 RxInt rotateAngle = 0.obs; // 旋转角度(以弧度为单位) RxBool isLongPressing = false.obs; // 旋转角度(以弧度为单位) RxBool hasAudioData = false.obs; // 是否有音频数据 RxInt lastAudioTimestamp = 0.obs; // 最后接收到的音频数据的时间戳 -} +} \ No newline at end of file