]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
refactor
authorMichael Jerris <mike@jerris.com>
Fri, 22 Dec 2006 15:55:52 +0000 (15:55 +0000)
committerMichael Jerris <mike@jerris.com>
Fri, 22 Dec 2006 15:55:52 +0000 (15:55 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@3795 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_sofia/mod_sofia.c
src/switch_rtp.c

index a7476bb3fac3b74d9581b131ef5a6427589ac28b..344828e2dfb94e88b025c320a68e5c450e01fc1e 100644 (file)
@@ -1280,17 +1280,19 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
                }
 
                if (tech_pvt->read_frame.datalen > 0) {
-                       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;
-                       tech_pvt->read_frame.samples = (int) samples;
-                       tech_pvt->last_read = tech_pvt->read_frame.datalen;
+            if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
+                if (tech_pvt->read_codec.implementation->encoded_bytes_per_frame && bytes) {
+                    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;
+                tech_pvt->read_frame.samples = (int) samples;
+                tech_pvt->last_read = tech_pvt->read_frame.datalen;
+            }
                        break;
                }
 
index 9cba1aea55eb5cbcc837fc9e9d6edefd4adf5e1f..d1176a85d6625244a1ac39faffb59f0df721a2cc 100644 (file)
@@ -1614,9 +1614,12 @@ static switch_status_t sofia_read_frame(switch_core_session_t *session, switch_f
                 size_t bytes = 0;
                 int frames = 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);
-                               tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_codec.implementation->samples_per_frame);
+                if (!switch_test_flag((&tech_pvt->read_frame), SFF_CNG)) {
+                    if ((bytes = tech_pvt->read_codec.implementation->encoded_bytes_per_frame)) {
+                        frames = (tech_pvt->read_frame.datalen / bytes);
+                        tech_pvt->read_frame.samples = (int) (frames * tech_pvt->read_codec.implementation->samples_per_frame);
+                    }
+                }
                                break;
                        }
                }
index 706da89204df6480122bb42d27e2716acf5c657c..120c7d507a074a4f3b02bb46ebd5e0f5fb04ef0d 100644 (file)
@@ -782,7 +782,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
             *flags |= SFF_CNG;
             /* Return a CNG frame */
             *payload_type = SWITCH_RTP_CNG_PAYLOAD;
-            return SWITCH_RTP_CNG_PAYLOAD;
+            return SWITCH_RTP_CNG_PAYLOAD + rtp_header_len;
                }
 
                if (!switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO)) {
@@ -857,7 +857,7 @@ static int rtp_common_read(switch_rtp_t *rtp_session, switch_payload_t *payload_
                                *flags |= SFF_CNG;
                                /* Return a CNG frame */
                                *payload_type = SWITCH_RTP_CNG_PAYLOAD;
-                               return SWITCH_RTP_CNG_PAYLOAD;
+                               return SWITCH_RTP_CNG_PAYLOAD + rtp_header_len;
                        }
                }