[Freeswitch-svn] [commit] r3795 - in freeswitch/trunk/src: . mod/endpoints/mod_dingaling mod/endpoints/mod_sofia

Freeswitch SVN mikej at freeswitch.org
Fri Dec 22 10:55:52 EST 2006


Author: mikej
Date: Fri Dec 22 10:55:52 2006
New Revision: 3795

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
   freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
   freeswitch/trunk/src/switch_rtp.c

Log:
refactor

Modified: freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_dingaling/mod_dingaling.c	Fri Dec 22 10:55:52 2006
@@ -1280,17 +1280,19 @@
 		}
 
 		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;
 		}
 

Modified: freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_sofia/mod_sofia.c	Fri Dec 22 10:55:52 2006
@@ -1614,9 +1614,12 @@
                 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;
 			}
 		}

Modified: freeswitch/trunk/src/switch_rtp.c
==============================================================================
--- freeswitch/trunk/src/switch_rtp.c	(original)
+++ freeswitch/trunk/src/switch_rtp.c	Fri Dec 22 10:55:52 2006
@@ -782,7 +782,7 @@
             *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 @@
 				*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;
 			}
 		}		
 		



More information about the Freeswitch-svn mailing list