codec tweak

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@1957 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale committed 2006-07-18 18:34:42 +00:00
1 parent 629ee71e8f
commit aee6cc27e1
5 files changed
+51 -30

No files matched your search

+21 -13
View File
@@ -291,15 +291,15 @@ static int activate_rtp(struct private_object *tech_pvt)
}
if (!(tech_pvt->rtp_session = switch_rtp_new(tech_pvt->profile->ip,
tech_pvt->local_port,
tech_pvt->remote_ip,
tech_pvt->remote_port,
tech_pvt->codec_num,
tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
tech_pvt->read_codec.implementation->microseconds_per_frame,
flags,
NULL,
&err, switch_core_session_get_pool(tech_pvt->session)))) {
tech_pvt->local_port,
tech_pvt->remote_ip,
tech_pvt->remote_port,
tech_pvt->codec_num,
0,
tech_pvt->read_codec.implementation->microseconds_per_frame,
flags,
NULL,
&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);
return -1;
@@ -784,8 +784,12 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
}
if (tech_pvt->read_frame.datalen > 0) {
bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
frames = (tech_pvt->read_frame.datalen / bytes);
if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
frames = (tech_pvt->read_frame.datalen / bytes);
} else {
frames = 1;
}
samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
ms = frames * tech_pvt->read_codec.implementation->microseconds_per_frame;
tech_pvt->timestamp_recv += (int32_t) samples;
@@ -841,9 +845,13 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
frames = ((int) frame->datalen / bytes);
} else {
frames = 1;
}
bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
frames = ((int) frame->datalen / bytes);
samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
//printf("%s send %d bytes %d samples in %d frames ts=%d\n", switch_channel_get_name(channel), frame->datalen, samples, frames, tech_pvt->timestamp_send);
+13 -5
View File
@@ -562,7 +562,7 @@ static switch_status_t activate_rtp(struct private_object *tech_pvt)
tech_pvt->remote_sdp_audio_ip,
tech_pvt->remote_sdp_audio_port,
tech_pvt->read_codec.implementation->ianacode,
tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
0, //tech_pvt->read_codec.implementation->encoded_bytes_per_frame,
ms,
flags,
key,
@@ -718,8 +718,12 @@ static switch_status_t exosip_read_frame(switch_core_session_t *session, switch_
if (tech_pvt->read_frame.datalen > 0) {
tech_pvt->last_read = switch_time_now();
bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
frames = (tech_pvt->read_frame.datalen / bytes);
if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
frames = (tech_pvt->read_frame.datalen / bytes);
} else {
frames = 1;
}
samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
ms = frames * tech_pvt->read_codec.implementation->microseconds_per_frame;
tech_pvt->timestamp_recv += (int32_t) samples;
@@ -776,8 +780,12 @@ static switch_status_t exosip_write_frame(switch_core_session_t *session, switch
switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
if (switch_test_flag(tech_pvt, TFLAG_USING_CODEC)) {
bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
frames = ((int) frame->datalen / bytes);
if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
frames = ((int) frame->datalen / bytes);
} else {
frames = 1;
}
samples = frames * tech_pvt->read_codec.implementation->samples_per_frame;
} else {
assert(0);
+6 -2
View File
@@ -1099,8 +1099,12 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_runtime(void)
break;
}
bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
frames = (int) (tech_pvt->read_frame.datalen / bytes);
if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame) {
bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame;
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;