[Freeswitch-svn] [commit] r10084 - in freeswitch/trunk/src: . include mod/applications/mod_conference mod/applications/mod_esf mod/applications/mod_fax mod/applications/mod_fsv mod/applications/mod_rss mod/codecs/mod_amr mod/codecs/mod_g723_1 mod/codecs/mod_g729 mod/codecs/mod_h26x mod/codecs/mod_ilbc mod/codecs/mod_speex mod/codecs/mod_voipcodecs mod/endpoints/mod_alsa mod/endpoints/mod_dingaling mod/endpoints/mod_iax mod/endpoints/mod_loopback mod/endpoints/mod_portaudio mod/endpoints/mod_sofia mod/formats/mod_local_stream mod/languages/mod_spidermonkey mod/languages/mod_spidermonkey_teletone
Freeswitch SVN
anthm at freeswitch.org
Mon Oct 20 13:48:43 EDT 2008
Author: anthm
Date: Mon Oct 20 13:48:42 2008
New Revision: 10084
Modified:
freeswitch/trunk/src/include/switch_loadable_module.h
freeswitch/trunk/src/include/switch_module_interfaces.h
freeswitch/trunk/src/include/switch_utils.h
freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c
freeswitch/trunk/src/mod/applications/mod_fax/mod_fax.c
freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c
freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c
freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c
freeswitch/trunk/src/mod/codecs/mod_g723_1/mod_g723_1.c
freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c
freeswitch/trunk/src/mod/codecs/mod_h26x/mod_h26x.c
freeswitch/trunk/src/mod/codecs/mod_ilbc/mod_ilbc.c
freeswitch/trunk/src/mod/codecs/mod_speex/mod_speex.c
freeswitch/trunk/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c
freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c
freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c
freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c
freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.h
freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
freeswitch/trunk/src/switch_core_codec.c
freeswitch/trunk/src/switch_core_io.c
freeswitch/trunk/src/switch_core_media_bug.c
freeswitch/trunk/src/switch_core_speech.c
freeswitch/trunk/src/switch_ivr.c
freeswitch/trunk/src/switch_ivr_async.c
freeswitch/trunk/src/switch_ivr_bridge.c
freeswitch/trunk/src/switch_ivr_originate.c
freeswitch/trunk/src/switch_ivr_play_say.c
freeswitch/trunk/src/switch_loadable_module.c
freeswitch/trunk/src/switch_pcm.c
freeswitch/trunk/src/switch_rtp.c
Log:
clean some old members and naming conventions in the codec structs
Modified: freeswitch/trunk/src/include/switch_loadable_module.h
==============================================================================
--- freeswitch/trunk/src/include/switch_loadable_module.h (original)
+++ freeswitch/trunk/src/include/switch_loadable_module.h Mon Oct 20 13:48:42 2008
@@ -339,19 +339,17 @@
/*! bits transferred per second */
int bits_per_second,
/*! number of microseconds that denote one frame */
- int microseconds_per_frame,
+ int microseconds_per_packet,
/*! number of samples that denote one frame */
- uint32_t samples_per_frame,
+ uint32_t samples_per_packet,
/*! number of bytes that denote one frame decompressed */
- uint32_t bytes_per_frame,
+ uint32_t decoded_bytes_per_packet,
/*! number of bytes that denote one frame compressed */
- uint32_t encoded_bytes_per_frame,
+ uint32_t encoded_bytes_per_packet,
/*! number of channels represented */
uint8_t number_of_channels,
/*! number of frames to send in one netowrk packet */
- int pref_frames_per_packet,
- /*! max number of frames to send in one network packet */
- int max_frames_per_packet,
+ int codec_frames_per_packet,
/*! function to initialize a codec handle using this implementation */
switch_core_codec_init_func_t init,
/*! function to encode raw data into encoded data */
@@ -361,7 +359,7 @@
/*! deinitalize a codec handle using this implementation */
switch_core_codec_destroy_func_t destroy)
{
- if (codec_type == SWITCH_CODEC_TYPE_VIDEO || SWITCH_ACCEPTABLE_INTERVAL(microseconds_per_frame / 1000)) {
+ if (codec_type == SWITCH_CODEC_TYPE_VIDEO || SWITCH_ACCEPTABLE_INTERVAL(microseconds_per_packet / 1000)) {
switch_codec_implementation_t *impl = (switch_codec_implementation_t *) switch_core_alloc(pool, sizeof(*impl));
impl->codec_type = codec_type;
impl->ianacode = ianacode;
@@ -370,13 +368,12 @@
impl->samples_per_second = samples_per_second;
impl->actual_samples_per_second = actual_samples_per_second;
impl->bits_per_second = bits_per_second;
- impl->microseconds_per_frame = microseconds_per_frame;
- impl->samples_per_frame = samples_per_frame;
- impl->bytes_per_frame = bytes_per_frame;
- impl->encoded_bytes_per_frame = encoded_bytes_per_frame;
+ impl->microseconds_per_packet = microseconds_per_packet;
+ impl->samples_per_packet = samples_per_packet;
+ impl->decoded_bytes_per_packet = decoded_bytes_per_packet;
+ impl->encoded_bytes_per_packet = encoded_bytes_per_packet;
impl->number_of_channels = number_of_channels;
- impl->pref_frames_per_packet = pref_frames_per_packet;
- impl->max_frames_per_packet = max_frames_per_packet;
+ impl->codec_frames_per_packet = codec_frames_per_packet;
impl->init = init;
impl->encode = encode;
impl->decode = decode;
Modified: freeswitch/trunk/src/include/switch_module_interfaces.h
==============================================================================
--- freeswitch/trunk/src/include/switch_module_interfaces.h (original)
+++ freeswitch/trunk/src/include/switch_module_interfaces.h Mon Oct 20 13:48:42 2008
@@ -563,19 +563,17 @@
/*! bits transferred per second */
int bits_per_second;
/*! number of microseconds that denote one frame */
- int microseconds_per_frame;
+ int microseconds_per_packet;
/*! number of samples that denote one frame */
- uint32_t samples_per_frame;
+ uint32_t samples_per_packet;
/*! number of bytes that denote one frame decompressed */
- uint32_t bytes_per_frame;
+ uint32_t decoded_bytes_per_packet;
/*! number of bytes that denote one frame compressed */
- uint32_t encoded_bytes_per_frame;
+ uint32_t encoded_bytes_per_packet;
/*! number of channels represented */
uint8_t number_of_channels;
- /*! number of frames to send in one netowrk packet */
- int pref_frames_per_packet;
- /*! max number of frames to send in one network packet */
- int max_frames_per_packet;
+ /*! number of codec frames to send in one netowrk packet */
+ int codec_frames_per_packet;
/*! function to initialize a codec handle using this implementation */
switch_core_codec_init_func_t init;
/*! function to encode raw data into encoded data */
Modified: freeswitch/trunk/src/include/switch_utils.h
==============================================================================
--- freeswitch/trunk/src/include/switch_utils.h (original)
+++ freeswitch/trunk/src/include/switch_utils.h Mon Oct 20 13:48:42 2008
@@ -41,14 +41,14 @@
#include <switch.h>
SWITCH_BEGIN_EXTERN_C
-#define switch_samples_per_frame(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval)))
+#define switch_samples_per_packet(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval)))
#define SWITCH_SMAX 32767
#define SWITCH_SMIN -32768
#define switch_normalize_to_16bit(n) if (n > SWITCH_SMAX) n = SWITCH_SMAX / 2; else if (n < SWITCH_SMIN) n = SWITCH_SMIN / 2;
#define switch_codec2str(codec,buf,len) snprintf(buf, len, "%s@%uh@%ui", \
codec->implementation->iananame, \
codec->implementation->samples_per_second, \
- codec->implementation->microseconds_per_frame / 1000)
+ codec->implementation->microseconds_per_packet / 1000)
#ifdef WIN32
#define switch_is_file_path(file) (file && (*file == '\\' || *(file +1) == ':' || *file == '/' || strstr(file, SWITCH_URL_SEPARATOR)))
#else
Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c Mon Oct 20 13:48:42 2008
@@ -858,7 +858,7 @@
{
conference_obj_t *conference = (conference_obj_t *) obj;
conference_member_t *imember, *omember;
- uint32_t samples = switch_samples_per_frame(conference->rate, conference->interval);
+ uint32_t samples = switch_samples_per_packet(conference->rate, conference->interval);
uint32_t bytes = samples * 2;
uint8_t ready = 0, total = 0;
switch_timer_t timer = { 0 };
@@ -1737,17 +1737,17 @@
uint8_t *data;
switch_timer_t timer = { 0 };
switch_codec_t *read_codec = switch_core_session_get_read_codec(member->session);
- uint32_t interval = read_codec->implementation->microseconds_per_frame / 1000;
- uint32_t samples = switch_samples_per_frame(member->conference->rate, interval);
+ uint32_t interval = read_codec->implementation->microseconds_per_packet / 1000;
+ uint32_t samples = switch_samples_per_packet(member->conference->rate, interval);
uint32_t csamples = samples;
- uint32_t tsamples = member->orig_read_codec->implementation->samples_per_frame;
+ uint32_t tsamples = member->orig_read_codec->implementation->samples_per_packet;
uint32_t flush_len = 0;
uint32_t low_count = 0, bytes = samples * 2;
call_list_t *call_list = NULL, *cp = NULL;
switch_assert(member->conference != NULL);
- flush_len = switch_samples_per_frame(member->conference->rate, member->conference->interval) * 10;
+ flush_len = switch_samples_per_packet(member->conference->rate, member->conference->interval) * 10;
if (switch_core_timer_init(&timer, member->conference->timer_name, interval, tsamples, NULL) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer Setup Failed. Conference Cannot Start\n");
@@ -2044,7 +2044,7 @@
conference_member_t smember = { 0 }, *member;
conference_record_t *rec = (conference_record_t *) obj;
conference_obj_t *conference = rec->conference;
- uint32_t samples = switch_samples_per_frame(conference->rate, conference->interval);
+ uint32_t samples = switch_samples_per_packet(conference->rate, conference->interval);
uint32_t low_count = 0, mux_used;
char *vval;
switch_timer_t timer = { 0 };
@@ -4444,15 +4444,15 @@
/* Setup a Signed Linear codec for reading audio. */
if (switch_core_codec_init(&member.read_codec,
"L16",
- NULL, read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000,
+ NULL, read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_packet / 1000,
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member.pool) == 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->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
+ read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_packet / 1000);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
- read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
+ read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_packet / 1000);
flags = 0;
goto done;
@@ -4488,14 +4488,14 @@
"L16",
NULL,
conference->rate,
- read_codec->implementation->microseconds_per_frame / 1000,
+ read_codec->implementation->microseconds_per_packet / 1000,
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member.pool) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
- conference->rate, read_codec->implementation->microseconds_per_frame / 1000);
+ conference->rate, read_codec->implementation->microseconds_per_packet / 1000);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
- conference->rate, read_codec->implementation->microseconds_per_frame / 1000);
+ conference->rate, read_codec->implementation->microseconds_per_packet / 1000);
flags = 0;
goto codec_done2;
}
Modified: freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_esf/mod_esf.c Mon Oct 20 13:48:42 2008
@@ -188,8 +188,8 @@
mcast_ip,
mcast_port,
read_codec->implementation->ianacode,
- read_codec->implementation->samples_per_frame,
- read_codec->implementation->microseconds_per_frame,
+ read_codec->implementation->samples_per_packet,
+ read_codec->implementation->microseconds_per_packet,
(switch_rtp_flag_t) flags, "soft", &err, switch_core_session_get_pool(session));
if (!switch_rtp_ready(rtp_session)) {
Modified: freeswitch/trunk/src/mod/applications/mod_fax/mod_fax.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_fax/mod_fax.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_fax/mod_fax.c Mon Oct 20 13:48:42 2008
@@ -577,12 +577,12 @@
"L16",
NULL,
orig_read_codec->implementation->samples_per_second,
- orig_read_codec->implementation->microseconds_per_frame / 1000,
+ orig_read_codec->implementation->microseconds_per_packet / 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 read codec activation Success L16 %u\n",
- read_codec.implementation->microseconds_per_frame);
+ read_codec.implementation->microseconds_per_packet);
switch_core_session_set_read_codec(session, &read_codec);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Raw read codec activation Failed L16\n");
@@ -593,7 +593,7 @@
"L16",
NULL,
orig_read_codec->implementation->samples_per_second,
- orig_read_codec->implementation->microseconds_per_frame / 1000,
+ orig_read_codec->implementation->microseconds_per_packet / 1000,
1,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
@@ -640,7 +640,7 @@
}
}
- if ((tx = fax_tx(pvt->fax_state, buf, write_codec.implementation->samples_per_frame)) < 0) {
+ if ((tx = fax_tx(pvt->fax_state, buf, write_codec.implementation->samples_per_packet)) < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "fax_tx reported an error\n");
goto done;
}
Modified: freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_fsv/mod_fsv.c Mon Oct 20 13:48:42 2008
@@ -123,7 +123,7 @@
"L16",
NULL,
read_codec->implementation->samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
+ read_codec->implementation->microseconds_per_packet / 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, "Audio Codec Activation Success\n");
@@ -146,7 +146,7 @@
switch_set_string(h.video_fmtp, vid_codec->fmtp_in);
}
h.audio_rate = read_codec->implementation->samples_per_second;
- h.audio_ptime = read_codec->implementation->microseconds_per_frame / 1000;
+ h.audio_ptime = read_codec->implementation->microseconds_per_packet / 1000;
if (write(fd, &h, sizeof(h)) != sizeof(h)) {
goto end;
@@ -265,8 +265,8 @@
read_codec = switch_core_session_get_read_codec(session);
- if (switch_core_timer_init(&timer, "soft", read_codec->implementation->microseconds_per_frame / 1000,
- read_codec->implementation->samples_per_frame, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
+ if (switch_core_timer_init(&timer, "soft", read_codec->implementation->microseconds_per_packet / 1000,
+ read_codec->implementation->samples_per_packet, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer Activation Fail\n");
goto end;
}
Modified: freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_rss/mod_rss.c Mon Oct 20 13:48:42 2008
@@ -186,7 +186,7 @@
const char *vcf = NULL;
char *chanvars = switch_channel_build_param_string(channel, NULL, NULL);
switch_codec_t *read_codec = switch_core_session_get_read_codec(session);
- uint32_t rate, interval = read_codec->implementation->microseconds_per_frame / 1000;
+ uint32_t rate, interval = read_codec->implementation->microseconds_per_packet / 1000;
if ((vcf = switch_channel_get_variable(channel, "rss_alt_config"))) {
cf = vcf;
Modified: freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c (original)
+++ freeswitch/trunk/src/mod/codecs/mod_amr/mod_amr.c Mon Oct 20 13:48:42 2008
@@ -285,7 +285,7 @@
}
Decoder_Interface_Decode(context->decoder_state, (unsigned char *) encoded_data, (int16_t *) decoded_data, 0);
- *decoded_data_len = codec->implementation->bytes_per_frame;
+ *decoded_data_len = codec->implementation->decoded_bytes_per_packet;
return SWITCH_STATUS_SUCCESS;
#endif
@@ -320,8 +320,8 @@
SWITCH_ADD_CODEC(codec_interface, "AMR");
switch_core_codec_add_implementation(pool, codec_interface,
- SWITCH_CODEC_TYPE_AUDIO, 96, "AMR", "octet-align=0", 8000, 8000, 12200,
- 20000, 160, 320, 0, 1, 1, 1, switch_amr_init, switch_amr_encode, switch_amr_decode, switch_amr_destroy);
+ SWITCH_CODEC_TYPE_AUDIO, 96, "AMR", "octet-align=0", 8000, 8000, 12200, 20000, 160, 320, 0, 1, 1,
+ switch_amr_init, switch_amr_encode, switch_amr_decode, switch_amr_destroy);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/trunk/src/mod/codecs/mod_g723_1/mod_g723_1.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_g723_1/mod_g723_1.c (original)
+++ freeswitch/trunk/src/mod/codecs/mod_g723_1/mod_g723_1.c Mon Oct 20 13:48:42 2008
@@ -131,7 +131,7 @@
}
Coder(&context->encoder_object, (FLOAT *) context->cod_float_buf, ebuf);
- *encoded_data_len = codec->implementation->encoded_bytes_per_frame;
+ *encoded_data_len = codec->implementation->encoded_bytes_per_packet;
return SWITCH_STATUS_SUCCESS;
#endif
@@ -161,7 +161,7 @@
for (x = 0; x < Frame; x++) {
to_slin_buf[x] = context->dec_float_buf[x];
}
- *decoded_data_len = codec->implementation->bytes_per_frame;
+ *decoded_data_len = codec->implementation->decoded_bytes_per_packet;
return SWITCH_STATUS_SUCCESS;
#endif
@@ -177,7 +177,7 @@
for (count = 1; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 4, "G723", NULL, 8000, 8000, 6300,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 4,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, count,
switch_g723_init, switch_g723_encode, switch_g723_decode, switch_g723_destroy);
}
/* indicate that the module should continue to be loaded */
Modified: freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c (original)
+++ freeswitch/trunk/src/mod/codecs/mod_g729/mod_g729.c Mon Oct 20 13:48:42 2008
@@ -218,7 +218,7 @@
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 18, "G729", NULL, 8000, 8000, 8000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, count * 10,
switch_g729_init, switch_g729_encode, switch_g729_decode, switch_g729_destroy);
}
/* indicate that the module should continue to be loaded */
Modified: freeswitch/trunk/src/mod/codecs/mod_h26x/mod_h26x.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_h26x/mod_h26x.c (original)
+++ freeswitch/trunk/src/mod/codecs/mod_h26x/mod_h26x.c Mon Oct 20 13:48:42 2008
@@ -85,23 +85,23 @@
SWITCH_ADD_CODEC(codec_interface, "H.264 Video (passthru)");
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_VIDEO, 99, "H264", NULL, 90000, 90000, 0,
- 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+ 0, 0, 0, 0, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
SWITCH_ADD_CODEC(codec_interface, "H.263 Video (passthru)");
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_VIDEO, 34, "H263", NULL, 90000, 90000, 0,
- 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+ 0, 0, 0, 0, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
SWITCH_ADD_CODEC(codec_interface, "H.263+ Video (passthru)");
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_VIDEO, 115, "H263-1998", NULL, 90000, 90000, 0,
- 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+ 0, 0, 0, 0, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
SWITCH_ADD_CODEC(codec_interface, "H.263++ Video (passthru)");
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_VIDEO, 121, "H263-2000", NULL, 90000, 90000, 0,
- 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+ 0, 0, 0, 0, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
SWITCH_ADD_CODEC(codec_interface, "H.261 Video (passthru)");
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_VIDEO, 31, "H261", NULL, 90000, 90000, 0,
- 0, 0, 0, 0, 1, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
+ 0, 0, 0, 0, 1, 1, switch_h26x_init, switch_h26x_encode, switch_h26x_decode, switch_h26x_destroy);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
}
Modified: freeswitch/trunk/src/mod/codecs/mod_ilbc/mod_ilbc.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_ilbc/mod_ilbc.c (original)
+++ freeswitch/trunk/src/mod/codecs/mod_ilbc/mod_ilbc.c Mon Oct 20 13:48:42 2008
@@ -50,7 +50,7 @@
{
struct ilbc_context *context;
int encoding, decoding;
- uint8_t ms = (uint8_t) (codec->implementation->microseconds_per_frame / 1000);
+ uint8_t ms = (uint8_t) (codec->implementation->microseconds_per_packet / 1000);
if (ms != 20 && ms != 30) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "invalid speed! (I should never happen)\n");
@@ -189,28 +189,28 @@
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 97, "iLBC", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
- 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
+ 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1,
switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
- 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
+ 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1,
switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC102", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
- 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
+ 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1,
switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC20ms", "mode=20", 8000, 8000, NO_OF_BYTES_20MS * 8 * 8000 / BLOCKL_20MS,
- 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1, 1,
+ 20000, 160, 320, NO_OF_BYTES_20MS, 1, 1,
switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
/* 30ms variants */
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 98, "iLBC", "mode=30", 8000, 8000, NO_OF_BYTES_30MS * 8 * 8000 / BLOCKL_30MS,
- 30000, 240, 480, NO_OF_BYTES_30MS, 1, 1, 1,
+ 30000, 240, 480, NO_OF_BYTES_30MS, 1, 1,
switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 102, "iLBC", "mode=30", 8000, 8000, NO_OF_BYTES_30MS * 8 * 8000 / BLOCKL_30MS,
- 30000, 240, 480, NO_OF_BYTES_30MS, 1, 1, 1,
+ 30000, 240, 480, NO_OF_BYTES_30MS, 1, 1,
switch_ilbc_init, switch_ilbc_encode, switch_ilbc_decode, switch_ilbc_destroy);
/* indicate that the module should continue to be loaded */
Modified: freeswitch/trunk/src/mod/codecs/mod_speex/mod_speex.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_speex/mod_speex.c (original)
+++ freeswitch/trunk/src/mod/codecs/mod_speex/mod_speex.c Mon Oct 20 13:48:42 2008
@@ -229,7 +229,7 @@
speex_bits_read_from(&context->decoder_bits, (char *) encoded_data, (int) encoded_data_len);
speex_decode_int(context->decoder_state, &context->decoder_bits, buf);
}
- *decoded_data_len = codec->implementation->bytes_per_frame;
+ *decoded_data_len = codec->implementation->decoded_bytes_per_packet;
return SWITCH_STATUS_SUCCESS;
}
@@ -274,7 +274,7 @@
for (countb = 1; countb > 0; countb--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, ianacode[counta], "SPEEX", NULL, rate, rate, bps[counta],
- mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, 1, 6,
+ mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, 1,
switch_speex_init, switch_speex_encode, switch_speex_decode, switch_speex_destroy);
}
rate = rate * 2;
Modified: freeswitch/trunk/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c
==============================================================================
--- freeswitch/trunk/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c (original)
+++ freeswitch/trunk/src/mod/codecs/mod_voipcodecs/mod_voipcodecs.c Mon Oct 20 13:48:42 2008
@@ -242,8 +242,8 @@
ebuf = encoded_data;
if (*flag & SWITCH_CODEC_FLAG_SILENCE) {
- memset(dbuf, 0, codec->implementation->bytes_per_frame);
- *decoded_data_len = codec->implementation->bytes_per_frame;
+ memset(dbuf, 0, codec->implementation->decoded_bytes_per_packet);
+ *decoded_data_len = codec->implementation->decoded_bytes_per_packet;
} else {
for (i = 0; i < encoded_data_len; i++) {
dbuf[i] = ulaw_to_linear(ebuf[i]);
@@ -313,8 +313,8 @@
ebuf = encoded_data;
if (*flag & SWITCH_CODEC_FLAG_SILENCE) {
- memset(dbuf, 0, codec->implementation->bytes_per_frame);
- *decoded_data_len = codec->implementation->bytes_per_frame;
+ memset(dbuf, 0, codec->implementation->decoded_bytes_per_packet);
+ *decoded_data_len = codec->implementation->decoded_bytes_per_packet;
} else {
for (i = 0; i < encoded_data_len; i++) {
dbuf[i] = alaw_to_linear(ebuf[i]);
@@ -569,14 +569,14 @@
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 5, "DVI4", NULL, 8000, 8000, 32000,
- mpf * count, spf * count, bpf * count, (ebpf * count) + 4, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, (ebpf * count) + 4, 1, spf * count,
switch_adpcm_init, switch_adpcm_encode, switch_adpcm_decode, switch_adpcm_destroy);
}
mpf = 10000, spf = 160, bpf = 320, ebpf = 160;
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 6, "DVI4", NULL, 16000, 16000, 64000,
- mpf * count, spf * count, bpf * count, (ebpf * count) + 4, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, (ebpf * count) + 4, 1, spf * count,
switch_adpcm_init, switch_adpcm_encode, switch_adpcm_decode, switch_adpcm_destroy);
}
@@ -586,14 +586,14 @@
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 124, "AAL2-G726-16", NULL, 8000, 8000, 16000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, count * 10,
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
}
SWITCH_ADD_CODEC(codec_interface, "G.726 16k");
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 127, "G726-16", NULL, 8000, 8000, 16000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, count * 10,
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
}
/* Increase encoded bytes per frame by 10 */
@@ -603,14 +603,14 @@
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 123, "AAL2-G726-24", NULL, 8000, 8000, 24000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, count * 10,
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
}
SWITCH_ADD_CODEC(codec_interface, "G.726 24k");
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 126, "G726-24", NULL, 8000, 8000, 24000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, count * 10,
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
}
/* Increase encoded bytes per frame by 10 */
@@ -620,14 +620,14 @@
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 2, "AAL2-G726-32", NULL, 8000, 8000, 32000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, count * 10,
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
}
SWITCH_ADD_CODEC(codec_interface, "G.726 32k");
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 2, "G726-32", NULL, 8000, 8000, 32000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, count * 10,
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
}
/* Increase encoded bytes per frame by 10 */
@@ -637,14 +637,14 @@
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 122, "AAL2-G726-40", NULL, 8000, 8000, 40000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, count * 10,
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
}
SWITCH_ADD_CODEC(codec_interface, "G.726 40k");
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 125, "G726-40", NULL, 8000, 8000, 40000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, count * 10,
switch_g726_init, switch_g726_encode, switch_g726_decode, switch_g726_destroy);
}
@@ -654,7 +654,7 @@
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 9, "G722", NULL, 8000, 16000, 64000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, spf * count,
switch_g722_init, switch_g722_encode, switch_g722_decode, switch_g722_destroy);
}
@@ -665,7 +665,7 @@
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 0, "PCMU", NULL, 8000, 8000, 64000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, spf * count,
switch_g711u_init, switch_g711u_encode, switch_g711u_decode, switch_g711u_destroy);
}
@@ -673,7 +673,7 @@
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 8, "PCMA", NULL, 8000, 8000, 64000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 12,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, spf * count,
switch_g711a_init, switch_g711a_encode, switch_g711a_decode, switch_g711a_destroy);
}
#endif
@@ -684,7 +684,7 @@
for (count = 6; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 3, "GSM", NULL, 8000, 8000, 13200,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, 1, 6,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, count,
switch_gsm_init, switch_gsm_encode, switch_gsm_decode, switch_gsm_destroy);
}
/* LPC10 */
@@ -692,7 +692,7 @@
SWITCH_ADD_CODEC(codec_interface, "LPC-10");
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 7, "LPC", NULL, 8000, 8000, 2400,
- 90000, 720, 1440, 28, 1, 1, 1, switch_lpc10_init, switch_lpc10_encode, switch_lpc10_decode, switch_lpc10_destroy);
+ 90000, 720, 1440, 28, 1, 4, switch_lpc10_init, switch_lpc10_encode, switch_lpc10_decode, switch_lpc10_destroy);
#endif
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
Modified: freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_alsa/mod_alsa.c Mon Oct 20 13:48:42 2008
@@ -272,7 +272,7 @@
}
}
- switch_yield(globals.read_codec.implementation->microseconds_per_frame);
+ switch_yield(globals.read_codec.implementation->microseconds_per_packet);
}
switch_clear_flag_locked((&globals), GFLAG_RING);
@@ -578,14 +578,14 @@
goto hold;
}
cng:
- switch_yield(globals.read_codec.implementation->microseconds_per_frame);
+ switch_yield(globals.read_codec.implementation->microseconds_per_packet);
*frame = &globals.cng_frame;
return SWITCH_STATUS_SUCCESS;
hold:
{
- switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
+ switch_size_t olen = globals.read_codec.implementation->samples_per_packet;
if (switch_core_timer_next(&tech_pvt->timer) != SWITCH_STATUS_SUCCESS) {
switch_core_file_close(&tech_pvt->fh);
switch_core_codec_destroy(&tech_pvt->write_codec);
@@ -611,7 +611,7 @@
}
switch_mutex_lock(globals.device_lock);
- if ((samples = snd_pcm_readi(globals.audio_stream_in, globals.read_frame.data, globals.read_codec.implementation->samples_per_frame)) > 0) {
+ if ((samples = snd_pcm_readi(globals.audio_stream_in, globals.read_frame.data, globals.read_codec.implementation->samples_per_packet)) > 0) {
globals.read_frame.datalen = samples * 2;
globals.read_frame.samples = samples;
@@ -990,7 +990,7 @@
}
if (switch_core_timer_init(&globals.timer,
- globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_frame, module_pool) != SWITCH_STATUS_SUCCESS) {
+ globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_packet, module_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
switch_core_codec_destroy(&globals.read_codec);
switch_core_codec_destroy(&globals.write_codec);
@@ -1088,12 +1088,12 @@
goto fail;
}
- if ((err = snd_pcm_hw_params_set_period_time(globals.audio_stream_in, hw_params, globals.read_codec.implementation->microseconds_per_frame, 0)) < 0) {
+ if ((err = snd_pcm_hw_params_set_period_time(globals.audio_stream_in, hw_params, globals.read_codec.implementation->microseconds_per_packet, 0)) < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set period time (%s)\n", snd_strerror(err));
goto fail;
}
- if ((err = snd_pcm_hw_params_set_period_size(globals.audio_stream_in, hw_params, globals.read_codec.implementation->samples_per_frame, 0)) < 0) {
+ if ((err = snd_pcm_hw_params_set_period_size(globals.audio_stream_in, hw_params, globals.read_codec.implementation->samples_per_packet, 0)) < 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "cannot set period size (%s)\n", snd_strerror(err));
goto fail;
}
Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c Mon Oct 20 13:48:42 2008
@@ -879,8 +879,8 @@
tech_pvt->remote_ip,
tech_pvt->remote_port,
tech_pvt->codec_num,
- tech_pvt->read_codec.implementation->samples_per_frame,
- tech_pvt->read_codec.implementation->microseconds_per_frame,
+ tech_pvt->read_codec.implementation->samples_per_packet,
+ tech_pvt->read_codec.implementation->microseconds_per_packet,
flags, tech_pvt->profile->timer_name, &err, switch_core_session_get_pool(tech_pvt->session)))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "RTP ERROR %s\n", err);
switch_channel_hangup(channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);
@@ -1389,10 +1389,10 @@
int frames = 1;
if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
- if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame)) {
+ if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet)) {
frames = (tech_pvt->read_frame.datalen / bytes);
}
- tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_codec.implementation->samples_per_frame);
+ tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_codec.implementation->samples_per_packet);
}
break;
}
@@ -1440,13 +1440,13 @@
switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
if (!switch_test_flag(frame, SFF_CNG)) {
- if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
- bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
+ if (tech_pvt->read_codec.implementation->encoded_bytes_per_packet) {
+ bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet;
frames = ((int) frame->datalen / bytes);
} else
frames = 1;
- samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
+ samples = frames * tech_pvt->read_codec.implementation->samples_per_packet;
}
#if 0
printf("%s %s->%s send %d bytes %d samples in %d frames ts=%d\n",
Modified: freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_iax/mod_iax.c Mon Oct 20 13:48:42 2008
@@ -256,7 +256,7 @@
}
leading = iana2ast(codecs[0]->ianacode);
- interval = codecs[0]->microseconds_per_frame / 1000;
+ interval = codecs[0]->microseconds_per_packet / 1000;
if (io == IAX_QUERY) {
chosen = leading;
*format = chosen;
@@ -296,7 +296,7 @@
for (imp = codecs[z]; imp; imp = imp->next) {
if (prefs[x] == iana2ast(imp->ianacode)) {
dname = imp->iananame;
- interval = imp->microseconds_per_frame / 1000;
+ interval = imp->microseconds_per_packet / 1000;
break;
}
}
@@ -313,7 +313,7 @@
unsigned int cap = iana2ast(imp->ianacode);
if (cap == chosen) {
dname = imp->iananame;
- interval = imp->microseconds_per_frame / 1000;
+ interval = imp->microseconds_per_packet / 1000;
break;
}
}
@@ -326,7 +326,7 @@
if (cap & mixed_cap) {
chosen = cap;
dname = imp->iananame;
- interval = imp->microseconds_per_frame / 1000;
+ interval = imp->microseconds_per_packet / 1000;
break;
}
}
@@ -393,7 +393,7 @@
} else {
int ms;
int rate;
- ms = tech_pvt->write_codec.implementation->microseconds_per_frame / 1000;
+ ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000;
rate = tech_pvt->write_codec.implementation->samples_per_second;
tech_pvt->read_frame.rate = rate;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Activate Codec %s/%d %d ms\n", dname, rate, ms);
@@ -646,7 +646,7 @@
switch_swap_linear(frame->data, (int) frame->datalen / 2);
}
#endif
- iax_send_voice(tech_pvt->iax_session, tech_pvt->codec, frame->data, (int) frame->datalen, tech_pvt->write_codec.implementation->samples_per_frame);
+ iax_send_voice(tech_pvt->iax_session, tech_pvt->codec, frame->data, (int) frame->datalen, tech_pvt->write_codec.implementation->samples_per_packet);
return SWITCH_STATUS_SUCCESS;
@@ -1086,14 +1086,14 @@
break;
}
- if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
- bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
+ if (tech_pvt->read_codec.implementation->encoded_bytes_per_packet) {
+ bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet;
frames = (int) (tech_pvt->read_frame.datalen / bytes);
} else {
frames = 1;
}
- tech_pvt->read_frame.samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
+ tech_pvt->read_frame.samples = frames * tech_pvt->read_codec.implementation->samples_per_packet;
memcpy(tech_pvt->read_frame.data, iaxevent->data, iaxevent->datalen);
/* wake up the i/o thread */
switch_set_flag_locked(tech_pvt, TFLAG_VOICE);
Modified: freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_loopback/mod_loopback.c Mon Oct 20 13:48:42 2008
@@ -107,7 +107,7 @@
if (codec) {
iananame = codec->implementation->iananame;
rate = codec->implementation->samples_per_second;
- interval = codec->implementation->microseconds_per_frame / 1000;
+ interval = codec->implementation->microseconds_per_packet / 1000;
}
if (tech_pvt->read_codec.implementation) {
@@ -163,7 +163,7 @@
tech_pvt->cng_frame.datalen = 2;
tech_pvt->bowout_frame_count = (tech_pvt->read_codec.implementation->actual_samples_per_second /
- tech_pvt->read_codec.implementation->samples_per_frame) * 3;
+ tech_pvt->read_codec.implementation->samples_per_packet) * 3;
switch_core_session_set_read_codec(session, &tech_pvt->read_codec);
switch_core_session_set_write_codec(session, &tech_pvt->write_codec);
@@ -175,8 +175,8 @@
read_impl = tech_pvt->read_codec.implementation;
switch_core_timer_init(&tech_pvt->timer, "soft",
- read_impl->microseconds_per_frame / 1000,
- read_impl->samples_per_frame *4,
+ read_impl->microseconds_per_packet / 1000,
+ read_impl->samples_per_packet *4,
switch_core_session_get_pool(session));
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c Mon Oct 20 13:48:42 2008
@@ -492,7 +492,7 @@
if (!is_master(tech_pvt)) {
if (tech_pvt->hold_file) {
- switch_size_t olen = globals.read_codec.implementation->samples_per_frame;
+ switch_size_t olen = globals.read_codec.implementation->samples_per_packet;
if (!tech_pvt->hfh) {
int sample_rate = tech_pvt->sample_rate ? tech_pvt->sample_rate : globals.sample_rate;
@@ -541,7 +541,7 @@
switch_mutex_lock(globals.device_lock);
samples = ReadAudioStream(globals.audio_stream, globals.read_frame.data,
- globals.read_codec.implementation->samples_per_frame, &globals.timer);
+ globals.read_codec.implementation->samples_per_packet, &globals.timer);
switch_mutex_unlock(globals.device_lock);
if (samples) {
@@ -740,7 +740,7 @@
globals.read_frame.buflen = sizeof(globals.databuf);
globals.cng_frame.data = globals.cngbuf;
globals.cng_frame.buflen = sizeof(globals.cngbuf);
- globals.cng_frame.datalen = switch_samples_per_frame(globals.sample_rate, globals.codec_ms) * 2;
+ globals.cng_frame.datalen = switch_samples_per_packet(globals.sample_rate, globals.codec_ms) * 2;
switch_set_flag((&globals.cng_frame), SFF_CNG);
/* connect my internal structure to the blank pointer passed to me */
@@ -1161,7 +1161,7 @@
}
if (switch_core_timer_init(&globals.timer,
- globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_frame,
+ globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_packet,
module_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup timer failed!\n");
switch_core_codec_destroy(&globals.read_codec);
@@ -1170,7 +1170,7 @@
}
if (switch_core_timer_init(&globals.hold_timer,
- globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_frame,
+ globals.timer_name, codec_ms, globals.read_codec.implementation->samples_per_packet,
module_pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "setup hold timer failed!\n");
switch_core_codec_destroy(&globals.read_codec);
@@ -1196,7 +1196,7 @@
outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
outputParameters.hostApiSpecificStreamInfo = NULL;
err = OpenAudioStream(&globals.audio_stream, &inputParameters, &outputParameters, sample_rate, paClipOff,
- globals.read_codec.implementation->samples_per_frame);
+ globals.read_codec.implementation->samples_per_packet);
/* UNLOCKED ************************************************************************************************* */
switch_mutex_unlock(globals.device_lock);
@@ -1232,7 +1232,7 @@
outputParameters.sampleFormat = SAMPLE_TYPE;
outputParameters.suggestedLatency = Pa_GetDeviceInfo(outputParameters.device)->defaultLowOutputLatency;
outputParameters.hostApiSpecificStreamInfo = NULL;
- err = OpenAudioStream(&globals.ring_stream, NULL, &outputParameters, sample_rate, paClipOff, globals.read_codec.implementation->samples_per_frame);
+ err = OpenAudioStream(&globals.ring_stream, NULL, &outputParameters, sample_rate, paClipOff, globals.read_codec.implementation->samples_per_packet);
/* UNLOCKED ************************************************************************************************* */
switch_mutex_unlock(globals.device_lock);
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.c Mon Oct 20 13:48:42 2008
@@ -218,7 +218,7 @@
*/
PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
const PaStreamParameters * inputParameters,
- const PaStreamParameters * outputParameters, double sampleRate, PaStreamFlags streamFlags, long samples_per_frame)
+ const PaStreamParameters * outputParameters, double sampleRate, PaStreamFlags streamFlags, long samples_per_packet)
{
long bytesPerSample = 2;
PaError err;
@@ -244,7 +244,7 @@
channels = outputParameters->channelCount;
}
- numFrames = RoundUpToNextPowerOf2(samples_per_frame * 5);
+ numFrames = RoundUpToNextPowerOf2(samples_per_packet * 5);
aStream->bytesPerFrame = bytesPerSample;
/* Initialize Ring Buffers */
@@ -268,7 +268,7 @@
/* Open a PortAudio stream that we will use to communicate with the underlying
* audio drivers. */
- err = Pa_OpenStream(&aStream->stream, inputParameters, outputParameters, sampleRate, samples_per_frame, streamFlags, blockingIOCallback, aStream);
+ err = Pa_OpenStream(&aStream->stream, inputParameters, outputParameters, sampleRate, samples_per_packet, streamFlags, blockingIOCallback, aStream);
if (err != paNoError)
goto error;
Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.h
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.h (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/pablio.h Mon Oct 20 13:48:42 2008
@@ -104,7 +104,7 @@
*/
PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
const PaStreamParameters * inputParameters,
- const PaStreamParameters * outputParameters, double sampleRate, PaStreamCallbackFlags statusFlags, long samples_per_frame);
+ const PaStreamParameters * outputParameters, double sampleRate, PaStreamCallbackFlags statusFlags, long samples_per_packet);
PaError CloseAudioStream(PABLIO_Stream * aStream);
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c Mon Oct 20 13:48:42 2008
@@ -664,10 +664,10 @@
*frame = NULL;
return SWITCH_STATUS_GENERR;
}
- if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame)) {
+ if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet)) {
frames = (tech_pvt->read_frame.datalen / bytes);
}
- tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_codec.implementation->samples_per_frame);
+ tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_codec.implementation->samples_per_packet);
}
break;
}
@@ -722,13 +722,13 @@
switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
if (!switch_test_flag(frame, SFF_CNG) && !switch_test_flag(frame, SFF_PROXY_PACKET)) {
- if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
- bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
+ if (tech_pvt->read_codec.implementation->encoded_bytes_per_packet) {
+ bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_packet;
frames = ((int) frame->datalen / bytes);
} else
frames = 1;
- samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
+ samples = frames * tech_pvt->read_codec.implementation->samples_per_packet;
}
tech_pvt->timestamp_send += samples;
Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c (original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/sofia_glue.c Mon Oct 20 13:48:42 2008
@@ -118,7 +118,7 @@
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode);
if (!ptime) {
- ptime = imp->microseconds_per_frame / 1000;
+ ptime = imp->microseconds_per_packet / 1000;
}
}
}
@@ -141,7 +141,7 @@
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), "a=fmtp:%d %s\n", tech_pvt->agreed_pt, tech_pvt->fmtp_out);
}
if (tech_pvt->read_codec.implementation && !ptime) {
- ptime = tech_pvt->read_codec.implementation->microseconds_per_frame / 1000;
+ ptime = tech_pvt->read_codec.implementation->microseconds_per_packet / 1000;
}
} else if (tech_pvt->num_codecs) {
@@ -253,7 +253,7 @@
switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), " %d", imp->ianacode);
if (!ptime) {
- ptime = imp->microseconds_per_frame / 1000;
+ ptime = imp->microseconds_per_packet / 1000;
}
}
}
@@ -1487,7 +1487,7 @@
} else {
int ms;
tech_pvt->video_read_frame.rate = tech_pvt->video_rm_rate;
- ms = tech_pvt->video_write_codec.implementation->microseconds_per_frame / 1000;
+ ms = tech_pvt->video_write_codec.implementation->microseconds_per_packet / 1000;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set VIDEO Codec %s %s/%ld %d ms\n",
switch_channel_get_name(tech_pvt->channel), tech_pvt->video_rm_encoding, tech_pvt->video_rm_rate, tech_pvt->video_codec_ms);
tech_pvt->video_read_frame.codec = &tech_pvt->video_read_codec;
@@ -1555,7 +1555,7 @@
}
tech_pvt->read_frame.rate = tech_pvt->rm_rate;
- ms = tech_pvt->write_codec.implementation->microseconds_per_frame / 1000;
+ ms = tech_pvt->write_codec.implementation->microseconds_per_packet / 1000;
if (!tech_pvt->read_codec.implementation) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
@@ -1564,7 +1564,7 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Set Codec %s %s/%ld %d ms %d samples\n",
switch_channel_get_name(tech_pvt->channel), tech_pvt->iananame, tech_pvt->rm_rate, tech_pvt->codec_ms,
- tech_pvt->read_codec.implementation->samples_per_frame);
+ tech_pvt->read_codec.implementation->samples_per_packet);
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
tech_pvt->write_codec.agreed_pt = tech_pvt->agreed_pt;
@@ -1721,7 +1721,7 @@
}
bw = tech_pvt->read_codec.implementation->bits_per_second;
- ms = tech_pvt->read_codec.implementation->microseconds_per_frame;
+ ms = tech_pvt->read_codec.implementation->microseconds_per_packet;
if (myflags) {
flags = myflags;
@@ -1784,7 +1784,7 @@
tech_pvt->local_sdp_audio_ip,
tech_pvt->local_sdp_audio_port,
tech_pvt->remote_sdp_audio_ip,
- tech_pvt->remote_sdp_audio_port, tech_pvt->agreed_pt, tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
+ tech_pvt->remote_sdp_audio_port, tech_pvt->agreed_pt, tech_pvt->read_codec.implementation->microseconds_per_packet / 1000);
}
switch_snprintf(tmp, sizeof(tmp), "%d", tech_pvt->remote_sdp_audio_port);
@@ -1826,7 +1826,7 @@
tech_pvt->local_sdp_audio_ip,
tech_pvt->local_sdp_audio_port,
tech_pvt->remote_sdp_audio_ip,
- tech_pvt->remote_sdp_audio_port, tech_pvt->agreed_pt, tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
+ tech_pvt->remote_sdp_audio_port, tech_pvt->agreed_pt, tech_pvt->read_codec.implementation->microseconds_per_packet / 1000);
} else {
timer_name = tech_pvt->profile->timer_name;
@@ -1841,7 +1841,7 @@
tech_pvt->remote_sdp_audio_ip,
tech_pvt->remote_sdp_audio_port,
tech_pvt->agreed_pt,
- tech_pvt->read_codec.implementation->samples_per_frame,
+ tech_pvt->read_codec.implementation->samples_per_packet,
tech_pvt->codec_ms * 1000,
(switch_rtp_flag_t) flags, timer_name, &err, switch_core_session_get_pool(tech_pvt->session));
@@ -1874,7 +1874,7 @@
}
}
- stun_ping = (ival * tech_pvt->read_codec.implementation->samples_per_second) / tech_pvt->read_codec.implementation->samples_per_frame;
+ stun_ping = (ival * tech_pvt->read_codec.implementation->samples_per_second) / tech_pvt->read_codec.implementation->samples_per_packet;
}
tech_pvt->ssrc = switch_rtp_get_ssrc(tech_pvt->rtp_session);
@@ -1902,7 +1902,7 @@
} else {
int qlen;
- qlen = len / (tech_pvt->read_codec.implementation->microseconds_per_frame / 1000);
+ qlen = len / (tech_pvt->read_codec.implementation->microseconds_per_packet / 1000);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting Jitterbuffer to %dms (%d frames)\n", len, qlen);
switch_rtp_activate_jitter_buffer(tech_pvt->rtp_session, qlen);
@@ -1925,7 +1925,7 @@
if (rtp_timeout_sec) {
tech_pvt->max_missed_packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_timeout_sec) /
- tech_pvt->read_codec.implementation->samples_per_frame;
+ tech_pvt->read_codec.implementation->samples_per_packet;
switch_rtp_set_max_missed_packets(tech_pvt->rtp_session, tech_pvt->max_missed_packets);
if (!rtp_hold_timeout_sec) {
@@ -1935,7 +1935,7 @@
if (rtp_hold_timeout_sec) {
tech_pvt->max_missed_hold_packets = (tech_pvt->read_codec.implementation->samples_per_second * rtp_hold_timeout_sec) /
- tech_pvt->read_codec.implementation->samples_per_frame;
+ tech_pvt->read_codec.implementation->samples_per_packet;
}
if (tech_pvt->te) {
@@ -2362,7 +2362,7 @@
}
if (match) {
- if ((ptime && ptime * 1000 != imp->microseconds_per_frame) || map->rm_rate != codec_rate) {
+ if ((ptime && ptime * 1000 != imp->microseconds_per_packet) || map->rm_rate != codec_rate) {
near_rate = map->rm_rate;
near_match = imp;
match = 0;
@@ -2393,7 +2393,7 @@
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Substituting codec %s@%ui@%uh\n",
- mimp->iananame, mimp->microseconds_per_frame / 1000, mimp->samples_per_second);
+ mimp->iananame, mimp->microseconds_per_packet / 1000, mimp->samples_per_second);
match = 1;
}
@@ -2408,7 +2408,7 @@
tech_pvt->iananame = switch_core_session_strdup(session, (char *) mimp->iananame);
tech_pvt->pt = (switch_payload_t) map->rm_pt;
tech_pvt->rm_rate = map->rm_rate;
- tech_pvt->codec_ms = mimp->microseconds_per_frame / 1000;
+ tech_pvt->codec_ms = mimp->microseconds_per_packet / 1000;
tech_pvt->remote_sdp_audio_ip = switch_core_session_strdup(session, (char *) connection->c_address);
tech_pvt->rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp);
tech_pvt->remote_sdp_audio_port = (switch_port_t) m->m_port;
@@ -2492,7 +2492,7 @@
char tmp[50];
tech_pvt->video_pt = (switch_payload_t) map->rm_pt;
tech_pvt->video_rm_rate = map->rm_rate;
- tech_pvt->video_codec_ms = mimp->microseconds_per_frame / 1000;
+ tech_pvt->video_codec_ms = mimp->microseconds_per_packet / 1000;
tech_pvt->remote_sdp_video_ip = switch_core_session_strdup(session, (char *) connection->c_address);
tech_pvt->video_rm_fmtp = switch_core_session_strdup(session, (char *) map->rm_fmtp);
tech_pvt->remote_sdp_video_port = (switch_port_t) m->m_port;
Modified: freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c
==============================================================================
--- freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c (original)
+++ freeswitch/trunk/src/mod/formats/mod_local_stream/mod_local_stream.c Mon Oct 20 13:48:42 2008
@@ -193,7 +193,7 @@
}
source->rate = fh.samplerate;
- source->samples = switch_samples_per_frame(fh.native_rate, source->interval);
+ source->samples = switch_samples_per_packet(fh.native_rate, source->interval);
if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, source->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n");
@@ -473,7 +473,7 @@
}
}
- source->samples = switch_samples_per_frame(source->rate, source->interval);
+ source->samples = switch_samples_per_packet(source->rate, source->interval);
switch_mutex_init(&source->mutex, SWITCH_MUTEX_NESTED, source->pool);
@@ -693,7 +693,7 @@
source->prebuf = prebuf;
source->stopped = 0;
- source->samples = switch_samples_per_frame(source->rate, source->interval);
+ source->samples = switch_samples_per_packet(source->rate, source->interval);
switch_mutex_init(&source->mutex, SWITCH_MUTEX_NESTED, source->pool);
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c Mon Oct 20 13:48:42 2008
@@ -1839,7 +1839,7 @@
read_codec = switch_core_session_get_read_codec(jss->session);
rate = read_codec->implementation->actual_samples_per_second;
- interval = read_codec->implementation->microseconds_per_frame / 1000;
+ interval = read_codec->implementation->microseconds_per_packet / 1000;
if (switch_core_codec_init(&jss->speech->codec,
"L16",
Modified: freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c
==============================================================================
--- freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c (original)
+++ freeswitch/trunk/src/mod/languages/mod_spidermonkey_teletone/mod_spidermonkey_teletone.c Mon Oct 20 13:48:42 2008
@@ -113,7 +113,7 @@
"L16",
NULL,
read_codec->implementation->actual_samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
+ read_codec->implementation->microseconds_per_packet / 1000,
read_codec->implementation->number_of_channels,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
@@ -123,7 +123,7 @@
}
if (timer_name) {
- unsigned int ms = read_codec->implementation->microseconds_per_frame / 1000;
+ unsigned int ms = read_codec->implementation->microseconds_per_packet / 1000;
if (switch_core_timer_init(&tto->timer_base,
timer_name,
ms,
@@ -279,7 +279,7 @@
}
}
if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(tto->audio_buffer,
- fdata, write_frame.codec->implementation->bytes_per_frame)) <= 0) {
+ fdata, write_frame.codec->implementation->decoded_bytes_per_packet)) <= 0) {
break;
}
Modified: freeswitch/trunk/src/switch_core_codec.c
==============================================================================
--- freeswitch/trunk/src/switch_core_codec.c (original)
+++ freeswitch/trunk/src/switch_core_codec.c Mon Oct 20 13:48:42 2008
@@ -98,7 +98,7 @@
}
}
- if (session->read_codec && codec && session->read_impl.bytes_per_frame) {
+ if (session->read_codec && codec && session->read_impl.decoded_bytes_per_packet) {
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(session->channel, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-read-codec-name", session->read_impl.iananame);
@@ -140,7 +140,7 @@
SWITCH_DECLARE(switch_status_t) switch_core_session_get_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
{
- if (session->read_impl.bytes_per_frame) {
+ if (session->read_impl.decoded_bytes_per_packet) {
*impp = session->read_impl;
return SWITCH_STATUS_SUCCESS;
}
@@ -150,7 +150,7 @@
SWITCH_DECLARE(switch_status_t) switch_core_session_get_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
{
- if (session->write_impl.bytes_per_frame) {
+ if (session->write_impl.decoded_bytes_per_packet) {
*impp = session->write_impl;
return SWITCH_STATUS_SUCCESS;
}
@@ -160,7 +160,7 @@
SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_read_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
{
- if (session->video_read_impl.bytes_per_frame) {
+ if (session->video_read_impl.decoded_bytes_per_packet) {
*impp = session->video_read_impl;
return SWITCH_STATUS_SUCCESS;
}
@@ -170,7 +170,7 @@
SWITCH_DECLARE(switch_status_t) switch_core_session_get_video_write_impl(switch_core_session_t *session, switch_codec_implementation_t *impp)
{
- if (session->video_write_impl.bytes_per_frame) {
+ if (session->video_write_impl.decoded_bytes_per_packet) {
*impp = session->video_write_impl;
return SWITCH_STATUS_SUCCESS;
}
@@ -217,7 +217,7 @@
session->write_impl = *codec->implementation;
}
- if (session->write_codec && codec && session->write_impl.bytes_per_frame) {
+ if (session->write_codec && codec && session->write_impl.decoded_bytes_per_packet) {
if (switch_event_create(&event, SWITCH_EVENT_CODEC) == SWITCH_STATUS_SUCCESS) {
switch_channel_event_set_data(session->channel, event);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "channel-write-codec-name", session->write_impl.iananame);
@@ -416,7 +416,7 @@
if (!ms) {
for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) {
if ((!rate || rate == iptr->samples_per_second) &&
- (20 == (iptr->microseconds_per_frame / 1000)) && (!channels || channels == iptr->number_of_channels)) {
+ (20 == (iptr->microseconds_per_packet / 1000)) && (!channels || channels == iptr->number_of_channels)) {
implementation = iptr;
goto found;
}
@@ -426,7 +426,7 @@
/* Either looking for a specific interval or there was no interval specified and there wasn't one @20ms available */
for (iptr = codec_interface->implementations; iptr; iptr = iptr->next) {
if ((!rate || rate == iptr->samples_per_second) &&
- (!ms || ms == (iptr->microseconds_per_frame / 1000)) && (!channels || channels == iptr->number_of_channels)) {
+ (!ms || ms == (iptr->microseconds_per_packet / 1000)) && (!channels || channels == iptr->number_of_channels)) {
implementation = iptr;
break;
}
Modified: freeswitch/trunk/src/switch_core_io.c
==============================================================================
--- freeswitch/trunk/src/switch_core_io.c (original)
+++ freeswitch/trunk/src/switch_core_io.c Mon Oct 20 13:48:42 2008
@@ -126,7 +126,7 @@
if (session->read_frame_count == 0) {
switch_event_t *event;
session->read_frame_count = (session->read_codec->implementation->actual_samples_per_second /
- session->read_codec->implementation->samples_per_frame) * session->track_duration;
+ session->read_codec->implementation->samples_per_packet) * session->track_duration;
switch_event_create(&event, SWITCH_EVENT_SESSION_HEARTBEAT);
switch_channel_event_set_data(session->channel, event);
@@ -220,8 +220,8 @@
session->raw_read_frame.datalen = session->raw_read_frame.buflen;
if (is_cng) {
- memset(session->raw_read_frame.data, 255, read_frame->codec->implementation->bytes_per_frame);
- session->raw_read_frame.datalen = read_frame->codec->implementation->bytes_per_frame;
+ memset(session->raw_read_frame.data, 255, read_frame->codec->implementation->decoded_bytes_per_packet);
+ session->raw_read_frame.datalen = read_frame->codec->implementation->decoded_bytes_per_packet;
session->raw_read_frame.samples = session->raw_read_frame.datalen / sizeof(int16_t);
read_frame = &session->raw_read_frame;
status = SWITCH_STATUS_SUCCESS;
@@ -252,9 +252,9 @@
switch_mutex_lock(session->resample_mutex);
status = switch_resample_create(&session->read_resampler,
read_frame->codec->implementation->actual_samples_per_second,
- read_frame->codec->implementation->bytes_per_frame,
+ read_frame->codec->implementation->decoded_bytes_per_packet,
session->read_codec->implementation->actual_samples_per_second,
- session->read_codec->implementation->bytes_per_frame, session->pool);
+ session->read_codec->implementation->decoded_bytes_per_packet, session->pool);
switch_mutex_unlock(session->resample_mutex);
if (status != SWITCH_STATUS_SUCCESS) {
@@ -284,8 +284,8 @@
status = SWITCH_STATUS_SUCCESS;
break;
case SWITCH_STATUS_BREAK:
- memset(session->raw_read_frame.data, 255, read_frame->codec->implementation->bytes_per_frame);
- session->raw_read_frame.datalen = read_frame->codec->implementation->bytes_per_frame;
+ memset(session->raw_read_frame.data, 255, read_frame->codec->implementation->decoded_bytes_per_packet);
+ session->raw_read_frame.datalen = read_frame->codec->implementation->decoded_bytes_per_packet;
session->raw_read_frame.samples = session->raw_read_frame.datalen / sizeof(int16_t);
session->raw_read_frame.timestamp = read_frame->timestamp;
session->raw_read_frame.rate = read_frame->rate;
@@ -371,11 +371,11 @@
}
- if (read_frame->datalen == session->read_codec->implementation->bytes_per_frame) {
+ if (read_frame->datalen == session->read_codec->implementation->decoded_bytes_per_packet) {
perfect = TRUE;
} else {
if (!session->raw_read_buffer) {
- switch_size_t bytes = session->read_codec->implementation->bytes_per_frame;
+ switch_size_t bytes = session->read_codec->implementation->decoded_bytes_per_packet;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Engaging Read Buffer at %u bytes vs %u\n",
(uint32_t) bytes, (uint32_t) (*frame)->datalen);
switch_buffer_create_dynamic(&session->raw_read_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, bytes * SWITCH_BUFFER_START_FRAMES, 0);
@@ -387,14 +387,14 @@
}
- if (perfect || switch_buffer_inuse(session->raw_read_buffer) >= session->read_codec->implementation->bytes_per_frame) {
+ if (perfect || switch_buffer_inuse(session->raw_read_buffer) >= session->read_codec->implementation->decoded_bytes_per_packet) {
if (perfect) {
enc_frame = read_frame;
session->raw_read_frame.rate = read_frame->rate;
} else {
session->raw_read_frame.datalen = (uint32_t) switch_buffer_read(session->raw_read_buffer,
session->raw_read_frame.data,
- session->read_codec->implementation->bytes_per_frame);
+ session->read_codec->implementation->decoded_bytes_per_packet);
session->raw_read_frame.rate = session->read_codec->implementation->actual_samples_per_second;
enc_frame = &session->raw_read_frame;
@@ -416,7 +416,7 @@
case SWITCH_STATUS_RESAMPLE:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Fixme 1\n");
case SWITCH_STATUS_SUCCESS:
- session->enc_read_frame.samples = session->read_codec->implementation->bytes_per_frame / sizeof(int16_t);
+ session->enc_read_frame.samples = session->read_codec->implementation->decoded_bytes_per_packet / sizeof(int16_t);
if (perfect) {
session->enc_read_frame.timestamp = read_frame->timestamp;
session->enc_read_frame.rate = read_frame->rate;
@@ -428,7 +428,7 @@
*frame = &session->enc_read_frame;
break;
case SWITCH_STATUS_NOOP:
- session->raw_read_frame.samples = enc_frame->codec->implementation->samples_per_frame;
+ session->raw_read_frame.samples = enc_frame->codec->implementation->samples_per_packet;
session->raw_read_frame.timestamp = read_frame->timestamp;
session->raw_read_frame.payload = enc_frame->codec->implementation->ianacode;
session->raw_read_frame.m = read_frame->m;
@@ -618,9 +618,9 @@
switch_mutex_lock(session->resample_mutex);
status = switch_resample_create(&session->write_resampler,
frame->codec->implementation->actual_samples_per_second,
- frame->codec->implementation->bytes_per_frame,
+ frame->codec->implementation->decoded_bytes_per_packet,
session->write_codec->implementation->actual_samples_per_second,
- session->write_codec->implementation->bytes_per_frame, session->pool);
+ session->write_codec->implementation->decoded_bytes_per_packet, session->pool);
switch_mutex_unlock(session->resample_mutex);
if (status != SWITCH_STATUS_SUCCESS) {
goto done;
@@ -742,14 +742,14 @@
}
if (session->write_codec) {
- if (write_frame->datalen == session->write_codec->implementation->bytes_per_frame) {
+ if (write_frame->datalen == session->write_codec->implementation->decoded_bytes_per_packet) {
perfect = TRUE;
} else {
if (!session->raw_write_buffer) {
- switch_size_t bytes = session->write_codec->implementation->bytes_per_frame;
+ switch_size_t bytes = session->write_codec->implementation->decoded_bytes_per_packet;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Engaging Write Buffer at %u bytes to accommodate %u->%u\n",
- (uint32_t) bytes, write_frame->datalen, session->write_codec->implementation->bytes_per_frame);
+ (uint32_t) bytes, write_frame->datalen, session->write_codec->implementation->decoded_bytes_per_packet);
if ((status = switch_buffer_create_dynamic(&session->raw_write_buffer,
bytes * SWITCH_BUFFER_BLOCK_FRAMES,
bytes * SWITCH_BUFFER_START_FRAMES, 0)) != SWITCH_STATUS_SUCCESS) {
@@ -812,7 +812,7 @@
return status;
} else {
switch_size_t used = switch_buffer_inuse(session->raw_write_buffer);
- uint32_t bytes = session->write_codec->implementation->bytes_per_frame;
+ uint32_t bytes = session->write_codec->implementation->decoded_bytes_per_packet;
switch_size_t frames = (used / bytes);
status = SWITCH_STATUS_SUCCESS;
@@ -853,9 +853,9 @@
switch_mutex_lock(session->resample_mutex);
status = switch_resample_create(&session->write_resampler,
frame->codec->implementation->actual_samples_per_second,
- frame->codec->implementation->bytes_per_frame,
+ frame->codec->implementation->decoded_bytes_per_packet,
session->write_codec->implementation->actual_samples_per_second,
- session->write_codec->implementation->bytes_per_frame, session->pool);
+ session->write_codec->implementation->decoded_bytes_per_packet, session->pool);
switch_mutex_unlock(session->resample_mutex);
if (status != SWITCH_STATUS_SUCCESS) {
Modified: freeswitch/trunk/src/switch_core_media_bug.c
==============================================================================
--- freeswitch/trunk/src/switch_core_media_bug.c (original)
+++ freeswitch/trunk/src/switch_core_media_bug.c Mon Oct 20 13:48:42 2008
@@ -225,7 +225,7 @@
bug->stop_time = stop_time;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Attaching BUG to %s\n", switch_channel_get_name(session->channel));
- bytes = session->read_codec->implementation->bytes_per_frame;
+ bytes = session->read_codec->implementation->decoded_bytes_per_packet;
if (!bug->flags) {
bug->flags = (SMBF_READ_STREAM | SMBF_WRITE_STREAM);
@@ -236,7 +236,7 @@
switch_mutex_init(&bug->read_mutex, SWITCH_MUTEX_NESTED, session->pool);
}
- bytes = session->write_codec->implementation->bytes_per_frame;
+ bytes = session->write_codec->implementation->decoded_bytes_per_packet;
if (switch_test_flag(bug, SMBF_WRITE_STREAM)) {
switch_buffer_create_dynamic(&bug->raw_write_buffer, bytes * SWITCH_BUFFER_BLOCK_FRAMES, bytes * SWITCH_BUFFER_START_FRAMES, MAX_BUG_BUFFER);
Modified: freeswitch/trunk/src/switch_core_speech.c
==============================================================================
--- freeswitch/trunk/src/switch_core_speech.c (original)
+++ freeswitch/trunk/src/switch_core_speech.c Mon Oct 20 13:48:42 2008
@@ -78,7 +78,7 @@
sh->rate = rate;
sh->name = switch_core_strdup(pool, module_name);
- sh->samples = switch_samples_per_frame(rate, interval);
+ sh->samples = switch_samples_per_packet(rate, interval);
return sh->speech_interface->speech_open(sh, voice_name, rate, flags);
}
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Mon Oct 20 13:48:42 2008
@@ -246,15 +246,15 @@
"L16",
NULL,
read_codec->implementation->actual_samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
+ read_codec->implementation->microseconds_per_packet / 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->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
+ read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_packet / 1000);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Raw Codec Activation Failed L16@%uhz 1 channel %dms\n",
- read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
+ read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_packet / 1000);
goto fail;
}
}
@@ -519,7 +519,7 @@
}
rate = read_codec->implementation->actual_samples_per_second;
- bpf = read_codec->implementation->bytes_per_frame;
+ bpf = read_codec->implementation->decoded_bytes_per_packet;
switch_channel_set_flag(channel, CF_CONTROLLED);
if (switch_event_create(&event, SWITCH_EVENT_CHANNEL_PARK) == SWITCH_STATUS_SUCCESS) {
@@ -1733,8 +1733,8 @@
}
read_codec = switch_core_session_get_read_codec(session);
- interval = read_codec->implementation->microseconds_per_frame / 1000;
- samples = switch_samples_per_frame(read_codec->implementation->samples_per_second, interval);
+ interval = read_codec->implementation->microseconds_per_packet / 1000;
+ samples = switch_samples_per_packet(read_codec->implementation->samples_per_second, interval);
qlen = delay_ms / (interval);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen);
Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c (original)
+++ freeswitch/trunk/src/switch_ivr_async.c Mon Oct 20 13:48:42 2008
@@ -622,7 +622,7 @@
ep = switch_core_session_alloc(session, sizeof(*ep));
- tlen = tread_codec->implementation->bytes_per_frame;
+ tlen = tread_codec->implementation->decoded_bytes_per_packet;
switch_channel_pre_answer(channel);
@@ -630,7 +630,7 @@
"L16",
NULL,
tread_codec->implementation->actual_samples_per_second,
- tread_codec->implementation->microseconds_per_frame / 1000,
+ tread_codec->implementation->microseconds_per_packet / 1000,
tread_codec->implementation->number_of_channels,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c (original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c Mon Oct 20 13:48:42 2008
@@ -170,7 +170,7 @@
"L16",
NULL,
read_codec->implementation->actual_samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
+ read_codec->implementation->microseconds_per_packet / 1000,
1,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
NULL,
@@ -182,7 +182,7 @@
silence_frame.codec = &silence_codec;
silence_frame.data = silence_data;
silence_frame.buflen = sizeof(silence_data);
- silence_frame.datalen = read_codec->implementation->bytes_per_frame;
+ silence_frame.datalen = read_codec->implementation->decoded_bytes_per_packet;
silence_frame.samples = silence_frame.datalen / sizeof(int16_t);
}
}
Modified: freeswitch/trunk/src/switch_ivr_originate.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_originate.c (original)
+++ freeswitch/trunk/src/switch_ivr_originate.c Mon Oct 20 13:48:42 2008
@@ -357,17 +357,17 @@
"L16",
NULL,
read_codec->implementation->actual_samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
+ read_codec->implementation->microseconds_per_packet / 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->actual_samples_per_second, read_codec->implementation->microseconds_per_frame / 1000);
+ read_codec->implementation->actual_samples_per_second, read_codec->implementation->microseconds_per_packet / 1000);
write_frame.codec = &write_codec;
- write_frame.datalen = read_codec->implementation->bytes_per_frame;
+ write_frame.datalen = read_codec->implementation->decoded_bytes_per_packet;
write_frame.samples = write_frame.datalen / 2;
memset(write_frame.data, 255, write_frame.datalen);
@@ -460,9 +460,9 @@
unsigned int pos = 0;
if (ringback.asis) {
- mlen = write_frame.codec->implementation->encoded_bytes_per_frame;
+ mlen = write_frame.codec->implementation->encoded_bytes_per_packet;
} else {
- mlen = write_frame.codec->implementation->samples_per_frame;
+ mlen = write_frame.codec->implementation->samples_per_packet;
}
olen = mlen;
@@ -484,7 +484,7 @@
} else if (ringback.audio_buffer) {
if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(ringback.audio_buffer,
write_frame.data,
- write_frame.codec->implementation->bytes_per_frame)) <= 0) {
+ write_frame.codec->implementation->decoded_bytes_per_packet)) <= 0) {
break;
}
}
@@ -1194,7 +1194,7 @@
"L16",
NULL,
read_codec->implementation->actual_samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
+ read_codec->implementation->microseconds_per_packet / 1000,
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
@@ -1202,9 +1202,9 @@
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG,
"Raw Codec Activation Success L16@%uhz 1 channel %dms\n",
read_codec->implementation->actual_samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000);
+ read_codec->implementation->microseconds_per_packet / 1000);
write_frame.codec = &write_codec;
- write_frame.datalen = read_codec->implementation->bytes_per_frame;
+ write_frame.datalen = read_codec->implementation->decoded_bytes_per_packet;
write_frame.samples = write_frame.datalen / 2;
memset(write_frame.data, 255, write_frame.datalen);
@@ -1354,9 +1354,9 @@
unsigned int pos = 0;
if (ringback.asis) {
- mlen = write_frame.codec->implementation->encoded_bytes_per_frame;
+ mlen = write_frame.codec->implementation->encoded_bytes_per_packet;
} else {
- mlen = write_frame.codec->implementation->samples_per_frame;
+ mlen = write_frame.codec->implementation->samples_per_packet;
}
olen = mlen;
@@ -1379,7 +1379,7 @@
} else if (ringback.audio_buffer) {
if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(ringback.audio_buffer,
write_frame.data,
- write_frame.codec->implementation->bytes_per_frame)) <= 0) {
+ write_frame.codec->implementation->decoded_bytes_per_packet)) <= 0) {
break;
}
}
Modified: freeswitch/trunk/src/switch_ivr_play_say.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_play_say.c (original)
+++ freeswitch/trunk/src/switch_ivr_play_say.c Mon Oct 20 13:48:42 2008
@@ -448,7 +448,7 @@
codec_name,
NULL,
read_codec->implementation->actual_samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
+ read_codec->implementation->microseconds_per_packet / 1000,
read_codec->implementation->number_of_channels,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
@@ -457,7 +457,7 @@
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,
"Raw Codec Activation Failed %s@%uhz %u channels %dms\n", codec_name, fh->samplerate,
- fh->channels, read_codec->implementation->microseconds_per_frame / 1000);
+ fh->channels, read_codec->implementation->microseconds_per_packet / 1000);
switch_core_file_close(fh);
switch_core_session_reset(session, SWITCH_TRUE);
return SWITCH_STATUS_GENERR;
@@ -469,9 +469,9 @@
if (fh->thresh) {
if (fh->silence_hits) {
- fh->silence_hits = fh->samplerate * fh->silence_hits / read_codec->implementation->samples_per_frame;
+ fh->silence_hits = fh->samplerate * fh->silence_hits / read_codec->implementation->samples_per_packet;
} else {
- fh->silence_hits = fh->samplerate * 3 / read_codec->implementation->samples_per_frame;
+ fh->silence_hits = fh->samplerate * 3 / read_codec->implementation->samples_per_packet;
}
org_silence_hits = fh->silence_hits;
}
@@ -616,7 +616,7 @@
"L16",
NULL,
read_codec->implementation->actual_samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
+ read_codec->implementation->microseconds_per_packet / 1000,
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
@@ -696,7 +696,7 @@
}
}
- if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(audio_buffer, write_frame.data, read_codec->implementation->bytes_per_frame)) <= 0) {
+ if ((write_frame.datalen = (uint32_t) switch_buffer_read_loop(audio_buffer, write_frame.data, read_codec->implementation->decoded_bytes_per_packet)) <= 0) {
break;
}
@@ -902,7 +902,7 @@
}
switch_assert(read_codec != NULL);
- interval = read_codec->implementation->microseconds_per_frame / 1000;
+ interval = read_codec->implementation->microseconds_per_packet / 1000;
if (!fh->audio_buffer) {
switch_buffer_create_dynamic(&fh->audio_buffer, FILE_BLOCKSIZE, FILE_BUFSIZE, 0);
@@ -919,8 +919,8 @@
if (asis) {
write_frame.codec = read_codec;
- samples = read_codec->implementation->samples_per_frame;
- framelen = read_codec->implementation->encoded_bytes_per_frame;
+ samples = read_codec->implementation->samples_per_packet;
+ framelen = read_codec->implementation->encoded_bytes_per_packet;
} else {
codec_name = "L16";
@@ -941,8 +941,8 @@
status = SWITCH_STATUS_GENERR;
goto end;
}
- samples = codec.implementation->samples_per_frame;
- framelen = codec.implementation->bytes_per_frame;
+ samples = codec.implementation->samples_per_packet;
+ framelen = codec.implementation->decoded_bytes_per_packet;
}
if (timer_name) {
@@ -1288,7 +1288,7 @@
"L16",
NULL,
read_codec->implementation->actual_samples_per_second,
- read_codec->implementation->microseconds_per_frame / 1000,
+ read_codec->implementation->microseconds_per_packet / 1000,
1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
@@ -1312,14 +1312,14 @@
}
if (sample_count) {
- sample_count -= raw_codec.implementation->samples_per_frame;
+ sample_count -= raw_codec.implementation->samples_per_packet;
if (sample_count <= 0) {
break;
}
}
if (abuf) {
- switch_size_t olen = raw_codec.implementation->samples_per_frame;
+ switch_size_t olen = raw_codec.implementation->samples_per_packet;
if (switch_core_file_read(&fh, abuf, &olen) != SWITCH_STATUS_SUCCESS) {
break;
@@ -1647,7 +1647,7 @@
switch_assert(codec->implementation != NULL);
for (x = 0; !done && x < lead_in_out; x++) {
- switch_yield(codec->implementation->microseconds_per_frame);
+ switch_yield(codec->implementation->microseconds_per_packet);
if (timer) {
write_frame.timestamp = timer->samplecount;
}
@@ -1744,7 +1744,7 @@
if (status != SWITCH_STATUS_SUCCESS) {
for (x = 0; !done && x < lead_in_out; x++) {
- switch_yield(codec->implementation->microseconds_per_frame);
+ switch_yield(codec->implementation->microseconds_per_packet);
if (timer) {
write_frame.timestamp = timer->samplecount;
}
@@ -1889,7 +1889,7 @@
read_codec = switch_core_session_get_read_codec(session);
rate = read_codec->implementation->actual_samples_per_second;
- interval = read_codec->implementation->microseconds_per_frame / 1000;
+ interval = read_codec->implementation->microseconds_per_packet / 1000;
if (need_create) {
memset(sh, 0, sizeof(*sh));
Modified: freeswitch/trunk/src/switch_loadable_module.c
==============================================================================
--- freeswitch/trunk/src/switch_loadable_module.c (original)
+++ freeswitch/trunk/src/switch_loadable_module.c Mon Oct 20 13:48:42 2008
@@ -165,7 +165,7 @@
key);
break;
}
- if (impl->bytes_per_frame > SWITCH_RECOMMENDED_BUFFER_SIZE) {
+ if (impl->decoded_bytes_per_packet > SWITCH_RECOMMENDED_BUFFER_SIZE) {
load_interface = 0;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT,
"Failed to load codec interface %s from %s due to bytes per frame exceeding buffer size.\n", ptr->interface_name,
@@ -177,7 +177,7 @@
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->actual_samples_per_second, impl->microseconds_per_frame / 1000);
+ impl->iananame, ptr->interface_name, impl->actual_samples_per_second, impl->microseconds_per_packet / 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);
}
@@ -453,7 +453,7 @@
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->actual_samples_per_second, impl->microseconds_per_frame / 1000);
+ impl->iananame, ptr->interface_name, impl->actual_samples_per_second, impl->microseconds_per_packet / 1000);
if (switch_core_hash_find(loadable_modules.codec_hash, impl->iananame)) {
switch_core_hash_delete(loadable_modules.codec_hash, impl->iananame);
}
@@ -1288,7 +1288,7 @@
codec_interface = (switch_codec_interface_t *) val;
/* Look for a 20ms implementation because it's the safest choice */
for (imp = codec_interface->implementations; imp; imp = imp->next) {
- if (imp->microseconds_per_frame / 1000 == 20) {
+ if (imp->microseconds_per_packet / 1000 == 20) {
array[i++] = imp;
goto found;
}
@@ -1351,7 +1351,7 @@
uint8_t match = 1;
if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
- if ((uint32_t) (imp->microseconds_per_frame / 1000) != 20) {
+ if ((uint32_t) (imp->microseconds_per_packet / 1000) != 20) {
match = 0;
}
@@ -1372,7 +1372,7 @@
uint8_t match = 1;
if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO) {
- if (interval && (uint32_t) (imp->microseconds_per_frame / 1000) != interval) {
+ if (interval && (uint32_t) (imp->microseconds_per_packet / 1000) != interval) {
match = 0;
}
Modified: freeswitch/trunk/src/switch_pcm.c
==============================================================================
--- freeswitch/trunk/src/switch_pcm.c (original)
+++ freeswitch/trunk/src/switch_pcm.c Mon Oct 20 13:48:42 2008
@@ -176,8 +176,8 @@
ebuf = encoded_data;
if (*flag & SWITCH_CODEC_FLAG_SILENCE) {
- memset(dbuf, 0, codec->implementation->bytes_per_frame);
- *decoded_data_len = codec->implementation->bytes_per_frame;
+ memset(dbuf, 0, codec->implementation->decoded_bytes_per_packet);
+ *decoded_data_len = codec->implementation->decoded_bytes_per_packet;
} else {
for (i = 0; i < encoded_data_len; i++) {
dbuf[i] = ulaw_to_linear(ebuf[i]);
@@ -247,8 +247,8 @@
ebuf = encoded_data;
if (*flag & SWITCH_CODEC_FLAG_SILENCE) {
- memset(dbuf, 0, codec->implementation->bytes_per_frame);
- *decoded_data_len = codec->implementation->bytes_per_frame;
+ memset(dbuf, 0, codec->implementation->decoded_bytes_per_packet);
+ *decoded_data_len = codec->implementation->decoded_bytes_per_packet;
} else {
for (i = 0; i < encoded_data_len; i++) {
dbuf[i] = alaw_to_linear(ebuf[i]);
@@ -275,7 +275,7 @@
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 0, "PCMU", NULL, 8000, 8000, 64000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, spf * count, spf * count,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, spf * count,
switch_g711u_init, switch_g711u_encode, switch_g711u_decode, switch_g711u_destroy);
}
@@ -283,7 +283,7 @@
for (count = 12; count > 0; count--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 8, "PCMA", NULL, 8000, 8000, 64000,
- mpf * count, spf * count, bpf * count, ebpf * count, 1, spf * count, spf * count,
+ mpf * count, spf * count, bpf * count, ebpf * count, 1, spf * count,
switch_g711a_init, switch_g711a_encode, switch_g711a_decode, switch_g711a_destroy);
}
@@ -301,13 +301,13 @@
SWITCH_ADD_CODEC(codec_interface, "PROXY VIDEO PASS-THROUGH");
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_VIDEO, 31, "PROXY-VID", NULL, 90000, 90000, 0,
- 0, 0, 0, 0, 1, 1, 1, switch_proxy_init, switch_proxy_encode, switch_proxy_decode, switch_proxy_destroy);
+ 0, 0, 0, 0, 1, 1, switch_proxy_init, switch_proxy_encode, switch_proxy_decode, switch_proxy_destroy);
SWITCH_ADD_CODEC(codec_interface, "PROXY PASS-THROUGH");
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 0, "PROXY", NULL, 8000, 8000, 0,
- 20000, 160, 320, 320, 1, 1, 12,
+ 20000, 160, 320, 320, 1, 1,
switch_proxy_init, switch_proxy_encode, switch_proxy_decode, switch_proxy_destroy);
SWITCH_ADD_CODEC(codec_interface, "RAW Signed Linear (16 bit)");
@@ -316,7 +316,7 @@
for (countb = 12; countb > 0; countb--) {
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, ianacode[counta], "L16", NULL, rate, rate, bps,
- mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, spf * countb, spf * countb,
+ mpf * countb, spf * countb, bpf * countb, ebpf * countb, 1, spf * countb,
switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
}
rate = rate * 2;
@@ -329,11 +329,11 @@
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 118, "L16", NULL, 22050, 22050, 352800,
- 20000, 441, 882, 882, 1, 1, 1, switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
+ 20000, 441, 882, 882, 1, 1, switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
switch_core_codec_add_implementation(pool, codec_interface,
SWITCH_CODEC_TYPE_AUDIO, 118, "L16", NULL, 11025, 11025, 176400,
- 40000, 441, 882, 882, 1, 1, 1, switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
+ 40000, 441, 882, 882, 1, 1, switch_raw_init, switch_raw_encode, switch_raw_decode, switch_raw_destroy);
Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c (original)
+++ freeswitch/trunk/src/switch_rtp.c Mon Oct 20 13:48:42 2008
@@ -2018,14 +2018,14 @@
codec->implementation->iananame,
NULL,
codec->implementation->samples_per_second,
- codec->implementation->microseconds_per_frame / 1000,
+ codec->implementation->microseconds_per_packet / 1000,
codec->implementation->number_of_channels,
SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, rtp_session->pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
return SWITCH_STATUS_FALSE;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Activate VAD codec %s %dms\n", codec->implementation->iananame,
- codec->implementation->microseconds_per_frame / 1000);
+ codec->implementation->microseconds_per_packet / 1000);
rtp_session->vad_data.diff_level = 400;
rtp_session->vad_data.hangunder = 15;
rtp_session->vad_data.hangover = 40;
More information about the Freeswitch-svn
mailing list