fix 32khz isac

This commit is contained in:
Anthony Minessale 2013-01-16 21:13:28 -06:00
parent e57ece0d46
commit 52d558ff11
1 changed files with 9 additions and 8 deletions

View File

@ -62,19 +62,19 @@ static switch_status_t switch_isac_init(switch_codec_t *codec, switch_codec_flag
if (err < 0) return SWITCH_STATUS_FALSE; if (err < 0) return SWITCH_STATUS_FALSE;
WebRtcIsac_SetEncSampRate(context->ISAC_main_inst, codec->implementation->actual_samples_per_second / 1000);
WebRtcIsac_SetDecSampRate(context->ISAC_main_inst, codec->implementation->actual_samples_per_second / 1000);
if (encoding) { if (encoding) {
if (WebRtcIsac_EncoderInit(context->ISAC_main_inst, 0) < 0) { if (WebRtcIsac_EncoderInit(context->ISAC_main_inst, 0) < 0) {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
WebRtcIsac_SetEncSampRate(context->ISAC_main_inst, codec->implementation->actual_samples_per_second / 1000);
} }
if (decoding) { if (decoding) {
if (WebRtcIsac_DecoderInit(context->ISAC_main_inst) < 0) { if (WebRtcIsac_DecoderInit(context->ISAC_main_inst) < 0) {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
WebRtcIsac_SetDecSampRate(context->ISAC_main_inst, codec->implementation->actual_samples_per_second / 1000);
} }
if (codec->implementation->actual_samples_per_second == 16000) { if (codec->implementation->actual_samples_per_second == 16000) {
@ -82,13 +82,14 @@ static switch_status_t switch_isac_init(switch_codec_t *codec, switch_codec_flag
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
} else { } else {
if (WebRtcIsac_Control(context->ISAC_main_inst, codec->implementation->actual_samples_per_second / 1000,
codec->implementation->microseconds_per_packet / 1000) < 0) { if (WebRtcIsac_Control(context->ISAC_main_inst, codec->implementation->bits_per_second, codec->implementation->microseconds_per_packet / 1000) < 0) {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
} }
if (WebRtcIsac_SetMaxPayloadSize(context->ISAC_main_inst, SWITCH_RECOMMENDED_BUFFER_SIZE) < 0) { if (WebRtcIsac_SetMaxPayloadSize(context->ISAC_main_inst, codec->implementation->decoded_bytes_per_packet) < 0) {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
@ -224,13 +225,13 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_isac_codec_load)
SWITCH_CODEC_TYPE_AUDIO, SWITCH_CODEC_TYPE_AUDIO,
99, 99,
"isac", "isac",
NULL, "ibitrate=20000;maxbitrate=45000",
32000, 32000,
32000, 32000,
160000, 160000,
30000, 30000,
960, 3840,
1920, 7680,
0, 0,
1, 1,
6, 6,