Install CMake 3.18.1 for Flutter

This commit is contained in:
Janez T
2026-02-28 20:06:52 +01:00
parent 0dd408e60d
commit 6a83624823
255 changed files with 117346 additions and 18 deletions

View File

@@ -1,5 +1,6 @@
import 'dart:typed_data';
import 'package:codec2_flutter/codec2_flutter.dart';
import 'package:flutter/foundation.dart';
import '../utils/voice_message_parser.dart';
export 'package:codec2_flutter/codec2_flutter.dart' show Codec2Mode;
@@ -27,14 +28,24 @@ VoicePacketMode voiceModeForBandwidth(int radioBandwidthHz) {
/// High-level codec service that provides async Codec2 encode/decode
/// executed in a background isolate so the UI thread is never blocked.
class VoiceCodecService {
void _ensureCodec2Supported() {
if (kIsWeb || defaultTargetPlatform != TargetPlatform.iOS) {
throw UnsupportedError('Codec2 is enabled only on iOS.');
}
}
/// Encode [pcm] (Int16 samples, 8000 Hz mono) with [mode].
/// Returns the raw Codec2-encoded bytes.
Future<Uint8List> encode(Int16List pcm, VoicePacketMode mode) =>
Codec2.encodeInIsolate(pcm, codec2ModeFor(mode));
Future<Uint8List> encode(Int16List pcm, VoicePacketMode mode) {
_ensureCodec2Supported();
return Codec2.encodeInIsolate(pcm, codec2ModeFor(mode));
}
/// Decode [codec2Bytes] back to Int16 PCM (8000 Hz mono) with [mode].
Future<Int16List> decode(Uint8List codec2Bytes, VoicePacketMode mode) =>
Codec2.decodeInIsolate(codec2Bytes, codec2ModeFor(mode));
Future<Int16List> decode(Uint8List codec2Bytes, VoicePacketMode mode) {
_ensureCodec2Supported();
return Codec2.decodeInIsolate(codec2Bytes, codec2ModeFor(mode));
}
/// Decode and concatenate multiple [packets] into a single PCM Int16List.
/// Packets with null/missing entries are substituted with silence.
@@ -42,6 +53,7 @@ class VoiceCodecService {
List<VoicePacket?> packets,
VoicePacketMode mode,
) async {
_ensureCodec2Supported();
final c2Mode = codec2ModeFor(mode);
final c2 = Codec2.create(c2Mode);
final spf = c2.samplesPerFrame;