switch_bytes_per_frame -> switch_samples_per_frame rename
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7639 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
563046d0ca
commit
d6c105efe0
|
@ -41,7 +41,7 @@
|
||||||
#include <switch.h>
|
#include <switch.h>
|
||||||
|
|
||||||
SWITCH_BEGIN_EXTERN_C
|
SWITCH_BEGIN_EXTERN_C
|
||||||
#define switch_bytes_per_frame(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval)))
|
#define switch_samples_per_frame(rate, interval) ((uint32_t)((float)rate / (1000.0f / (float)interval)))
|
||||||
#define SWITCH_SMAX 32767
|
#define SWITCH_SMAX 32767
|
||||||
#define SWITCH_SMIN -32768
|
#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_normalize_to_16bit(n) if (n > SWITCH_SMAX) n = SWITCH_SMAX / 2; else if (n < SWITCH_SMIN) n = SWITCH_SMIN / 2;
|
||||||
|
|
|
@ -817,7 +817,7 @@ static void *SWITCH_THREAD_FUNC conference_thread_run(switch_thread_t * thread,
|
||||||
{
|
{
|
||||||
conference_obj_t *conference = (conference_obj_t *) obj;
|
conference_obj_t *conference = (conference_obj_t *) obj;
|
||||||
conference_member_t *imember, *omember;
|
conference_member_t *imember, *omember;
|
||||||
uint32_t samples = switch_bytes_per_frame(conference->rate, conference->interval);
|
uint32_t samples = switch_samples_per_frame(conference->rate, conference->interval);
|
||||||
uint32_t bytes = samples * 2;
|
uint32_t bytes = samples * 2;
|
||||||
uint8_t ready = 0, total = 0;
|
uint8_t ready = 0, total = 0;
|
||||||
switch_timer_t timer = { 0 };
|
switch_timer_t timer = { 0 };
|
||||||
|
@ -1647,7 +1647,7 @@ static void conference_loop_output(conference_member_t * member)
|
||||||
switch_timer_t timer = { 0 };
|
switch_timer_t timer = { 0 };
|
||||||
switch_codec_t *read_codec = switch_core_session_get_read_codec(member->session);
|
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 interval = read_codec->implementation->microseconds_per_frame / 1000;
|
||||||
uint32_t samples = switch_bytes_per_frame(member->conference->rate, interval);
|
uint32_t samples = switch_samples_per_frame(member->conference->rate, interval);
|
||||||
uint32_t csamples = samples;
|
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_frame;
|
||||||
uint32_t flush_len = 0;
|
uint32_t flush_len = 0;
|
||||||
|
@ -1656,7 +1656,7 @@ static void conference_loop_output(conference_member_t * member)
|
||||||
|
|
||||||
switch_assert(member->conference != NULL);
|
switch_assert(member->conference != NULL);
|
||||||
|
|
||||||
flush_len = switch_bytes_per_frame(member->conference->rate, member->conference->interval) * 10;
|
flush_len = switch_samples_per_frame(member->conference->rate, member->conference->interval) * 10;
|
||||||
|
|
||||||
if (switch_core_timer_init(&timer, member->conference->timer_name, interval, tsamples, NULL) != SWITCH_STATUS_SUCCESS) {
|
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");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Timer Setup Failed. Conference Cannot Start\n");
|
||||||
|
@ -1952,7 +1952,7 @@ static void *SWITCH_THREAD_FUNC conference_record_thread_run(switch_thread_t * t
|
||||||
conference_member_t smember = { 0 }, *member;
|
conference_member_t smember = { 0 }, *member;
|
||||||
conference_record_t *rec = (conference_record_t *) obj;
|
conference_record_t *rec = (conference_record_t *) obj;
|
||||||
conference_obj_t *conference = rec->conference;
|
conference_obj_t *conference = rec->conference;
|
||||||
uint32_t samples = switch_bytes_per_frame(conference->rate, conference->interval);
|
uint32_t samples = switch_samples_per_frame(conference->rate, conference->interval);
|
||||||
uint32_t low_count = 0, mux_used;
|
uint32_t low_count = 0, mux_used;
|
||||||
char *vval;
|
char *vval;
|
||||||
switch_timer_t timer = { 0 };
|
switch_timer_t timer = { 0 };
|
||||||
|
|
|
@ -733,7 +733,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_load)
|
||||||
globals.read_frame.buflen = sizeof(globals.databuf);
|
globals.read_frame.buflen = sizeof(globals.databuf);
|
||||||
globals.cng_frame.data = globals.cngbuf;
|
globals.cng_frame.data = globals.cngbuf;
|
||||||
globals.cng_frame.buflen = sizeof(globals.cngbuf);
|
globals.cng_frame.buflen = sizeof(globals.cngbuf);
|
||||||
globals.cng_frame.datalen = switch_bytes_per_frame(globals.sample_rate, globals.codec_ms) * 2;
|
globals.cng_frame.datalen = switch_samples_per_frame(globals.sample_rate, globals.codec_ms) * 2;
|
||||||
switch_set_flag((&globals.cng_frame), SFF_CNG);
|
switch_set_flag((&globals.cng_frame), SFF_CNG);
|
||||||
|
|
||||||
/* connect my internal structure to the blank pointer passed to me */
|
/* connect my internal structure to the blank pointer passed to me */
|
||||||
|
|
|
@ -176,7 +176,7 @@ static void *SWITCH_THREAD_FUNC read_stream_thread(switch_thread_t *thread, void
|
||||||
}
|
}
|
||||||
|
|
||||||
source->rate = fh.samplerate;
|
source->rate = fh.samplerate;
|
||||||
source->samples = switch_bytes_per_frame(fh.native_rate, source->interval);
|
source->samples = switch_samples_per_frame(fh.native_rate, source->interval);
|
||||||
|
|
||||||
if (switch_core_timer_init(&timer, source->timer_name, source->interval, source->samples, source->pool) != SWITCH_STATUS_SUCCESS) {
|
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");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Can't start timer.\n");
|
||||||
|
@ -425,7 +425,7 @@ static void launch_threads(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
source->samples = switch_bytes_per_frame(source->rate, source->interval);
|
source->samples = switch_samples_per_frame(source->rate, source->interval);
|
||||||
|
|
||||||
switch_core_hash_insert(globals.source_hash, source->name, source);
|
switch_core_hash_insert(globals.source_hash, source->name, source);
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_speech_open(switch_speech_handle_t *
|
||||||
|
|
||||||
sh->rate = rate;
|
sh->rate = rate;
|
||||||
sh->name = switch_core_strdup(pool, module_name);
|
sh->name = switch_core_strdup(pool, module_name);
|
||||||
sh->samples = switch_bytes_per_frame(rate, interval);
|
sh->samples = switch_samples_per_frame(rate, interval);
|
||||||
|
|
||||||
return sh->speech_interface->speech_open(sh, voice_name, rate, flags);
|
return sh->speech_interface->speech_open(sh, voice_name, rate, flags);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1518,7 +1518,7 @@ SWITCH_DECLARE(void) switch_ivr_delay_echo(switch_core_session_t *session, uint3
|
||||||
|
|
||||||
read_codec = switch_core_session_get_read_codec(session);
|
read_codec = switch_core_session_get_read_codec(session);
|
||||||
interval = read_codec->implementation->microseconds_per_frame / 1000;
|
interval = read_codec->implementation->microseconds_per_frame / 1000;
|
||||||
samples = switch_bytes_per_frame(read_codec->implementation->samples_per_second, interval);
|
samples = switch_samples_per_frame(read_codec->implementation->samples_per_second, interval);
|
||||||
|
|
||||||
qlen = delay_ms / (interval);
|
qlen = delay_ms / (interval);
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen);
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Setting delay to %dms (%d frames)\n", delay_ms, qlen);
|
||||||
|
|
Loading…
Reference in New Issue