clean some old members and naming conventions in the codec structs

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@10084 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2008-10-20 17:48:42 +00:00
1 parent f1da124229
commit 30c318b995
39 files changed
+240 -245

No files matched your search

+7 -7
View File
@@ -272,7 +272,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
}
}
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 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
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 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
}
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 @@ static switch_status_t engage_device(unsigned int sample_rate, int codec_ms)
}
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 @@ static switch_status_t engage_device(unsigned int sample_rate, int codec_ms)
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;
}
@@ -879,8 +879,8 @@ static int activate_rtp(struct private_object *tech_pvt)
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 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
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 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
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",
+9 -9
View File
@@ -256,7 +256,7 @@ static switch_status_t iax_set_codec(private_t *tech_pvt, struct iax_session *ia
}
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 @@ static switch_status_t iax_set_codec(private_t *tech_pvt, struct iax_session *ia
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 @@ static switch_status_t iax_set_codec(private_t *tech_pvt, struct iax_session *ia
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 @@ static switch_status_t iax_set_codec(private_t *tech_pvt, struct iax_session *ia
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 @@ static switch_status_t iax_set_codec(private_t *tech_pvt, struct iax_session *ia
} 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 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
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 @@ SWITCH_MODULE_RUNTIME_FUNCTION(mod_iax_runtime)
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);
@@ -107,7 +107,7 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
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 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
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 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
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));
@@ -492,7 +492,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
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 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
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 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_portaudio_load)
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 @@ static switch_status_t engage_device(int sample_rate, int codec_ms)
}
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 @@ static switch_status_t engage_device(int sample_rate, int codec_ms)
}
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 @@ static switch_status_t engage_device(int sample_rate, int codec_ms)
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 @@ static switch_status_t engage_ring_device(int sample_rate, int channels)
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);
+3 -3
View File
@@ -218,7 +218,7 @@ static unsigned long RoundUpToNextPowerOf2(unsigned long n)
*/
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 @@ PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
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 @@ PaError OpenAudioStream(PABLIO_Stream ** rwblPtr,
/* 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;
+1 -1
View File
@@ -104,7 +104,7 @@ extern "C" {
*/
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);
+5 -5
View File
@@ -664,10 +664,10 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
*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 @@ static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_
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;
+18 -18
View File
@@ -118,7 +118,7 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
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 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
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 @@ void sofia_glue_set_local_sdp(private_object_t *tech_pvt, const char *ip, uint32
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 @@ switch_status_t sofia_glue_tech_set_video_codec(private_object_t *tech_pvt, int
} 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 @@ switch_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
}
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_status_t sofia_glue_tech_set_codec(private_object_t *tech_pvt, int force)
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 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
}
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 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
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 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
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 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
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 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
}
}
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 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
} 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 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
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 @@ switch_status_t sofia_glue_activate_rtp(private_object_t *tech_pvt, switch_rtp_f
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 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
}
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 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
}
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 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
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 @@ uint8_t sofia_glue_negotiate_sdp(switch_core_session_t *session, sdp_session_t *
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;