Merge branch 'develop_liyi' of code-internal.star-lock.cn:StarlockTeam/app-starlock into develop_liyi

This commit is contained in:
“DaisyWu” 2025-01-17 17:58:00 +08:00
commit 87f315f79d
6 changed files with 58 additions and 50 deletions

View File

@ -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) {}
}

View File

@ -151,39 +151,39 @@ class _ControlsOverlayState extends State<ControlsOverlay> {
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')),
// ),
],
),
),

View File

@ -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';

View File

@ -36,6 +36,7 @@ class TalkePingOverTimeTimerManager {
StartChartManage().sendTalkHangupMessage();
talkStatus.setNotTalkPing();
talkStatus.setEnd();
Get.back();
}
}

View File

@ -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; // 4522FPS
int audioFrameIntervalMs = 20; // 4522FPS
@ -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();
}

View File

@ -84,9 +84,10 @@ class TalkViewState {
late VoiceProcessor? voiceProcessor; //
final int frameLength = 320; //640
final int sampleRate = 8000; //8000
List<List<int>> recordingAudioAllFrames = <List<int>>[]; //
List<int> recordingAudioAllFrames = <int>[]; //
List<int> lockRecordingAudioAllFrames = <int>[]; //
RxInt rotateAngle = 0.obs; //
RxBool isLongPressing = false.obs; //
RxBool hasAudioData = false.obs; //
RxInt lastAudioTimestamp = 0.obs; //
}
}