maxSamplesPerPacket function
Calculates, how much sampels a single opus package at sampleRate
with channels
may contain.
A single package may contain up 120ms of audio. This value is reached by combining up to 3 frames of 40ms audio.
Implementation
int maxSamplesPerPacket(int sampleRate, int channels) => ((sampleRate *
channels *
120) /
1000)
.ceil();