]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
adding a check for frame sizes so VBR codecs work correctly.. Should this be moved...
authorBrian West <brian@freeswitch.org>
Wed, 6 Sep 2006 23:58:14 +0000 (23:58 +0000)
committerBrian West <brian@freeswitch.org>
Wed, 6 Sep 2006 23:58:14 +0000 (23:58 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@2538 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/codecs/mod_l16/mod_l16.c
src/mod/endpoints/mod_sofia/mod_sofia.c

index a52d557096de6fb3493d4e565d9b1db78c9f3632..6bc4eea398970b9c28de2756ab6e6f2fc58ab886 100644 (file)
@@ -195,11 +195,11 @@ static const switch_codec_implementation_t raw_8k_60ms_implementation = {
        /*.ianacode */ 10,
        /*.iananame */ "L16",
        /*.samples_per_second */ 8000,
-       /*.bits_per_second */ 256000,
-       /*.microseconds_per_frame */ 60000,
-       /*.samples_per_frame */ 480,
-       /*.bytes_per_frame */ 960,
-       /*.encoded_bytes_per_frame */ 960,
+       /*.bits_per_second */ 128000,
+       /*.microseconds_per_frame */ 22500,
+       /*.samples_per_frame */ 180,
+       /*.bytes_per_frame */ 360,
+       /*.encoded_bytes_per_frame */ 360,
        /*.number_of_channels */ 1,
        /*.pref_frames_per_packet */ 1,
        /*.max_frames_per_packet */ 1,
@@ -230,7 +230,6 @@ static const switch_codec_implementation_t raw_8k_120ms_implementation = {
        /*.next */ &raw_8k_60ms_implementation
 };
 
-
 static const switch_codec_interface_t raw_codec_interface = {
        /*.interface_name */ "raw signed linear (16 bit)",
        /*.implementations */ &raw_8k_120ms_implementation
index 2ec6182b7d465881dc42c74975d3a92a86994789..5cdc74cfa2587174e81a9f637890d347b42cb314 100644 (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