adding a check for frame sizes so VBR codecs work correctly.. Should this be moved to the core instead?

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2538 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Brian West
2006-09-06 23:58:14 +00:00
parent 4f0aae4dba
commit f34ed15ac2
2 changed files with 18 additions and 10 deletions
+13 -4
View File
@@ -833,8 +833,13 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
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;
@@ -884,8 +889,12 @@ static switch_status_t sofia_write_frame(switch_core_session_t *session, switch_
switch_set_flag_locked(tech_pvt, TFLAG_WRITING);
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;
#if 0