diff --git a/lib/app_settings/app_settings.dart b/lib/app_settings/app_settings.dart index e09cf7b2..e67ef49f 100755 --- a/lib/app_settings/app_settings.dart +++ b/lib/app_settings/app_settings.dart @@ -14,7 +14,6 @@ class AppLog { } static void log(String msg, {StackTrace? stackTrace, bool? error}) { - debugPrint(msg); msg = '${DateTime.now().toIso8601String()} : $msg'; DebugConsole.info(msg, stackTrace: stackTrace, isErr: error ?? false); if (!kDebugMode) { diff --git a/lib/blue/sender_beforeDataManage.dart b/lib/blue/sender_beforeDataManage.dart index e1cb7175..09d83cca 100755 --- a/lib/blue/sender_beforeDataManage.dart +++ b/lib/blue/sender_beforeDataManage.dart @@ -65,23 +65,33 @@ class SenderBeforeDataManage { // 解析添加用户订阅 Future _replyAddUserKey(Reply reply) async { + // 检查数据长度,避免索引越界 + if (reply.data.length < 47) { + return; // 数据长度不足,直接返回 + } + final int status = reply.data[46]; switch (status) { case 0x00: //成功 - final List userNoData = reply.data.sublist(47, 49); - CommonDataManage().currentLockUserNo = listChangInt(userNoData); - CommonDataManage().currentKeyInfo.lockUserNo = CommonDataManage().currentLockUserNo; + // 再次检查长度确保sublist安全 + if (reply.data.length >= 49) { + final List userNoData = reply.data.sublist(47, 49); + CommonDataManage().currentLockUserNo = listChangInt(userNoData); + CommonDataManage().currentKeyInfo.lockUserNo = CommonDataManage().currentLockUserNo; - _updateLockUserNo(userNoData); + _updateLockUserNo(userNoData); + } break; case 0x06: //无权限 - final List token = reply.data.sublist(42, 46); - final List strTokenList = changeIntListToStringList(token); - Storage.setStringList(saveBlueToken, strTokenList); - final List addUserData = await getAddUserKeyData(tokenList: token); - eventBus.fire(LockAddUserSucceedEvent(addUserData, 1)); + if (reply.data.length >= 46) { + final List token = reply.data.sublist(42, 46); + final List strTokenList = changeIntListToStringList(token); + Storage.setStringList(saveBlueToken, strTokenList); + final List addUserData = await getAddUserKeyData(tokenList: token); + eventBus.fire(LockAddUserSucceedEvent(addUserData, 1)); + } break; case 0x0c: //锁设备用户超过 32个,需要同步锁用户列表刷新 diff --git a/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_page.dart b/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_page.dart index d3195e31..515f978d 100755 --- a/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_page.dart +++ b/lib/main/lockDetail/lockSet/configuringWifi/configuringWifi/configuringWifi_page.dart @@ -65,13 +65,6 @@ class _ConfiguringWifiPageState extends State logic.showToast('请输入WiFi密码'.tr); return; } - // 检查WiFi名称是否包含5G关键字 - if (state.wifiNameController.text - .toLowerCase() - .contains('5g')) { - logic.showToast('请确保使用2.4GHz WiFi网络'.tr); - return; - } logic.senderConfiguringWifiAction(); }, ), diff --git a/lib/network/api_provider_base.dart b/lib/network/api_provider_base.dart index be8d0fdf..7fdb032e 100755 --- a/lib/network/api_provider_base.dart +++ b/lib/network/api_provider_base.dart @@ -108,7 +108,7 @@ class BaseProvider extends GetConnect with Api { } if (res.body == null) { if (res.statusCode == null && isShowErrMsg!) { - EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 2000.milliseconds); + EasyLoading.showToast('网络访问失败,请检查网络是否正常'.tr, duration: 6000.milliseconds); } var rs = {'errorMsg': 'Network Error!', 'errorCode': -1, 'data': null, 'description': '表示成功或是。'}; return Response( diff --git a/lib/talk/starChart/handle/impl/udp_talk_hangup_handler.dart b/lib/talk/starChart/handle/impl/udp_talk_hangup_handler.dart index 30500c63..8ca69784 100644 --- a/lib/talk/starChart/handle/impl/udp_talk_hangup_handler.dart +++ b/lib/talk/starChart/handle/impl/udp_talk_hangup_handler.dart @@ -37,8 +37,6 @@ class UdpTalkHangUpHandler extends ScpMessageBaseHandle startChartManage.stopSendingRbcuInfoMessages(); startChartManage.stopSendingRbcuProBeMessages(); startChartManage.stopTalkHangupMessageTimer(); - // 设置最终结束状态 - talkStatus.setEnd(); Get.back(); } } @@ -57,8 +55,6 @@ class UdpTalkHangUpHandler extends ScpMessageBaseHandle startChartManage.stopSendingRbcuInfoMessages(); startChartManage.stopSendingRbcuProBeMessages(); startChartManage.stopTalkHangupMessageTimer(); - // 设置最终结束状态 - talkStatus.setEnd(); } @override @@ -70,13 +66,13 @@ class UdpTalkHangUpHandler extends ScpMessageBaseHandle @override deserializePayload( {required int payloadType, - required int messageType, - required List byte, - int? offset, - int? PayloadLength, - int? spTotal, - int? spIndex, - int? messageId}) { + required int messageType, + required List byte, + int? offset, + int? PayloadLength, + int? spTotal, + int? spIndex, + int? messageId}) { if (messageType == MessageTypeConstant.Resp) { final GenericResp genericResp = GenericResp(); genericResp.mergeFromBuffer(byte); diff --git a/lib/talk/starChart/handle/scp_message_base_handle.dart b/lib/talk/starChart/handle/scp_message_base_handle.dart index f799ad42..60b1d13b 100644 --- a/lib/talk/starChart/handle/scp_message_base_handle.dart +++ b/lib/talk/starChart/handle/scp_message_base_handle.dart @@ -1,13 +1,6 @@ import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; import 'dart:typed_data'; -import 'package:audioplayers/audioplayers.dart'; -import 'package:flutter_easyloading/flutter_easyloading.dart'; -import 'package:flutter_local_notifications/flutter_local_notifications.dart'; -import 'package:get/get.dart'; - import 'package:star_lock/app_settings/app_settings.dart'; import 'package:star_lock/talk/other/audio_player_manager.dart'; import 'package:star_lock/talk/starChart/constant/payload_type_constant.dart'; @@ -32,11 +25,11 @@ class ScpMessageBaseHandle { /// 使用单例 TimerManager /// 超时处理 final TalkeRequestOverTimeTimerManager talkeRequestOverTimeTimerManager = - TalkeRequestOverTimeTimerManager(); + TalkeRequestOverTimeTimerManager(); final TalkePingOverTimeTimerManager talkePingOverTimeTimerManager = - TalkePingOverTimeTimerManager(); + TalkePingOverTimeTimerManager(); final TalkDataOverTimeTimerManager talkDataOverTimeTimerManager = - TalkDataOverTimeTimerManager(); + TalkDataOverTimeTimerManager(); final startChartManage = StartChartManage(); @@ -56,7 +49,7 @@ class ScpMessageBaseHandle { // 处理出完整帧数据后的回调 final H264FrameHandler frameHandler = - H264FrameHandler(onCompleteFrame: (TalkDataModel talkDataModel) { + H264FrameHandler(onCompleteFrame: (TalkDataModel talkDataModel) { // 处理完整的帧数据 TalkDataRepository.instance.addTalkData( talkDataModel, @@ -98,10 +91,6 @@ class ScpMessageBaseHandle { // 播放铃声 void playRingtone() async { - // 监控模式下不播放铃声 - if (startChartManage.isMonitoring) { - return; - } //test:使用自定义铃声 await audioManager.playRingtone(); } diff --git a/lib/talk/starChart/star_chart_manage.dart b/lib/talk/starChart/star_chart_manage.dart index 4145429a..057363b6 100644 --- a/lib/talk/starChart/star_chart_manage.dart +++ b/lib/talk/starChart/star_chart_manage.dart @@ -94,7 +94,6 @@ class StartChartManage { final String echoPeerId = '3phX8Ng2cZHz5NtP8xAf6nYy2z1BYytoejgjoHrWMGhH'; bool isOnlineStarChartServer = false; // 星图是否上线成功 - bool isMonitoring = false; // 是否处于监控模式 Timer? reStartOnlineStartChartServerTimer; // 重新上线定时器 Timer? talkPingTimer; // 发送通话保持消息定时器 Timer? talkExpectTimer; // 发送通话预期消息定时器 @@ -162,18 +161,6 @@ class StartChartManage { await reportInformation(); } - // 优化连接建立 - // Future establishConnection({required String ToPeerId}) async { - // // 提前预加载必要资源 - // await init(); // 确保基础服务已初始化 - // - // // 并行执行地址交换和打洞 - // await Future.wait([ - // startSendingRbcuInfoMessages(ToPeerId: ToPeerId), - // startSendingRbcuProbeTMessages(), - // ] as Iterable); - // } - /// 客户端注册 Future _clientRegister(LoginData? loginData) async { if (loginData?.starchart?.starchartId != null) { @@ -434,11 +421,7 @@ class StartChartManage { } /// 启动持续发送对讲请求 - void startCallRequestMessageTimer({required String ToPeerId, bool isMonitoring = false}) async { - // 更新全局ToPeerId为当前要连接的锁的peerId - this.ToPeerId = ToPeerId; - this.lockPeerId = ToPeerId; - this.isMonitoring = isMonitoring; + void startCallRequestMessageTimer({required String ToPeerId}) async { // 如果已经处于等待接听状态就不发送 // if (talkStatus.status != TalkStatus.proactivelyCallWaitingAnswer) { // // 如果是h264则跳转至webview @@ -474,28 +457,22 @@ class StartChartManage { // 启动定时器持续发送对讲请求 talkRequestTimer ??= Timer.periodic( Duration( - milliseconds: _defaultIntervalTime, - // milliseconds: 500, + seconds: _defaultIntervalTime, ), (Timer timer) async { AppLog.log('发送对讲请求:${ToPeerId}'); await sendCallRequestMessage(ToPeerId: ToPeerId); }, ); - // 只有非监控模式才设置为等待接听状态 - if (!isMonitoring) { - talkStatus.setProactivelyCallWaitingAnswer(); - // 启动对讲请求应答超时判断 - talkeRequestOverTimeTimerManager.start(); - } + talkStatus.setProactivelyCallWaitingAnswer(); + // 启动对讲请求应答超时判断 + talkeRequestOverTimeTimerManager.start(); } /// 停止持续发送对讲请求 void stopCallRequestMessageTimer() async { talkRequestTimer?.cancel(); talkRequestTimer = null; - // 重置监控模式状态 - isMonitoring = false; } // 发送对讲请求消息 @@ -554,10 +531,6 @@ class StartChartManage { _log(text: '心跳已经开始了. 请勿重复发送心跳包消息'); return; } - // 确保定时器不存在后再创建 - // if (_heartBeatTimer != null) { - // _heartBeatTimer?.cancel(); - // } _heartBeatTimer ??= Timer.periodic( Duration( seconds: heartbeatIntervalTime, @@ -740,19 +713,13 @@ class StartChartManage { // _log(text: '发送通话保持'); } - Future _sendTalkHangupMessage() async { + void _sendTalkHangupMessage() async { final message = MessageCommand.talkHangupMessage( ToPeerId: ToPeerId, FromPeerId: FromPeerId, MessageId: MessageCommand.getNextMessageId(ToPeerId, increment: true), ); - try { - await _sendMessage(message: message); - } catch (e) { - // 记录日志但不中断程序执行 - AppLog.log('发送挂断消息失败: $e'); - // 不抛出异常,避免应用崩溃 - } + await _sendMessage(message: message); } // 发送通话中挂断消息 @@ -761,7 +728,7 @@ class StartChartManage { talkHangupTimer ??= Timer.periodic( Duration(seconds: _defaultIntervalTime), (Timer timer) async { - await _sendTalkHangupMessage(); + _sendTalkHangupMessage(); }, ); @@ -833,16 +800,9 @@ class StartChartManage { // 发送消息 Future _sendMessage({required List message}) async { var result = await _udpSocket?.send(message, InternetAddress(remoteHost), remotePort); - // 在对讲管理类中完善异常处理 - try { - // UDP发送逻辑 - } catch (e) { - // 记录错误但不影响主流程 - if (result != message.length) { - throw StartChartMessageException('❌Udp send data error----> $result ${message.length}'); - // _udpSocket = null; - } - print('对讲消息发送失败: $e'); + if (result != message.length) { + throw StartChartMessageException('❌Udp send data error----> $result ${message.length}'); + // _udpSocket = null; } //ToDo: 增加对讲调试、正式可删除 @@ -1084,24 +1044,6 @@ class StartChartManage { void _handleUdpResultData(ScpMessage scpMessage) { final int payloadType = scpMessage.PayloadType ?? 0; final int messageType = scpMessage.MessageType ?? 0; - AppLog.log('payloadType:$payloadType,messageType:$messageType'); - // 添加开锁回应的日志打印 - if (payloadType == PayloadTypeConstant.remoteUnlock) { - AppLog.log('收到蓝牙设备回应消息,${scpMessage.PayloadType}'); - // 解析回应内容 - if (scpMessage.Payload != null && scpMessage.Payload!.isNotEmpty) { - // 需要根据实际协议格式解析 - final List payload = scpMessage.Payload!; - - if (payload.length > 2) { - final int errorCode = payload[2]; - if (errorCode == 6) { - // 显示"网关正忙,请稍后再试"提示 - AppLog.log('网关正忙,请稍后再试'); - } - } - } - } try { final ScpMessageHandler handler = ScpMessageHandlerFactory.createHandler(payloadType); if (messageType == MessageTypeConstant.Req) { @@ -1260,7 +1202,7 @@ class StartChartManage { final message = MessageCommand.bleMessage( FromPeerId: FromPeerId, ToPeerId: lockPeerId, - MessageId: MessageCommand.getNextMessageId(lockPeerId, increment: true), + MessageId: MessageCommand.getNextMessageId(ToPeerId, increment: true), bluetoothDeviceName: bluetoothDeviceName, bleStructData: bleStructData, ); @@ -1275,9 +1217,6 @@ class StartChartManage { status == TalkStatus.proactivelyCallWaitingAnswer || status == TalkStatus.answeredSuccessfully || status == TalkStatus.uninitialized) { - // 先发送一次挂断消息 - await _sendTalkHangupMessage(); - // 再启动定时器确保消息能被接收 startTalkRejectMessageTimer(); startTalkHangupMessageTimer(); await Future.delayed(Duration(seconds: 1)); diff --git a/lib/talk/starChart/views/native/talk_view_native_decode_page.dart b/lib/talk/starChart/views/native/talk_view_native_decode_page.dart index 6c267e9d..79ba3a33 100644 --- a/lib/talk/starChart/views/native/talk_view_native_decode_page.dart +++ b/lib/talk/starChart/views/native/talk_view_native_decode_page.dart @@ -1,31 +1,18 @@ -import 'dart:async'; -import 'dart:math'; import 'dart:io'; import 'package:flutter/material.dart'; -import 'package:flutter/scheduler.dart'; import 'package:flutter/services.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; -import 'package:fluttertoast/fluttertoast.dart'; import 'package:get/get.dart'; import 'package:http/http.dart' as http; -import 'package:provider/provider.dart'; import 'package:star_lock/appRouters.dart'; -import 'package:star_lock/flavors.dart'; import 'package:star_lock/talk/call/callTalk.dart'; import 'package:star_lock/talk/starChart/constant/talk_status.dart'; -import 'package:star_lock/talk/starChart/handle/impl/debug_Info_model.dart'; -import 'package:star_lock/talk/starChart/handle/impl/udp_talk_data_handler.dart'; import 'package:star_lock/talk/starChart/star_chart_manage.dart'; import 'package:star_lock/talk/starChart/views/native/talk_view_native_decode_logic.dart'; import 'package:star_lock/talk/starChart/views/native/talk_view_native_decode_state.dart'; -import 'package:star_lock/talk/starChart/views/talkView/talk_view_logic.dart'; -import 'package:star_lock/talk/starChart/views/talkView/talk_view_state.dart'; -import 'package:video_decode_plugin/video_decode_plugin.dart'; import '../../../../app_settings/app_colors.dart'; -import '../../../../app_settings/app_settings.dart'; -import '../../../../tools/showTFView.dart'; class TalkViewNativeDecodePage extends StatefulWidget { const TalkViewNativeDecodePage({Key? key}) : super(key: key); @@ -76,7 +63,7 @@ class _TalkViewNativeDecodePageState extends State wit children: [ // 悬浮帧率统计信息条 Obx( - () { + () { // 防御性处理:只要loading中或textureId为null,优先渲染loading/占位 if (state.isLoading.isTrue || state.textureId.value == null) { return Image.asset( @@ -99,16 +86,16 @@ class _TalkViewNativeDecodePageState extends State wit quarterTurns: startChartManage.rotateAngle ~/ 90, child: state.isFullScreen.isFalse ? AspectRatio( - aspectRatio: StartChartManage().videoWidth / StartChartManage().videoHeight, - child: Texture( - textureId: state.textureId.value!, - filterQuality: FilterQuality.low, - ), - ) + aspectRatio: StartChartManage().videoWidth / StartChartManage().videoHeight, + child: Texture( + textureId: state.textureId.value!, + filterQuality: FilterQuality.medium, + ), + ) : Texture( - textureId: state.textureId.value!, - filterQuality: FilterQuality.low, - ), + textureId: state.textureId.value!, + filterQuality: FilterQuality.medium, + ), ), ), ), @@ -119,32 +106,32 @@ class _TalkViewNativeDecodePageState extends State wit Obx(() => state.isLoading.isTrue ? Positioned( - bottom: 310.h, - child: Text( - '正在创建安全连接...'.tr, - style: TextStyle(color: Colors.black, fontSize: 26.sp), - )) + bottom: 310.h, + child: Text( + '正在创建安全连接...'.tr, + style: TextStyle(color: Colors.black, fontSize: 26.sp), + )) : Container()), Obx(() => state.isLoading.isFalse && state.oneMinuteTime.value > 0 ? Positioned( - top: ScreenUtil().statusBarHeight + 75.h, - width: 1.sw, - child: Obx( - () { - final String sec = (state.oneMinuteTime.value % 60).toString().padLeft(2, '0'); - final String min = (state.oneMinuteTime.value ~/ 60).toString().padLeft(2, '0'); - return Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - '$min:$sec', - style: TextStyle(fontSize: 26.sp, color: Colors.white), - ), - ], - ); - }, - ), - ) + top: ScreenUtil().statusBarHeight + 75.h, + width: 1.sw, + child: Obx( + () { + final String sec = (state.oneMinuteTime.value % 60).toString().padLeft(2, '0'); + final String min = (state.oneMinuteTime.value ~/ 60).toString().padLeft(2, '0'); + return Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + '$min:$sec', + style: TextStyle(fontSize: 26.sp, color: Colors.white), + ), + ], + ); + }, + ), + ) : Container()), Positioned( bottom: 10.w, @@ -167,30 +154,30 @@ class _TalkViewNativeDecodePageState extends State wit Obx(() => state.isLoading.isTrue ? buildRotationTransition() : Container()), Obx(() => state.isLongPressing.value ? Positioned( - top: 80.h, - left: 0, - right: 0, - child: Center( - child: Container( - padding: EdgeInsets.all(10.w), - decoration: BoxDecoration( - color: Colors.black.withOpacity(0.7), - borderRadius: BorderRadius.circular(10.w), - ), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Icon(Icons.mic, color: Colors.white, size: 24.w), - SizedBox(width: 10.w), - Text( - '正在说话...'.tr, - style: TextStyle(fontSize: 20.sp, color: Colors.white), - ), - ], - ), + top: 80.h, + left: 0, + right: 0, + child: Center( + child: Container( + padding: EdgeInsets.all(10.w), + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.7), + borderRadius: BorderRadius.circular(10.w), + ), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Icon(Icons.mic, color: Colors.white, size: 24.w), + SizedBox(width: 10.w), + Text( + '正在说话...'.tr, + style: TextStyle(fontSize: 20.sp, color: Colors.white), ), - ), - ) + ], + ), + ), + ), + ) : Container()), ], ), @@ -280,28 +267,28 @@ class _TalkViewNativeDecodePageState extends State wit mainAxisSize: MainAxisSize.min, children: qualities.map((q) { return Obx(() => InkWell( - onTap: () { - Navigator.of(context).pop(); - logic.onQualityChanged(q); - }, - child: Container( - padding: EdgeInsets.symmetric(vertical: 18.w), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.max, - children: [ - Text( - q, - style: TextStyle( - color: state.currentQuality.value == q ? AppColors.mainColor : Colors.black, - fontWeight: state.currentQuality.value == q ? FontWeight.bold : FontWeight.normal, - fontSize: 28.sp, - ), - ), - ], + onTap: () { + Navigator.of(context).pop(); + logic.onQualityChanged(q); + }, + child: Container( + padding: EdgeInsets.symmetric(vertical: 18.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + children: [ + Text( + q, + style: TextStyle( + color: state.currentQuality.value == q ? AppColors.mainColor : Colors.black, + fontWeight: state.currentQuality.value == q ? FontWeight.bold : FontWeight.normal, + fontSize: 28.sp, + ), ), - ), - )); + ], + ), + ), + )); }).toList(), ), ), @@ -337,7 +324,7 @@ class _TalkViewNativeDecodePageState extends State wit return Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ // 接听 Obx( - () => bottomBtnItemWidget( + () => bottomBtnItemWidget( getAnswerBtnImg(), getAnswerBtnName(), Colors.white, @@ -354,10 +341,9 @@ class _TalkViewNativeDecodePageState extends State wit state.isLongPressing.value = false; }, onClick: () async { - // 只有在被动呼叫等待接听状态下才允许接听操作 if (state.talkStatus.value == TalkStatus.passiveCallWaitingAnswer) { - // 确保不是监控模式下调用 - if (!state.isMonitoringMode()) { + // 非等待监控模式下调用 + if (state.udpStatus.value != 1) { logic.initiateAnswerCommand(); } } @@ -390,8 +376,8 @@ class _TalkViewNativeDecodePageState extends State wit } String getAnswerBtnImg() { - // 如果是监控模式,始终显示对讲按钮 - if (state.isMonitoringMode.value) { + // 等待监视模式 + if (state.udpStatus.value == 1) { return 'images/main/icon_lockDetail_monitoringUnTalkback.png'; } switch (state.talkStatus.value) { @@ -406,8 +392,8 @@ class _TalkViewNativeDecodePageState extends State wit } String getAnswerBtnName() { - // 如果是监控模式,显示对讲相关文本 - if (state.isMonitoringMode.value) { + // 等待监视模式 + if (state.udpStatus.value == 1) { return '长按说话'.tr; } switch (state.talkStatus.value) { @@ -423,13 +409,13 @@ class _TalkViewNativeDecodePageState extends State wit } Widget bottomBtnItemWidget( - String iconUrl, - String name, - Color backgroundColor, { - required Function() onClick, - Function()? longPress, - Function()? longPressUp, - }) { + String iconUrl, + String name, + Color backgroundColor, { + required Function() onClick, + Function()? longPress, + Function()? longPressUp, + }) { double wh = 80.w; return GestureDetector( onTap: onClick, @@ -511,6 +497,7 @@ class _TalkViewNativeDecodePageState extends State wit @override void dispose() { + state.animationController.dispose(); CallTalk().finishAVData(); super.dispose(); } diff --git a/lib/talk/starChart/views/native/talk_view_native_decode_state.dart b/lib/talk/starChart/views/native/talk_view_native_decode_state.dart index 0283db58..6186f832 100644 --- a/lib/talk/starChart/views/native/talk_view_native_decode_state.dart +++ b/lib/talk/starChart/views/native/talk_view_native_decode_state.dart @@ -41,7 +41,7 @@ class TalkViewNativeDecodeState { TextEditingController passwordTF = TextEditingController(); RxList listAudioData = [].obs; //得到的音频流字节数据 - final GlobalKey globalKey = GlobalKey(); + GlobalKey globalKey = GlobalKey(); Timer? oneMinuteTimeTimer; // 定时器超过60秒关闭当前界面 RxInt oneMinuteTime = 0.obs; // 定时器秒数 @@ -104,17 +104,13 @@ class TalkViewNativeDecodeState { int lastPerformanceCheck = 0; int lastFrameCount = 0; - // 添加网络质量状态变量 - final RxInt networkQualityScore = 1.obs; // 1-5分,5为最佳 - final RxString networkQualityMessage = ''.obs; // 网络质量提示信息 - // 帧跟踪Map,记录每个提交的帧,key为textureId_frameSeq Map> frameTracker = {}; // H264帧缓冲区相关 final List> h264FrameBuffer = >[]; // H264帧缓冲区,存储帧数据和类型 int maxFrameBufferSize = 25; // 最大缓冲区大小 - int targetFps = 25; // 目标解码帧率,只是为了快速填充native的缓冲区 + final int targetFps = 25; // 目标解码帧率,只是为了快速填充native的缓冲区 Timer? frameProcessTimer; // 帧处理定时器 bool isProcessingFrame = false; // 是否正在处理帧 int lastProcessedTimestamp = 0; // 上次处理帧的时间戳 @@ -129,7 +125,4 @@ class TalkViewNativeDecodeState { // 是否拉伸至全屏 RxBool isFullScreen = false.obs; - - //添加监控模式标识 - final RxBool isMonitoringMode = false.obs; }