stereo refactoring

This commit is contained in:
Anthony Minessale committed 2014-06-13 01:49:16 -04:00
1 parent 56ef59e9ad
commit 4ffbf23ffa
10 files changed
+109 -44

No files matched your search

+5 -2
View File
@@ -266,6 +266,8 @@ static switch_status_t switch_opus_init(switch_codec_t *codec, switch_codec_flag
switch_opus_fmtp_parse(codec->fmtp_in, &codec_fmtp);
codec->fmtp_out = gen_fmtp(&opus_codec_settings, codec->memory_pool);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "OPUS init %d %d\n", codec->implementation->actual_samples_per_second, codec->implementation->number_of_channels);
if (encoding) {
/* come up with a way to specify these */
int bitrate_bps = OPUS_AUTO;
@@ -472,6 +474,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)
settings.maxptime = settings.ptime;
settings.minptime = settings.ptime;
settings.samplerate = rate;
settings.stereo = 0;
dft_fmtp = gen_fmtp(&settings, pool);
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
@@ -493,8 +496,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)
switch_opus_destroy); /* deinitalize a codec handle using this implementation */
settings.stereo = 1;
if (x < 2) {
dft_fmtp = gen_fmtp(&settings, pool);
switch_core_codec_add_implementation(pool, codec_interface, SWITCH_CODEC_TYPE_AUDIO, /* enumeration defining the type of the codec */
116, /* the IANA code number */
"opus",/* the IANA code name */
@@ -512,7 +515,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_opus_load)
switch_opus_encode, /* function to encode raw data into encoded data */
switch_opus_decode, /* function to decode encoded data into raw data */
switch_opus_destroy); /* deinitalize a codec handle using this implementation */
}
bytes *= 2;
samples *= 2;
mss *= 2;
@@ -140,8 +140,8 @@ static switch_status_t tech_init(loopback_private_t *tech_pvt, switch_core_sessi
if ((var = switch_channel_get_variable(channel, "loopback_initial_codec"))) {
char *dup = switch_core_session_strdup(session, var);
uint32_t bit;
iananame = switch_parse_codec_buf(dup, &interval, &rate, &bit);
uint32_t bit, channels;
iananame = switch_parse_codec_buf(dup, &interval, &rate, &bit, &channels);
}
}
+3 -1
View File
@@ -1441,10 +1441,12 @@ static switch_status_t verto_connect(switch_core_session_t *session, const char
verto_set_media_options(tech_pvt, jsock->profile);
switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
switch_channel_set_variable(tech_pvt->channel, "verto_profile_name", jsock->profile->name);
if (!switch_channel_test_flag(tech_pvt->channel, CF_RECOVERING)) {
switch_core_media_prepare_codecs(tech_pvt->session, SWITCH_TRUE);
if ((status = switch_core_media_choose_ports(tech_pvt->session, SWITCH_TRUE, SWITCH_TRUE)) != SWITCH_STATUS_SUCCESS) {
//if ((status = switch_core_media_choose_port(tech_pvt->session, SWITCH_MEDIA_TYPE_AUDIO, 0)) != SWITCH_STATUS_SUCCESS) {
switch_channel_hangup(tech_pvt->channel, SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER);