decodeLost method
Conceal a LOST packet of frameSize samples per channel;
nextPacket (the packet after the loss) supplies SILK in-band FEC
when present.
Implementation
Float32List decodeLost(int frameSize, [Uint8List? nextPacket]) {
_checkNotDisposed();
final outPtr = calloc<Float>(2 * 5760);
int n;
if (nextPacket != null && nextPacket.isNotEmpty) {
final inPtr = calloc<Uint8>(nextPacket.length);
inPtr.asTypedList(nextPacket.length).setAll(0, nextPacket);
n = _decodeFec(_handle, inPtr, nextPacket.length, outPtr, frameSize);
calloc.free(inPtr);
} else {
n = _decodeFec(_handle, nullptr, 0, outPtr, frameSize);
}
Float32List out;
if (n <= 0) {
out = Float32List(0);
} else {
out = Float32List.fromList(outPtr.asTypedList(n * channels));
}
calloc.free(outPtr);
if (n < 0) {
throw StateError('opus concealment failed ($n)');
}
return out;
}