update
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5992 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
a65e34e233
commit
6b1fa2191b
|
@ -4224,7 +4224,7 @@ SWITCH_STANDARD_APP(conference_function)
|
|||
}
|
||||
|
||||
if (read_codec->implementation->actual_samples_per_second != conference->rate) {
|
||||
switch_audio_resampler_t **resampler = read_codec->implementation->samples_per_second > conference->rate ?
|
||||
switch_audio_resampler_t **resampler = read_codec->implementation->actual_samples_per_second > conference->rate ?
|
||||
&member.read_resampler : &member.mux_resampler;
|
||||
|
||||
if (switch_resample_create(resampler,
|
||||
|
|
|
@ -291,7 +291,7 @@ static void asrtest_function(switch_core_session_t *session, char *data)
|
|||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
|
||||
"Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name,
|
||||
read_codec->implementation->samples_per_second,
|
||||
ah.rate,
|
||||
read_codec->implementation->number_of_channels, read_codec->implementation->microseconds_per_frame / 1000);
|
||||
switch_core_session_reset(session);
|
||||
return;
|
||||
|
|
|
@ -93,11 +93,11 @@ static switch_status_t switch_speex_init(switch_codec_t *codec, switch_codec_fla
|
|||
const SpeexMode *mode = NULL;
|
||||
|
||||
context->codec = codec;
|
||||
if (codec->implementation->samples_per_second == 8000) {
|
||||
if (codec->implementation->actual_samples_per_second == 8000) {
|
||||
mode = &speex_nb_mode;
|
||||
} else if (codec->implementation->samples_per_second == 16000) {
|
||||
} else if (codec->implementation->actual_samples_per_second == 16000) {
|
||||
mode = &speex_wb_mode;
|
||||
} else if (codec->implementation->samples_per_second == 32000) {
|
||||
} else if (codec->implementation->actual_samples_per_second == 32000) {
|
||||
mode = &speex_uwb_mode;
|
||||
}
|
||||
|
||||
|
@ -111,7 +111,7 @@ static switch_status_t switch_speex_init(switch_codec_t *codec, switch_codec_fla
|
|||
speex_encoder_ctl(context->encoder_state, SPEEX_GET_FRAME_SIZE, &context->encoder_frame_size);
|
||||
speex_encoder_ctl(context->encoder_state, SPEEX_SET_COMPLEXITY, &codec->codec_settings.complexity);
|
||||
if (codec->codec_settings.preproc) {
|
||||
context->pp = speex_preprocess_state_init(context->encoder_frame_size, codec->implementation->samples_per_second);
|
||||
context->pp = speex_preprocess_state_init(context->encoder_frame_size, codec->implementation->actual_samples_per_second);
|
||||
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_VAD, &codec->codec_settings.pp_vad);
|
||||
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_AGC, &codec->codec_settings.pp_agc);
|
||||
speex_preprocess_ctl(context->pp, SPEEX_PREPROCESS_SET_AGC_LEVEL, &codec->codec_settings.pp_agc_level);
|
||||
|
|
|
@ -223,7 +223,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
|||
if (switch_core_file_open(&fh,
|
||||
ring_file,
|
||||
globals.read_codec.implementation->number_of_channels,
|
||||
globals.read_codec.implementation->samples_per_second,
|
||||
globals.read_codec.implementation->actual_samples_per_second,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
if (engage_device(fh.samplerate, fh.channels) != SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -582,7 +582,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||
if (switch_core_file_open(&tech_pvt->fh,
|
||||
tech_pvt->hold_file,
|
||||
globals.read_codec.implementation->number_of_channels,
|
||||
globals.read_codec.implementation->samples_per_second,
|
||||
globals.read_codec.implementation->actual_samples_per_second,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
|
||||
switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_core_codec_destroy(&tech_pvt->write_codec);
|
||||
|
|
|
@ -223,7 +223,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
|||
if (switch_core_file_open(&fh,
|
||||
ring_file,
|
||||
globals.read_codec.implementation->number_of_channels,
|
||||
globals.read_codec.implementation->samples_per_second,
|
||||
globals.read_codec.implementation->actual_samples_per_second,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, NULL) == SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
if (engage_ring_device(fh.samplerate, fh.channels) != SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -568,7 +568,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
|
|||
if (switch_core_file_open(&tech_pvt->fh,
|
||||
tech_pvt->hold_file,
|
||||
globals.read_codec.implementation->number_of_channels,
|
||||
globals.read_codec.implementation->samples_per_second,
|
||||
globals.read_codec.implementation->actual_samples_per_second,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
|
||||
switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
|
||||
tech_pvt->hold_file = NULL;
|
||||
|
|
|
@ -1116,14 +1116,14 @@ static switch_status_t js_stream_input_callback(switch_core_session_t *session,
|
|||
step = 1000;
|
||||
}
|
||||
if (step > 0) {
|
||||
samps = step * (codec->implementation->samples_per_second / 1000);
|
||||
samps = step * (codec->implementation->actual_samples_per_second / 1000);
|
||||
switch_core_file_seek(fh, &pos, samps, SEEK_CUR);
|
||||
} else {
|
||||
samps = step * (codec->implementation->samples_per_second / 1000);
|
||||
samps = step * (codec->implementation->actual_samples_per_second / 1000);
|
||||
switch_core_file_seek(fh, &pos, fh->pos - samps, SEEK_SET);
|
||||
}
|
||||
} else {
|
||||
samps = atoi(p) * (codec->implementation->samples_per_second / 1000);
|
||||
samps = atoi(p) * (codec->implementation->actual_samples_per_second / 1000);
|
||||
switch_core_file_seek(fh, &pos, samps, SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ static JSBool teletone_construct(JSContext * cx, JSObject * obj, uintN argc, jsv
|
|||
if (switch_core_codec_init(&tto->codec,
|
||||
"L16",
|
||||
NULL,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->actual_samples_per_second,
|
||||
read_codec->implementation->microseconds_per_frame / 1000,
|
||||
read_codec->implementation->number_of_channels,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
|
||||
|
|
|
@ -780,12 +780,12 @@ SWITCH_DECLARE(void) switch_channel_event_set_data(switch_channel_t *channel, sw
|
|||
|
||||
if ((codec = switch_core_session_get_read_codec(channel->session)) && codec->implementation) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Name", "%s", switch_str_nil(codec->implementation->iananame));
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Rate", "%u", codec->implementation->samples_per_second);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Read-Codec-Rate", "%u", codec->implementation->actual_samples_per_second);
|
||||
}
|
||||
|
||||
if ((codec = switch_core_session_get_write_codec(channel->session)) && codec->implementation) {
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Name", "%s", switch_str_nil(codec->implementation->iananame));
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", codec->implementation->samples_per_second);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Channel-Write-Codec-Rate", "%u", codec->implementation->actual_samples_per_second);
|
||||
}
|
||||
|
||||
/* Index Caller's Profile */
|
||||
|
|
|
@ -44,6 +44,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_read_codec(switch_core_s
|
|||
switch_channel_event_set_data(session->channel, event);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", "%s", codec->implementation->iananame);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-read-codec-rate", "%d", codec->implementation->samples_per_second);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-actual-read-codec-rate", "%d", codec->implementation->actual_samples_per_second);
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
|
@ -70,6 +71,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_write_codec(switch_core_
|
|||
switch_channel_event_set_data(session->channel, event);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", "%s", codec->implementation->iananame);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-write-codec-rate", "%d", codec->implementation->samples_per_second);
|
||||
switch_event_add_header(event, SWITCH_STACK_BOTTOM, "channel-actual-write-codec-rate", "%d", codec->implementation->actual_samples_per_second);
|
||||
switch_event_fire(&event);
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
|||
session->read_codec,
|
||||
read_frame->data,
|
||||
read_frame->datalen,
|
||||
session->read_codec->implementation->samples_per_second,
|
||||
session->read_codec->implementation->actual_samples_per_second,
|
||||
session->raw_read_frame.data, &session->raw_read_frame.datalen, &session->raw_read_frame.rate, &flag);
|
||||
|
||||
if (do_resample && status == SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -304,7 +304,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
|||
session->raw_read_frame.data,
|
||||
session->read_codec->implementation->bytes_per_frame);
|
||||
|
||||
session->raw_read_frame.rate = session->read_codec->implementation->samples_per_second;
|
||||
session->raw_read_frame.rate = session->read_codec->implementation->actual_samples_per_second;
|
||||
enc_frame = &session->raw_read_frame;
|
||||
}
|
||||
session->enc_read_frame.datalen = session->enc_read_frame.buflen;
|
||||
|
@ -317,7 +317,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
|
|||
enc_frame->codec,
|
||||
enc_frame->data,
|
||||
enc_frame->datalen,
|
||||
session->read_codec->implementation->samples_per_second,
|
||||
session->read_codec->implementation->actual_samples_per_second,
|
||||
session->enc_read_frame.data, &session->enc_read_frame.datalen, &session->enc_read_frame.rate, &flag);
|
||||
|
||||
|
||||
|
@ -443,7 +443,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
|
|||
session->write_codec,
|
||||
frame->data,
|
||||
frame->datalen,
|
||||
session->write_codec->implementation->samples_per_second,
|
||||
session->write_codec->implementation->actual_samples_per_second,
|
||||
session->raw_write_frame.data, &session->raw_write_frame.datalen, &session->raw_write_frame.rate, &flag);
|
||||
|
||||
|
||||
|
@ -597,7 +597,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
|
|||
frame->codec,
|
||||
enc_frame->data,
|
||||
enc_frame->datalen,
|
||||
session->write_codec->implementation->samples_per_second,
|
||||
session->write_codec->implementation->actual_samples_per_second,
|
||||
session->enc_write_frame.data, &session->enc_write_frame.datalen, &session->enc_write_frame.rate, &flag);
|
||||
|
||||
switch (status) {
|
||||
|
@ -650,13 +650,13 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_write_frame(switch_core_sess
|
|||
switch_buffer_read(session->raw_write_buffer, session->raw_write_frame.data, bytes)) != 0) {
|
||||
int rate;
|
||||
enc_frame = &session->raw_write_frame;
|
||||
session->raw_write_frame.rate = session->write_codec->implementation->samples_per_second;
|
||||
session->raw_write_frame.rate = session->write_codec->implementation->actual_samples_per_second;
|
||||
session->enc_write_frame.datalen = session->enc_write_frame.buflen;
|
||||
|
||||
if (frame->codec && frame->codec->implementation) {
|
||||
rate = frame->codec->implementation->samples_per_second;
|
||||
rate = frame->codec->implementation->actual_samples_per_second;
|
||||
} else {
|
||||
rate = session->write_codec->implementation->samples_per_second;
|
||||
rate = session->write_codec->implementation->actual_samples_per_second;
|
||||
}
|
||||
|
||||
status = switch_core_codec_encode(session->write_codec,
|
||||
|
|
|
@ -160,7 +160,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_read(switch_media_bug_t *b
|
|||
|
||||
frame->datalen = bytes;
|
||||
frame->samples = bytes / sizeof(int16_t);
|
||||
frame->rate = read_codec->implementation->samples_per_second;
|
||||
frame->rate = read_codec->implementation->actual_samples_per_second;
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -202,16 +202,16 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_
|
|||
if (switch_core_codec_init(&conninfo->read_codec,
|
||||
"L16",
|
||||
NULL,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->actual_samples_per_second,
|
||||
read_codec->implementation->microseconds_per_frame / 1000,
|
||||
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
|
||||
read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
|
||||
read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
|
||||
} else {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
|
||||
read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
|
||||
read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
@ -445,7 +445,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
|
|||
switch_size_t len = 0;
|
||||
uint32_t flags = 0;
|
||||
switch_byte_t decoded[SWITCH_RECOMMENDED_BUFFER_SIZE];
|
||||
uint32_t rate = read_codec->implementation->samples_per_second;
|
||||
uint32_t rate = read_codec->implementation->actual_samples_per_second;
|
||||
uint32_t dlen = sizeof(decoded);
|
||||
switch_status_t status;
|
||||
switch_byte_t *sendbuf = NULL;
|
||||
|
@ -465,7 +465,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
|
|||
&conninfo->read_codec,
|
||||
read_frame->data,
|
||||
read_frame->datalen,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->actual_samples_per_second,
|
||||
decoded, &dlen, &rate, &flags);
|
||||
}
|
||||
switch (status) {
|
||||
|
|
|
@ -207,13 +207,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_displace_session(switch_core_session_
|
|||
assert(read_codec != NULL);
|
||||
|
||||
dh->fh.channels = read_codec->implementation->number_of_channels;
|
||||
dh->fh.samplerate = read_codec->implementation->samples_per_second;
|
||||
dh->fh.samplerate = read_codec->implementation->actual_samples_per_second;
|
||||
|
||||
|
||||
if (switch_core_file_open(&dh->fh,
|
||||
file,
|
||||
read_codec->implementation->number_of_channels,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->actual_samples_per_second,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
|
@ -329,13 +329,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_session(switch_core_session_t
|
|||
}
|
||||
|
||||
fh->channels = channels;
|
||||
fh->samplerate = read_codec->implementation->samples_per_second;
|
||||
fh->samplerate = read_codec->implementation->actual_samples_per_second;
|
||||
|
||||
|
||||
if (switch_core_file_open(fh,
|
||||
file,
|
||||
channels,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->actual_samples_per_second,
|
||||
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error opening %s\n", file);
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
|
@ -470,7 +470,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_inband_dtmf_session(switch_core_sessi
|
|||
return SWITCH_STATUS_MEMERR;
|
||||
}
|
||||
|
||||
teletone_dtmf_detect_init(&pvt->dtmf_detect, read_codec->implementation->samples_per_second);
|
||||
teletone_dtmf_detect_init(&pvt->dtmf_detect, read_codec->implementation->actual_samples_per_second);
|
||||
|
||||
pvt->session = session;
|
||||
|
||||
|
@ -668,7 +668,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi
|
|||
}
|
||||
|
||||
cont->list[cont->index].up = 1;
|
||||
cont->list[cont->index].mt.sample_rate = read_codec->implementation->samples_per_second;
|
||||
cont->list[cont->index].mt.sample_rate = read_codec->implementation->actual_samples_per_second;
|
||||
teletone_multi_tone_init(&cont->list[cont->index].mt, &cont->list[cont->index].map);
|
||||
cont->session = session;
|
||||
|
||||
|
@ -952,7 +952,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_detect_speech(switch_core_session_t *
|
|||
if (switch_core_asr_open(ah,
|
||||
mod_name,
|
||||
"L16",
|
||||
read_codec->implementation->samples_per_second, dest, &flags,
|
||||
read_codec->implementation->actual_samples_per_second, dest, &flags,
|
||||
switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
if (switch_core_asr_load_grammar(ah, grammar, path) != SWITCH_STATUS_SUCCESS) {
|
||||
|
|
|
@ -615,7 +615,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
if (switch_core_codec_init(&write_codec,
|
||||
"L16",
|
||||
NULL,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->actual_samples_per_second,
|
||||
read_codec->implementation->microseconds_per_frame / 1000,
|
||||
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||
switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -623,7 +623,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
|
||||
"Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
|
||||
read_codec->implementation->samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
|
||||
read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
|
||||
write_frame.codec = &write_codec;
|
||||
write_frame.datalen = read_codec->implementation->bytes_per_frame;
|
||||
write_frame.samples = write_frame.datalen / 2;
|
||||
|
@ -652,11 +652,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Play Ringback File [%s]\n", ringback_data);
|
||||
|
||||
ringback.fhb.channels = read_codec->implementation->number_of_channels;
|
||||
ringback.fhb.samplerate = read_codec->implementation->samples_per_second;
|
||||
ringback.fhb.samplerate = read_codec->implementation->actual_samples_per_second;
|
||||
if (switch_core_file_open(&ringback.fhb,
|
||||
ringback_data,
|
||||
read_codec->implementation->number_of_channels,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->actual_samples_per_second,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT,
|
||||
switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Playing File\n");
|
||||
|
@ -668,7 +668,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
|
||||
} else {
|
||||
teletone_init_session(&ringback.ts, 0, teletone_handler, &ringback);
|
||||
ringback.ts.rate = read_codec->implementation->samples_per_second;
|
||||
ringback.ts.rate = read_codec->implementation->actual_samples_per_second;
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Play Ringback Tone [%s]\n", ringback_data);
|
||||
//ringback.ts.debug = 1;
|
||||
//ringback.ts.debug_stream = switch_core_get_console();
|
||||
|
|
|
@ -341,13 +341,13 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
|
|||
assert(read_codec != NULL);
|
||||
|
||||
fh->channels = read_codec->implementation->number_of_channels;
|
||||
fh->samplerate = read_codec->implementation->samples_per_second;
|
||||
fh->samplerate = read_codec->implementation->actual_samples_per_second;
|
||||
|
||||
|
||||
if (switch_core_file_open(fh,
|
||||
file,
|
||||
read_codec->implementation->number_of_channels,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->actual_samples_per_second,
|
||||
SWITCH_FILE_FLAG_WRITE | SWITCH_FILE_DATA_SHORT, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
|
||||
switch_core_session_reset(session);
|
||||
|
@ -396,7 +396,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
|
|||
if (switch_core_codec_init(&codec,
|
||||
codec_name,
|
||||
NULL,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->actual_samples_per_second,
|
||||
read_codec->implementation->microseconds_per_frame / 1000,
|
||||
read_codec->implementation->number_of_channels,
|
||||
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
|
||||
|
@ -563,7 +563,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
|
|||
if (switch_core_codec_init(&write_codec,
|
||||
"L16",
|
||||
NULL,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->actual_samples_per_second,
|
||||
read_codec->implementation->microseconds_per_frame / 1000,
|
||||
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
|
||||
NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -576,7 +576,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
|
|||
|
||||
switch_buffer_create_dynamic(&audio_buffer, 512, 1024, 0);
|
||||
teletone_init_session(&ts, 0, teletone_handler, audio_buffer);
|
||||
ts.rate = read_codec->implementation->samples_per_second;
|
||||
ts.rate = read_codec->implementation->actual_samples_per_second;
|
||||
ts.channels = 1;
|
||||
teletone_run(&ts, script);
|
||||
|
||||
|
@ -722,7 +722,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
|
|||
if (switch_core_file_open(fh,
|
||||
file,
|
||||
read_codec->implementation->number_of_channels,
|
||||
read_codec->implementation->samples_per_second,
|
||||
read_codec->implementation->actual_samples_per_second,
|
||||
SWITCH_FILE_FLAG_READ | SWITCH_FILE_DATA_SHORT, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
|
||||
switch_core_session_reset(session);
|
||||
return SWITCH_STATUS_NOTFOUND;
|
||||
|
|
|
@ -163,7 +163,7 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
|
|||
for (impl = ptr->implementations; impl; impl = impl->next) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
|
||||
"Adding Codec '%s' (%s) %dhz %dms\n",
|
||||
impl->iananame, ptr->interface_name, impl->samples_per_second, impl->microseconds_per_frame / 1000);
|
||||
impl->iananame, ptr->interface_name, impl->actual_samples_per_second, impl->microseconds_per_frame / 1000);
|
||||
if (!switch_core_hash_find(loadable_modules.codec_hash, impl->iananame)) {
|
||||
switch_core_hash_insert(loadable_modules.codec_hash, impl->iananame, (const void *) ptr);
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t
|
|||
for (impl = ptr->implementations; impl; impl = impl->next) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE,
|
||||
"Deleting Codec '%s' (%s) %dhz %dms\n",
|
||||
impl->iananame, ptr->interface_name, impl->samples_per_second, impl->microseconds_per_frame / 1000);
|
||||
impl->iananame, ptr->interface_name, impl->actual_samples_per_second, impl->microseconds_per_frame / 1000);
|
||||
if (switch_core_hash_find(loadable_modules.codec_hash, impl->iananame)) {
|
||||
switch_core_hash_delete(loadable_modules.codec_hash, impl->iananame);
|
||||
}
|
||||
|
|
|
@ -1343,7 +1343,7 @@ static int rtp_common_write(switch_rtp_t *rtp_session, void *data, uint32_t data
|
|||
rtp_session->vad_data.read_codec,
|
||||
data,
|
||||
datalen,
|
||||
rtp_session->vad_data.read_codec->implementation->samples_per_second,
|
||||
rtp_session->vad_data.read_codec->implementation->actual_samples_per_second,
|
||||
decoded, &len, &rate, &flags) == SWITCH_STATUS_SUCCESS) {
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue