return SWITCH_FALSE;
}
+ /* this is only useful for fs = 8000 hz, the map is only used
+ * at the beginning of the call. */
+ static int switch_opus_get_fec_bitrate(int fs, int loss)
+ {
+ int threshold_bitrates[25] = {
+ 15600,15200,15200,15200,14800,
+ 14800,14800,14800,14400,14400,
+ 14400,14000,14000,14000,13600,
+ 13600,13600,13600,13200,13200,
+ 13200,12800,12800,12800,12400
+ };
+
+ if (loss <= 0){
+ return SWITCH_STATUS_FALSE;
+ }
+
+ if (fs == 8000) {
+ if (loss >=25) {
+ return threshold_bitrates[24];
+ } else {
+ return threshold_bitrates[loss-1];
+ }
+ }
+
+ return SWITCH_STATUS_FALSE ;
+ }
+
static switch_status_t switch_opus_info(void * encoded_data, uint32_t len, uint32_t samples_per_second, char *print_text)
{
- int nb_samples;
- int nb_frames;
+ /* nb_silk_frames: number of silk-frames (10 or 20 ms) in an opus frame: 0, 1, 2 or 3 */
+ /* computed from the 5 MSB (configuration) of the TOC byte (encoded_data[0]) */
+ /* nb_opus_frames: number of opus frames in the packet */
+ /* computed from the 2 LSB (p0p1) of the TOC byte */
+ /* p0p1 = 0 => nb_opus_frames= 1 */
+ /* p0p1 = 1 or 2 => nb_opus_frames= 2 */
+ /* p0p1 = 3 => given by the 6 LSB of encoded_data[1] */
+
+ int nb_samples, nb_silk_frames, nb_opus_frames, n, i;
int audiobandwidth;
const char *audiobandwidth_str = "UNKNOWN";
opus_int16 frame_sizes[48];