This commit is contained in:
sky.min 2026-01-14 16:32:26 +08:00
parent 6542f27437
commit 9219168df5
3 changed files with 24 additions and 45 deletions

View File

@ -93,34 +93,32 @@ class TalkViewNativeDecodeLogic extends BaseGetXController {
Future<void> _initVideoDecoder() async {
try {
state.isLoading.value = true;
// ios第一次点击监控没画面
//
int width = StartChartManage().videoWidth;
int height = StartChartManage().videoHeight;
//
if (width == 0 || height == 0) {
int attempts = 0;
const maxAttempts = 20; // 2 (20 * 100ms)
while ((width == 0 || height == 0) && attempts < maxAttempts) {
await Future.delayed(const Duration(milliseconds: 100));
width = StartChartManage().videoWidth;
height = StartChartManage().videoHeight;
attempts++;
}
// 使
if(Platform.isIOS){
// ios第一次点击监控没画面
if (width == 0 || height == 0) {
width = 864;
height = 480;
AppLog.log('使用默认视频参数: ${width}x$height');
} else {
AppLog.log('获取到视频参数: ${width}x$height');
int attempts = 0;
const maxAttempts = 20; // 2 (20 * 100ms)
while ((width == 0 || height == 0) && attempts < maxAttempts) {
await Future.delayed(const Duration(milliseconds: 100));
width = StartChartManage().videoWidth;
height = StartChartManage().videoHeight;
attempts++;
}
// 使
if (width == 0 || height == 0) {
width = 864;
height = 480;
AppLog.log('使用默认视频参数: ${width}x$height');
} else {
AppLog.log('获取到视频参数: ${width}x$height');
}
}
}
//
final config = VideoDecoderConfig(
width: width,
@ -128,7 +126,6 @@ class TalkViewNativeDecodeLogic extends BaseGetXController {
height: height,
codecType: 'h264',
);
AppLog.log('解码器配置的宽高为:${config.width}x${config.height}');
// textureId
final textureId = await VideoDecodePlugin.initDecoder(config);
if (textureId != null) {
@ -272,7 +269,8 @@ class TalkViewNativeDecodeLogic extends BaseGetXController {
//
state.frameProcessTimer?.cancel();
// 使
//
// final int intervalMs = (1000 / state.targetFps).round();
final int intervalMs = state.frameProcessIntervalMs;
//

View File

@ -41,7 +41,7 @@ class TalkViewLogic extends BaseGetXController {
final LockDetailState lockDetailState = Get.put(LockDetailLogic()).state;
int bufferSize = 3; //
int bufferSize = 8; //
int audioBufferSize = 2; // 2
bool _isFirstAudioFrame = true; //

View File

@ -504,25 +504,6 @@ class H264WebViewLogic extends BaseGetXController {
return result;
}
//
List<int> _applyDenoise(List<int> pcmData) {
// 使
const int noiseThreshold = 150; //
List<int> result = List<int>.filled(pcmData.length, 0);
for (int i = 0; i < pcmData.length; i++) {
// 0
if (pcmData[i].abs() < noiseThreshold) {
result[i] = 0;
} else {
result[i] = pcmData[i];
}
}
return result;
}
///
void udpHangUpAction() async {
if (state.talkStatus.value == TalkStatus.answeredSuccessfully) {