Merge pull request #756 in FS/freeswitch from bugfix/FS-8953-whitespace-cleanup-src-switch_-.c to master

* commit 'e18c12b6092114df9f6e149e49fc563858367c21':
  FS-8953 [core] white space clean up.
v1.6
Mike Jerris 7 years ago
commit a107910907
  1. 20
      src/switch_apr.c
  2. 34
      src/switch_channel.c
  3. 4
      src/switch_core.c
  4. 3
      src/switch_core_cert.c
  5. 6
      src/switch_core_io.c
  6. 22
      src/switch_core_media.c
  7. 2
      src/switch_core_media_bug.c
  8. 6
      src/switch_core_session.c
  9. 12
      src/switch_core_sqldb.c
  10. 140
      src/switch_core_state_machine.c
  11. 62
      src/switch_core_video.c
  12. 138
      src/switch_hashtable.c
  13. 18
      src/switch_ivr.c
  14. 30
      src/switch_ivr_async.c
  15. 4
      src/switch_ivr_bridge.c
  16. 26
      src/switch_json.c
  17. 440
      src/switch_pcm.c
  18. 4
      src/switch_pgsql.c
  19. 26
      src/switch_profile.c
  20. 36
      src/switch_rtp.c
  21. 14
      src/switch_sdp.c
  22. 10
      src/switch_stun.c
  23. 588
      src/switch_utf8.c
  24. 2
      src/switch_utils.c
  25. 18
      src/switch_vpx.c

@ -631,9 +631,9 @@ struct apr_threadattr_t {
/* this needs to be revisited when apr for windows supports thread priority settings */
/* search for WIN32 in this file */
struct apr_threadattr_t {
apr_pool_t *pool;
apr_int32_t detach;
apr_size_t stacksize;
apr_pool_t *pool;
apr_int32_t detach;
apr_size_t stacksize;
int priority;
};
#endif
@ -802,13 +802,13 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_create(switch_sockaddr_t **sa, s
new_sa->pool = pool;
memset(new_sa, 0, sizeof(*new_sa));
new_sa->family = family;
new_sa->sa.sin.sin_family = family;
new_sa->family = family;
new_sa->sa.sin.sin_family = family;
new_sa->salen = sizeof(struct sockaddr_in);
new_sa->addr_str_len = 16;
new_sa->ipaddr_ptr = &(new_sa->sa.sin.sin_addr);
new_sa->ipaddr_len = sizeof(struct in_addr);
new_sa->salen = sizeof(struct sockaddr_in);
new_sa->addr_str_len = 16;
new_sa->ipaddr_ptr = &(new_sa->sa.sin.sin_addr);
new_sa->ipaddr_len = sizeof(struct in_addr);
*sa = new_sa;
return SWITCH_STATUS_SUCCESS;
@ -1310,7 +1310,7 @@ SWITCH_DECLARE(int) switch_atomic_dec(volatile switch_atomic_t *mem)
SWITCH_DECLARE(char *) switch_strerror(switch_status_t statcode, char *buf, switch_size_t bufsize)
{
return apr_strerror(statcode, buf, bufsize);
return apr_strerror(statcode, buf, bufsize);
}
/* For Emacs:

@ -239,16 +239,16 @@ struct switch_callstate_table {
switch_channel_callstate_t callstate;
};
static struct switch_callstate_table CALLSTATE_CHART[] = {
{"DOWN", CCS_DOWN},
{"DIALING", CCS_DIALING},
{"RINGING", CCS_RINGING},
{"EARLY", CCS_EARLY},
{"ACTIVE", CCS_ACTIVE},
{"HELD", CCS_HELD},
{"RING_WAIT", CCS_RING_WAIT},
{"HANGUP", CCS_HANGUP},
{"DOWN", CCS_DOWN},
{"DIALING", CCS_DIALING},
{"RINGING", CCS_RINGING},
{"EARLY", CCS_EARLY},
{"ACTIVE", CCS_ACTIVE},
{"HELD", CCS_HELD},
{"RING_WAIT", CCS_RING_WAIT},
{"HANGUP", CCS_HANGUP},
{"UNHELD", CCS_UNHELD},
{NULL, 0}
{NULL, 0}
};
struct switch_device_state_table {
@ -256,14 +256,14 @@ struct switch_device_state_table {
switch_device_state_t device_state;
};
static struct switch_device_state_table DEVICE_STATE_CHART[] = {
{"DOWN", SDS_DOWN},
{"RINGING", SDS_RINGING},
{"ACTIVE", SDS_ACTIVE},
{"ACTIVE_MULTI", SDS_ACTIVE_MULTI},
{"HELD", SDS_HELD},
{"UNHELD", SDS_UNHELD},
{"HANGUP", SDS_HANGUP},
{NULL, 0}
{"DOWN", SDS_DOWN},
{"RINGING", SDS_RINGING},
{"ACTIVE", SDS_ACTIVE},
{"ACTIVE_MULTI", SDS_ACTIVE_MULTI},
{"HELD", SDS_HELD},
{"UNHELD", SDS_UNHELD},
{"HANGUP", SDS_HANGUP},
{NULL, 0}
};

@ -348,7 +348,7 @@ SWITCH_DECLARE(const char *) switch_core_get_hostname(void)
SWITCH_DECLARE(const char *) switch_core_get_switchname(void)
{
if (!zstr(runtime.switchname)) return runtime.switchname;
if (!zstr(runtime.switchname)) return runtime.switchname;
return runtime.hostname;
}
@ -2312,7 +2312,7 @@ static void switch_load_core_config(const char *file)
#endif
} else if (!strcasecmp(var, "switchname") && !zstr(val)) {
runtime.switchname = switch_core_strdup(runtime.memory_pool, val);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Set switchname to %s\n", runtime.switchname);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Set switchname to %s\n", runtime.switchname);
} else if (!strcasecmp(var, "rtp-retain-crypto-keys")) {
if (switch_true(val)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING,

@ -110,8 +110,7 @@ static const EVP_MD *get_evp_by_name(const char *name)
* Solaris 10 with the Sun Studio compilers doesn't have strsep in the
* C library either.
*/
char
*strsep(char **stringp, const char *delim)
char *strsep(char **stringp, const char *delim)
{
char *res;

@ -116,7 +116,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "%s has no read codec.\n", switch_channel_get_name(session->channel));
switch_channel_hangup(session->channel, SWITCH_CAUSE_INCOMPATIBLE_DESTINATION);
*frame = &runtime.dummy_cng_frame;
return SWITCH_STATUS_FALSE;
return SWITCH_STATUS_FALSE;
}
switch_mutex_lock(session->read_codec->mutex);
@ -928,8 +928,8 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
even_more_done:
if (!*frame ||
(!switch_test_flag(*frame, SFF_PROXY_PACKET) &&
(!(*frame)->codec || !(*frame)->codec->implementation || !switch_core_codec_ready((*frame)->codec)))) {
(!switch_test_flag(*frame, SFF_PROXY_PACKET) &&
(!(*frame)->codec || !(*frame)->codec->implementation || !switch_core_codec_ready((*frame)->codec)))) {
*frame = &runtime.dummy_cng_frame;
}

@ -186,8 +186,8 @@ struct switch_media_handle_s {
switch_mutex_t *read_mutex[2];
switch_mutex_t *write_mutex[2];
char *codec_order[SWITCH_MAX_CODECS];
int codec_order_last;
const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
int codec_order_last;
const switch_codec_implementation_t *codecs[SWITCH_MAX_CODECS];
int payload_space;
char *origin;
@ -3829,16 +3829,16 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
char tmp[32] = "";
if (!switch_channel_test_flag(other_channel, CF_ANSWERED)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_WARNING, "%s Error Passing T.38 to unanswered channel %s\n",
switch_channel_get_name(session->channel), switch_channel_get_name(other_channel));
switch_core_session_rwunlock(other_session);
if (!switch_channel_test_flag(other_channel, CF_ANSWERED)) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_WARNING, "%s Error Passing T.38 to unanswered channel %s\n",
switch_channel_get_name(session->channel), switch_channel_get_name(other_channel));
switch_core_session_rwunlock(other_session);
pass = 0;
match = 0;
goto done;
}
pass = 0;
match = 0;
goto done;
}
if (switch_true(switch_channel_get_variable(session->channel, "t38_broken_boolean")) &&

@ -1073,7 +1073,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_bug_enumerate(switch_core_sess
stream->write_function(stream, "<media-bugs>\n");
if (session->bugs) {
switch_thread_rwlock_rdlock(session->bug_rwlock);
switch_thread_rwlock_rdlock(session->bug_rwlock);
for (bp = session->bugs; bp; bp = bp->next) {
int thread_locked = (bp->thread_id && bp->thread_id == switch_thread_self());
stream->write_function(stream,

@ -315,7 +315,7 @@ SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_i
void *val;
switch_core_session_t *session;
switch_memory_pool_t *pool;
struct str_node *head = NULL, *np;
struct str_node *head = NULL, *np;
switch_core_new_memory_pool(&pool);
@ -327,8 +327,8 @@ SWITCH_DECLARE(void) switch_core_session_hupall_endpoint(const switch_endpoint_i
if (switch_core_session_read_lock(session) == SWITCH_STATUS_SUCCESS) {
if (session->endpoint_interface == endpoint_interface) {
np = switch_core_alloc(pool, sizeof(*np));
np->str = switch_core_strdup(pool, session->uuid_str);
np->next = head;
np->str = switch_core_strdup(pool, session->uuid_str);
np->next = head;
head = np;
}
switch_core_session_rwunlock(session);

@ -3524,12 +3524,12 @@ switch_status_t switch_core_sqldb_start(switch_memory_pool_t *pool, switch_bool_
//runtime.odbc_dsn = NULL;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Database Error [%s]\n", err);
//switch_cache_db_release_db_handle(&sql_manager.dbh);
if (switch_stristr("read-only", err)) {
switch_safe_free(err);
} else {
switch_safe_free(err);
goto top;
}
if (switch_stristr("read-only", err)) {
switch_safe_free(err);
} else {
switch_safe_free(err);
goto top;
}
}
}
break;

@ -60,76 +60,76 @@ static void switch_core_standard_on_hangup(switch_core_session_t *session)
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s Standard HANGUP, cause: %s\n",
switch_channel_get_name(session->channel), switch_channel_cause2str(switch_channel_get_cause(session->channel)));
if (switch_true(switch_channel_get_variable(session->channel, "log_audio_stats_on_hangup"))) {
switch_rtp_stats_t *audio_stats = NULL;
switch_core_media_set_stats(session);
audio_stats = switch_core_media_get_stats(session, SWITCH_MEDIA_TYPE_AUDIO, switch_core_session_get_pool(session));
if (audio_stats) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_DEBUG,
"%s Call statistics:\n"
"in_raw_bytes: %d\n"
"in_media_bytes: %d\n"
"in_packet_count: %d\n"
"in_media_packet_count: %d\n"
"in_skip_packet_count: %d\n"
"in_jitter_packet_count: %d\n"
"in_dtmf_packet_count: %d\n"
"in_cng_packet_count: %d\n"
"in_flush_packet_count: %d\n"
"in_largest_jb_size: %d\n\n"
"in_jitter_min_variance: %lf\n"
"in_jitter_max_variance: %lf\n"
"in_jitter_loss_rate: %lf\n"
"in_jitter_burst_rate: %lf\n"
"in_mean_interval: %lf\n\n"
"in_flaw_total: %d\n"
"in_quality_percentage: %lf\n"
"in_mos: %lf\n\n"
"out_raw_bytes: %d\n"
"out_media_bytes: %d\n"
"out_packet_count: %d\n"
"out_media_packet_count: %d\n"
"out_skip_packet_count: %d\n"
"out_dtmf_packet_count: %d\n"
"out_cng_packet_count: %d\n\n"
"rtcp_packet_count: %d\n"
"rtcp_octet_count: %d\n",
switch_channel_get_name(session->channel),
(int)audio_stats->inbound.raw_bytes,
(int)audio_stats->inbound.media_bytes,
(int)audio_stats->inbound.packet_count,
(int)audio_stats->inbound.media_packet_count,
(int)audio_stats->inbound.skip_packet_count,
(int)audio_stats->inbound.jb_packet_count,
(int)audio_stats->inbound.dtmf_packet_count,
(int)audio_stats->inbound.cng_packet_count,
(int)audio_stats->inbound.flush_packet_count,
(int)audio_stats->inbound.largest_jb_size,
audio_stats->inbound.min_variance,
audio_stats->inbound.max_variance,
audio_stats->inbound.lossrate,
audio_stats->inbound.burstrate,
audio_stats->inbound.mean_interval,
(int)audio_stats->inbound.flaws,
audio_stats->inbound.R,
audio_stats->inbound.mos,
(int)audio_stats->outbound.raw_bytes,
(int)audio_stats->outbound.media_bytes,
(int)audio_stats->outbound.packet_count,
(int)audio_stats->outbound.media_packet_count,
(int)audio_stats->outbound.skip_packet_count,
(int)audio_stats->outbound.dtmf_packet_count,
(int)audio_stats->outbound.cng_packet_count,
(int)audio_stats->rtcp.packet_count,
(int)audio_stats->rtcp.octet_count
);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Missing call statistics!\n",
switch_channel_get_name(session->channel));
}
}
if (switch_true(switch_channel_get_variable(session->channel, "log_audio_stats_on_hangup"))) {
switch_rtp_stats_t *audio_stats = NULL;
switch_core_media_set_stats(session);
audio_stats = switch_core_media_get_stats(session, SWITCH_MEDIA_TYPE_AUDIO, switch_core_session_get_pool(session));
if (audio_stats) {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session),
SWITCH_LOG_DEBUG,
"%s Call statistics:\n"
"in_raw_bytes: %d\n"
"in_media_bytes: %d\n"
"in_packet_count: %d\n"
"in_media_packet_count: %d\n"
"in_skip_packet_count: %d\n"
"in_jitter_packet_count: %d\n"
"in_dtmf_packet_count: %d\n"
"in_cng_packet_count: %d\n"
"in_flush_packet_count: %d\n"
"in_largest_jb_size: %d\n\n"
"in_jitter_min_variance: %lf\n"
"in_jitter_max_variance: %lf\n"
"in_jitter_loss_rate: %lf\n"
"in_jitter_burst_rate: %lf\n"
"in_mean_interval: %lf\n\n"
"in_flaw_total: %d\n"
"in_quality_percentage: %lf\n"
"in_mos: %lf\n\n"
"out_raw_bytes: %d\n"
"out_media_bytes: %d\n"
"out_packet_count: %d\n"
"out_media_packet_count: %d\n"
"out_skip_packet_count: %d\n"
"out_dtmf_packet_count: %d\n"
"out_cng_packet_count: %d\n\n"
"rtcp_packet_count: %d\n"
"rtcp_octet_count: %d\n",
switch_channel_get_name(session->channel),
(int)audio_stats->inbound.raw_bytes,
(int)audio_stats->inbound.media_bytes,
(int)audio_stats->inbound.packet_count,
(int)audio_stats->inbound.media_packet_count,
(int)audio_stats->inbound.skip_packet_count,
(int)audio_stats->inbound.jb_packet_count,
(int)audio_stats->inbound.dtmf_packet_count,
(int)audio_stats->inbound.cng_packet_count,
(int)audio_stats->inbound.flush_packet_count,
(int)audio_stats->inbound.largest_jb_size,
audio_stats->inbound.min_variance,
audio_stats->inbound.max_variance,
audio_stats->inbound.lossrate,
audio_stats->inbound.burstrate,
audio_stats->inbound.mean_interval,
(int)audio_stats->inbound.flaws,
audio_stats->inbound.R,
audio_stats->inbound.mos,
(int)audio_stats->outbound.raw_bytes,
(int)audio_stats->outbound.media_bytes,
(int)audio_stats->outbound.packet_count,
(int)audio_stats->outbound.media_packet_count,
(int)audio_stats->outbound.skip_packet_count,
(int)audio_stats->outbound.dtmf_packet_count,
(int)audio_stats->outbound.cng_packet_count,
(int)audio_stats->rtcp.packet_count,
(int)audio_stats->rtcp.octet_count
);
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "%s Missing call statistics!\n",
switch_channel_get_name(session->channel));
}
}
rec = switch_channel_test_flag(session->channel, CF_RECOVERING);
switch_channel_clear_flag(session->channel, CF_RECOVERING);

@ -129,10 +129,10 @@ struct fit_el {
static struct fit_el IMG_FIT_TABLE[] = {
{SWITCH_FIT_SIZE, "fit-size"},
{SWITCH_FIT_SCALE, "fit-scale"},
{SWITCH_FIT_SIZE_AND_SCALE, "fit-size-and-scale"},
{SWITCH_FIT_NONE, NULL}
{SWITCH_FIT_SIZE, "fit-size"},
{SWITCH_FIT_SCALE, "fit-scale"},
{SWITCH_FIT_SIZE_AND_SCALE, "fit-size-and-scale"},
{SWITCH_FIT_NONE, NULL}
};
@ -813,9 +813,9 @@ SWITCH_DECLARE(switch_status_t) switch_img_txt_handle_create(switch_img_txt_hand
new_handle->pool = pool;
new_handle->free_pool = free_pool;
if (zstr(font_family)) {
if (zstr(font_family)) {
font_family = switch_core_sprintf(new_handle->pool, "%s%s%s",SWITCH_GLOBAL_dirs.fonts_dir, SWITCH_PATH_SEPARATOR, "FreeMono.ttf");
}
}
if (!switch_is_file_path(font_family)) {
new_handle->font_family = switch_core_sprintf(new_handle->pool, "%s%s%s",SWITCH_GLOBAL_dirs.fonts_dir, SWITCH_PATH_SEPARATOR, font_family);
@ -910,7 +910,7 @@ static void draw_bitmap(switch_img_txt_handle_t *handle, switch_image_t *img, FT
case FT_PIXEL_MODE_LCD_V:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "unsupported pixel mode %d\n", bitmap->pixel_mode);
return;
}
}
for ( i = x, p = 0; i < x_max; i++, p++ ) {
for ( j = y, q = 0; j < y_max; j++, q++ ) {
@ -1081,11 +1081,11 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
char *txt = "Value Optimized Out!";
int argc = 0;
char *argv[6] = { 0 };
switch_rgb_color_t bgcolor = { 0 };
int pre_width = 0, width = 0, font_size = 0, height = 0;
switch_rgb_color_t bgcolor = { 0 };
int pre_width = 0, width = 0, font_size = 0, height = 0;
int len = 0;
char *duptxt = strdup(text);
switch_img_txt_handle_t *txthandle = NULL;
switch_img_txt_handle_t *txthandle = NULL;
switch_image_t *txtimg = NULL;
int x = 0, y = 0;
@ -1124,15 +1124,15 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
while (*txt == ' ') txt++;
while (end_of(txt) == ' ') end_of(txt) = '\0';
len = strlen(txt);
len = strlen(txt);
if (len < 5) len = 5;
if (len < 5) len = 5;
switch_img_txt_handle_create(&txthandle, font_face, fg, bg, font_size, 0, NULL);
switch_color_set_rgb(&bgcolor, bg);
pre_width = switch_img_txt_handle_render(txthandle,
pre_width = switch_img_txt_handle_render(txthandle,
NULL,
font_size / 2, font_size / 2,
txt, NULL, fg, bg, 0, 0);
@ -1162,10 +1162,10 @@ SWITCH_DECLARE(switch_image_t *) switch_img_write_text_img(int w, int h, switch_
x = (txtimg->d_w / 2) - (pre_width / 2);
}
switch_img_txt_handle_render(txthandle,
txtimg,
x, y,
txt, NULL, fg, bg, 0, 0);
switch_img_txt_handle_render(txthandle,
txtimg,
x, y,
txt, NULL, fg, bg, 0, 0);
switch_img_txt_handle_destroy(&txthandle);
switch_safe_free(duptxt);
@ -1974,9 +1974,9 @@ static inline uint32_t switch_img_fmt2fourcc(switch_img_fmt_t fmt)
case SWITCH_IMG_FMT_I44416: fourcc = FOURCC_ANY ; break;
case SWITCH_IMG_FMT_I44016: fourcc = FOURCC_ANY ; break;
default: fourcc = FOURCC_ANY;
}
}
return fourcc;
return fourcc;
}
#endif
@ -2032,14 +2032,14 @@ SWITCH_DECLARE(switch_status_t) switch_img_from_raw(switch_image_t *dest, void *
/*
int ConvertToI420(const uint8* src_frame, size_t src_size,
uint8* dst_y, int dst_stride_y,
uint8* dst_u, int dst_stride_u,
uint8* dst_v, int dst_stride_v,
int crop_x, int crop_y,
int src_width, int src_height,
int crop_width, int crop_height,
enum RotationMode rotation,
uint32 format);
uint8* dst_y, int dst_stride_y,
uint8* dst_u, int dst_stride_u,
uint8* dst_v, int dst_stride_v,
int crop_x, int crop_y,
int src_width, int src_height,
int crop_width, int crop_height,
enum RotationMode rotation,
uint32 format);
src_size is only used when FOURCC_MJPG which we don't support so always 0
*/
@ -2085,10 +2085,10 @@ SWITCH_DECLARE(switch_status_t) switch_img_scale(switch_image_t *src, switch_ima
kFilterBox);
} else if (src->fmt == SWITCH_IMG_FMT_ARGB) {
ret = ARGBScale(src->planes[SWITCH_PLANE_PACKED], src->d_w * 4,
src->d_w, src->d_h,
dest->planes[SWITCH_PLANE_PACKED], width * 4,
width, height,
kFilterBox);
src->d_w, src->d_h,
dest->planes[SWITCH_PLANE_PACKED], width * 4,
width, height,
kFilterBox);
}
if (ret != 0) {

@ -57,33 +57,33 @@ switch_create_hashtable(switch_hashtable_t **hp, unsigned int minsize,
unsigned int (*hashf) (void*),
int (*eqf) (void*,void*))
{
switch_hashtable_t *h;
unsigned int pindex, size = primes[0];
/* Check requested hashtable isn't too large */
if (minsize > (1u << 30)) {*hp = NULL; return SWITCH_STATUS_FALSE;}
/* Enforce size as prime */
for (pindex=0; pindex < prime_table_length; pindex++) {
if (primes[pindex] > minsize) {
switch_hashtable_t *h;
unsigned int pindex, size = primes[0];
/* Check requested hashtable isn't too large */
if (minsize > (1u << 30)) {*hp = NULL; return SWITCH_STATUS_FALSE;}
/* Enforce size as prime */
for (pindex=0; pindex < prime_table_length; pindex++) {
if (primes[pindex] > minsize) {
size = primes[pindex];
break;
}
}
h = (switch_hashtable_t *) malloc(sizeof(switch_hashtable_t));
}
h = (switch_hashtable_t *) malloc(sizeof(switch_hashtable_t));
if (NULL == h) abort(); /*oom*/
if (NULL == h) abort(); /*oom*/
h->table = (struct entry **)malloc(sizeof(struct entry*) * size);
h->table = (struct entry **)malloc(sizeof(struct entry*) * size);
if (NULL == h->table) abort(); /*oom*/
if (NULL == h->table) abort(); /*oom*/
memset(h->table, 0, size * sizeof(struct entry *));
h->tablelength = size;
h->primeindex = pindex;
h->entrycount = 0;
h->hashfn = hashf;
h->eqfn = eqf;
h->loadlimit = (unsigned int) ceil(size * max_load_factor);
memset(h->table, 0, size * sizeof(struct entry *));
h->tablelength = size;
h->primeindex = pindex;
h->entrycount = 0;
h->hashfn = hashf;
h->eqfn = eqf;
h->loadlimit = (unsigned int) ceil(size * max_load_factor);
*hp = h;
return SWITCH_STATUS_SUCCESS;
@ -93,17 +93,17 @@ switch_create_hashtable(switch_hashtable_t **hp, unsigned int minsize,
static int
hashtable_expand(switch_hashtable_t *h)
{
/* Double the size of the table to accomodate more entries */
struct entry **newtable;
struct entry *e;
struct entry **pE;
unsigned int newsize, i, index;
/* Check we're not hitting max capacity */
if (h->primeindex == (prime_table_length - 1)) return 0;
newsize = primes[++(h->primeindex)];
newtable = (struct entry **)malloc(sizeof(struct entry*) * newsize);
if (NULL != newtable)
/* Double the size of the table to accomodate more entries */
struct entry **newtable;
struct entry *e;
struct entry **pE;
unsigned int newsize, i, index;
/* Check we're not hitting max capacity */
if (h->primeindex == (prime_table_length - 1)) return 0;
newsize = primes[++(h->primeindex)];
newtable = (struct entry **)malloc(sizeof(struct entry*) * newsize);
if (NULL != newtable)
{
memset(newtable, 0, newsize * sizeof(struct entry *));
/* This algorithm is not 'stable'. ie. it reverses the list
@ -119,8 +119,8 @@ hashtable_expand(switch_hashtable_t *h)
switch_safe_free(h->table);
h->table = newtable;
}
/* Plan B: realloc instead */
else
/* Plan B: realloc instead */
else
{
newtable = (struct entry **)
realloc(h->table, newsize * sizeof(struct entry *));
@ -141,30 +141,30 @@ hashtable_expand(switch_hashtable_t *h)
}
}
}
h->tablelength = newsize;
h->loadlimit = (unsigned int) ceil(newsize * max_load_factor);
return -1;
h->tablelength = newsize;
h->loadlimit = (unsigned int) ceil(newsize * max_load_factor);
return -1;
}
/*****************************************************************************/
SWITCH_DECLARE(unsigned int)
switch_hashtable_count(switch_hashtable_t *h)
{
return h->entrycount;
return h->entrycount;
}
static void * _switch_hashtable_remove(switch_hashtable_t *h, void *k, unsigned int hashvalue, unsigned int index) {
/* TODO: consider compacting the table when the load factor drops enough,
* or provide a 'compact' method. */
/* TODO: consider compacting the table when the load factor drops enough,
* or provide a 'compact' method. */
struct entry *e;
struct entry **pE;
void *v;
struct entry *e;
struct entry **pE;
void *v;
pE = &(h->table[index]);
e = *pE;
while (NULL != e) {
pE = &(h->table[index]);
e = *pE;
while (NULL != e) {
/* Check hash value to short circuit heavier comparison */
if ((hashvalue == e->h) && (h->eqfn(k, e->k))) {
*pE = e->next;
@ -186,22 +186,22 @@ static void * _switch_hashtable_remove(switch_hashtable_t *h, void *k, unsigned
pE = &(e->next);
e = e->next;
}
return NULL;
return NULL;
}
/*****************************************************************************/
SWITCH_DECLARE(int)
switch_hashtable_insert_destructor(switch_hashtable_t *h, void *k, void *v, hashtable_flag_t flags, hashtable_destructor_t destructor)
{
struct entry *e;
struct entry *e;
unsigned int hashvalue = hash(h, k);
unsigned index = indexFor(h->tablelength, hashvalue);
unsigned index = indexFor(h->tablelength, hashvalue);
if (flags & HASHTABLE_DUP_CHECK) {
_switch_hashtable_remove(h, k, hashvalue, index);
}
if (++(h->entrycount) > h->loadlimit)
if (++(h->entrycount) > h->loadlimit)
{
/* Ignore the return value. If expand fails, we should
* still try cramming just this value into the existing table
@ -210,33 +210,33 @@ switch_hashtable_insert_destructor(switch_hashtable_t *h, void *k, void *v, hash
hashtable_expand(h);
index = indexFor(h->tablelength, hashvalue);
}
e = (struct entry *)malloc(sizeof(struct entry));
if (NULL == e) { --(h->entrycount); return 0; } /*oom*/
e->h = hashvalue;
e->k = k;
e->v = v;
e = (struct entry *)malloc(sizeof(struct entry));
if (NULL == e) { --(h->entrycount); return 0; } /*oom*/
e->h = hashvalue;
e->k = k;
e->v = v;
e->flags = flags;
e->destructor = destructor;
e->next = h->table[index];
h->table[index] = e;
return -1;
e->next = h->table[index];
h->table[index] = e;
return -1;
}
/*****************************************************************************/
SWITCH_DECLARE(void *) /* returns value associated with key */
switch_hashtable_search(switch_hashtable_t *h, void *k)
{
struct entry *e;
unsigned int hashvalue, index;
hashvalue = hash(h,k);
index = indexFor(h->tablelength,hashvalue);
e = h->table[index];
while (NULL != e) {
struct entry *e;
unsigned int hashvalue, index;
hashvalue = hash(h,k);
index = indexFor(h->tablelength,hashvalue);
e = h->table[index];
while (NULL != e) {
/* Check hash value to short circuit heavier comparison */
if ((hashvalue == e->h) && (h->eqfn(k, e->k))) return e->v;
e = e->next;
}
return NULL;
return NULL;
}
/*****************************************************************************/
@ -252,9 +252,9 @@ switch_hashtable_remove(switch_hashtable_t *h, void *k)
SWITCH_DECLARE(void)
switch_hashtable_destroy(switch_hashtable_t **h)
{
unsigned int i;
struct entry *e, *f;
struct entry **table = (*h)->table;
unsigned int i;
struct entry *e, *f;
struct entry **table = (*h)->table;
for (i = 0; i < (*h)->tablelength; i++) {
e = table[i];
@ -274,8 +274,8 @@ switch_hashtable_destroy(switch_hashtable_t **h)
switch_safe_free(f);
}
}
switch_safe_free((*h)->table);
switch_safe_free((*h)->table);
free(*h);
*h = NULL;
}

@ -1848,8 +1848,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_3p_nomedia(const char *uuid, switch_m
}
if (switch_core_session_in_thread(session)) {
switch_yield(100000);
} else {
switch_yield(100000);
} else {
switch_channel_wait_for_state(other_channel, channel, CS_HIBERNATE);
}
@ -1948,8 +1948,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_nomedia(const char *uuid, switch_medi
}
if (switch_core_session_in_thread(session)) {
switch_yield(100000);
} else {
switch_yield(100000);
} else {
switch_channel_wait_for_state(other_channel, channel, CS_HIBERNATE);
}
@ -3820,9 +3820,9 @@ SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_force_exists(const char *uuid)
SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *session, const char *cmd, switch_file_handle_t *fhp)
{
if (zstr(cmd)) {
if (zstr(cmd)) {
return SWITCH_STATUS_SUCCESS;
}
}
if (fhp) {
if (!switch_test_flag(fhp, SWITCH_FILE_OPEN)) {
@ -3926,11 +3926,11 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_process_fh(switch_core_session_t *ses
}
}
if (!strcmp(cmd, "true") || !strcmp(cmd, "undefined")) {
if (!strcmp(cmd, "true") || !strcmp(cmd, "undefined")) {
return SWITCH_STATUS_SUCCESS;
}
}
return SWITCH_STATUS_FALSE;
return SWITCH_STATUS_FALSE;
}

@ -5096,16 +5096,16 @@ static switch_bool_t video_write_overlay_callback(switch_media_bug_t *bug, void
switch_core_session_t *session = switch_core_media_bug_get_session(bug);
switch_channel_t *channel = switch_core_session_get_channel(session);
switch (type) {
case SWITCH_ABC_TYPE_INIT:
{
}
break;
case SWITCH_ABC_TYPE_CLOSE:
{
switch (type) {
case SWITCH_ABC_TYPE_INIT:
{
}
break;
case SWITCH_ABC_TYPE_CLOSE:
{
switch_img_free(&oht->img);
}
break;
}
break;
case SWITCH_ABC_TYPE_WRITE_VIDEO_PING:
if (switch_channel_test_flag(channel, CF_VIDEO_DECODED_READ)) {
switch_frame_t *frame = switch_core_media_bug_get_video_ping_frame(bug);
@ -5121,12 +5121,12 @@ static switch_bool_t video_write_overlay_callback(switch_media_bug_t *bug, void
switch_img_free(&oimg);
}
}
break;
default:
break;
}
break;
default:
break;
}
return SWITCH_TRUE;
return SWITCH_TRUE;
}
@ -5150,7 +5150,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_video_write_overlay_session(switch_co
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_status_t status;
switch_media_bug_flag_t bflags = SMBF_WRITE_VIDEO_PING;
switch_media_bug_t *bug;
switch_media_bug_t *bug;
overly_helper_t *oht;
switch_image_t *img;

@ -1026,7 +1026,7 @@ static switch_status_t uuid_bridge_on_soft_execute(switch_core_session_t *sessio
if (switch_ivr_wait_for_answer(session, other_session) != SWITCH_STATUS_SUCCESS) {
if (switch_true(switch_channel_get_variable(channel, "uuid_bridge_continue_on_cancel"))) {
switch_channel_set_state(channel, CS_EXECUTE);
} else if (switch_true(switch_channel_get_variable(channel, "uuid_bridge_park_on_cancel"))) {
} else if (switch_true(switch_channel_get_variable(channel, "uuid_bridge_park_on_cancel"))) {
switch_ivr_park_session(session);
} else if (!switch_channel_test_flag(channel, CF_TRANSFER)) {
switch_channel_hangup(channel, SWITCH_CAUSE_ORIGINATOR_CANCEL);
@ -1700,7 +1700,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
switch_call_cause_t cause = switch_channel_get_cause(peer_channel);
const char *hup = switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE);
int explicit = 0;
int answered = 0;
int answered = 0;
int early = 0;
if (cause == SWITCH_CAUSE_NONE) {

@ -59,23 +59,23 @@ static void (*cJSON_free)(void *ptr) = glue_free;
static char* cJSON_strdup(const char* str)
{
size_t len;
char* copy;
const char *s = str ? str : "";
len = strlen(s) + 1;
if (!(copy = (char*)cJSON_malloc(len))) return 0;
memcpy(copy,s,len);
return copy;
size_t len;
char* copy;
const char *s = str ? str : "";
len = strlen(s) + 1;
if (!(copy = (char*)cJSON_malloc(len))) return 0;
memcpy(copy,s,len);
return copy;
}
SWITCH_DECLARE(void)cJSON_InitHooks(cJSON_Hooks* hooks)
{
if (!hooks) { /* Reset hooks */
cJSON_malloc = malloc;
cJSON_free = free;
return;
}
if (!hooks) { /* Reset hooks */
cJSON_malloc = malloc;
cJSON_free = free;
return;
}
cJSON_malloc = (hooks->malloc_fn)?hooks->malloc_fn:malloc;
cJSON_free = (hooks->free_fn)?hooks->free_fn:free;

@ -470,23 +470,23 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
12000, /* samples transferred per second */
12000, /* actual samples transferred per second */
192000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
12000, /* samples transferred per second */
12000, /* actual samples transferred per second */
192000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
samples_per_frame += 240;
bytes_per_frame += 480;
@ -517,23 +517,23 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
24000, /* samples transferred per second */
24000, /* actual samples transferred per second */
384000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
24000, /* samples transferred per second */
24000, /* actual samples transferred per second */
384000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
samples_per_frame += 480;
bytes_per_frame += 960;
@ -614,23 +614,23 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
8000, /* samples transferred per second */
8000, /* actual samples transferred per second */
128000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
8000, /* samples transferred per second */
8000, /* actual samples transferred per second */
128000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
samples_per_frame += 16;
bytes_per_frame += 32;
@ -661,23 +661,23 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
16000, /* samples transferred per second */
16000, /* actual samples transferred per second */
256000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
16000, /* samples transferred per second */
16000, /* actual samples transferred per second */
256000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
samples_per_frame += 32;
bytes_per_frame += 64;
@ -709,23 +709,23 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
32000, /* samples transferred per second */
32000, /* actual samples transferred per second */
512000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
32000, /* samples transferred per second */
32000, /* actual samples transferred per second */
512000 * 2, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */
2, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
samples_per_frame += 64;
bytes_per_frame += 128;
@ -785,157 +785,157 @@ SWITCH_MODULE_LOAD_FUNCTION(core_pcm_load)
for (x = 0; x < 3; x++) {
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
44100, /* samples transferred per second */
44100, /* actual samples transferred per second */
705600, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame, /* number of bytes per frame decompressed */
bytes_per_frame, /* number of bytes per frame compressed */
1, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
44100, /* samples transferred per second */
44100, /* actual samples transferred per second */
705600, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame, /* number of bytes per frame decompressed */
bytes_per_frame, /* number of bytes per frame compressed */
1, /* number of channels represented */
1, /* number of frames per network packet */
switch_raw_init, /* function to initialize a codec handle using this implementation */
switch_raw_encode, /* function to encode raw data into encoded data */
switch_raw_decode, /* function to decode encoded data into raw data */
switch_raw_destroy); /* deinitalize a codec handle using this implementation */
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
100, /* the IANA code number */
"L16", /* the IANA code name */
NULL, /* default fmtp to send (can be overridden by the init function) */
44100, /* samples transferred per second */
44100, /* actual samples transferred per second */
705600, /* bits transferred per second */
ms_per_frame, /* number of microseconds per frame */
samples_per_frame, /* number of samples per frame */
bytes_per_frame * 2, /* number of bytes per frame decompressed */
bytes_per_frame * 2, /* number of bytes per frame compressed */