[Sumover-dev] [svn commit] r4121 - rat/trunk

sumover-dev at cs.ucl.ac.uk sumover-dev at cs.ucl.ac.uk
Tue Feb 5 13:19:02 GMT 2008


Author: piers
Date: Tue Feb  5 13:19:00 2008
New Revision: 4121

Modified:
   rat/trunk/main_engine.c
   rat/trunk/mbus_engine.c
   rat/trunk/session.h
   rat/trunk/settings.c

Log:
Fixes Ticket #168 - Stops rat crashing when two (or more) instances run in encrypted mode using different keys on the same address with promiscuous mode switched on.

Promiscuous mode (where RAT doesn't wait for an RTCP packet before allowing the source - ie it only requires a RTP packet and omits the 'probation' check for in sequence RTP packets) has been on as default for a while as it useful for quickly connecting to devices that don't generate RTCP. However promiscuous mode is too relaxed about packet admission. Despite passing the rtp_validate() function some packets - especially those from a 'wrongly' (the key isn't correct) decrypted session - manage to pass that check but are actually garbage. The additional 'probation' checks in the promiscuous code (which checked for more than one packet in the sequence) are switched off. 

Solution:
- Promiscous mode has been disabled as default. 
- The wait_for_rtcp rtp option has been activated and added as a setting whose behaviour controls whether RAT waits for an RTCP packet before activating an RTP source. It's token has been renamed from RTP_OPT_WEAK_VALIDATION to RTP_OPT_WAIT_FOR_RTCP - It's value has been switched for previous usage as it makes more sense with the new naming. See the mods to common library. 

Note: The values of rtpPromiscuousMode and rtpWaitForRTCP are not stored in the .RATdefaults/Win-registry - though they are read from the file. They are intended as advanced testing options.


Modified: rat/trunk/main_engine.c
==============================================================================
--- rat/trunk/main_engine.c	(original)
+++ rat/trunk/main_engine.c	Tue Feb  5 13:19:00 2008
@@ -433,7 +433,7 @@
 			
 			/* Choke CPU usage */
 			if (!audio_is_ready(sp[i]->audio_device)) {
-				audio_wait_for(sp[i]->audio_device, 50);
+				audio_wait_for(sp[i]->audio_device, 40);
 			}
 
 			/* Check controller is still alive */

Modified: rat/trunk/mbus_engine.c
==============================================================================
--- rat/trunk/mbus_engine.c	(original)
+++ rat/trunk/mbus_engine.c	Tue Feb  5 13:19:00 2008
@@ -1075,6 +1075,7 @@
 				assert(sp->rtp_session[sp->rtp_session_count]);
 		}
 		rtp_set_option(sp->rtp_session[sp->rtp_session_count], RTP_OPT_PROMISC, sp->rtp_promiscuous_mode);
+		rtp_set_option(sp->rtp_session[sp->rtp_session_count], RTP_OPT_WAIT_FOR_RTCP, sp->rtp_wait_for_rtcp);
 		rtp_callback_init(sp->rtp_session[0], sp);
 
 		if(sp->rtp_session_count < sp->layers && sp->rtp_session_count > 0) {
@@ -1099,6 +1100,7 @@
 		sp->rtp_session[sp->rtp_session_count] = rtp_init(addr, (uint16_t)rx_port, (uint16_t)tx_port, ttl, 64000, rtp_callback_proc, NULL);
 
 		rtp_set_option(sp->rtp_session[sp->rtp_session_count], RTP_OPT_PROMISC, sp->rtp_promiscuous_mode);
+		rtp_set_option(sp->rtp_session[sp->rtp_session_count], RTP_OPT_WAIT_FOR_RTCP, sp->rtp_wait_for_rtcp);
 		rtp_callback_init(sp->rtp_session[0], sp);
 
 		if(sp->rtp_session_count < sp->layers && sp->rtp_session_count > 0) {

Modified: rat/trunk/session.h
==============================================================================
--- rat/trunk/session.h	(original)
+++ rat/trunk/session.h	Tue Feb  5 13:19:00 2008
@@ -121,7 +121,8 @@
 	int			 mbus_go;
 	char			*mbus_go_token;
 	uint32_t		 magic;				/* Magic number for debugging purposes */
-    int             rtp_promiscuous_mode;
+	int             	 rtp_promiscuous_mode; 		/* Recieve and decode RTP packets without waiting for RTCP nor probation period (in sequence sequence RTP numbers).  WARNING: Can lead to crashes with encrypted sessions as erroneous packets pass the relatively simple rtp_validation*/
+	int             	 rtp_wait_for_rtcp;		/* Wait for RTCP and probation before decoding RTP packets in a session, if unset decode packets once they have passed probation (a number of RTP packets in sequence) */
 } session_t;
 
 void session_init(session_t *sp, int index, int mode);

Modified: rat/trunk/settings.c
==============================================================================
--- rat/trunk/settings.c	(original)
+++ rat/trunk/settings.c	Tue Feb  5 13:19:00 2008
@@ -410,7 +410,8 @@
         audio_loopback(sp->audio_device, sp->loopback_gain);
 	sp->echo_suppress     = setting_load_int("audioEchoSuppress", 0);
 	sp->meter             = setting_load_int("audioPowermeters", 1);
-    sp->rtp_promiscuous_mode     = setting_load_int("rtpPromiscuousMode", 1);
+        sp->rtp_promiscuous_mode   = setting_load_int("rtpPromiscuousMode", 0); 
+        sp->rtp_wait_for_rtcp = setting_load_int("rtpWaitForRTCP", 1);
 
 /* Ignore saved render_3d setting.  Break initial device config stuff.  V.fiddly to fix. */
 /*	sp->render_3d      = setting_load_int("audio3dRendering", 0);                    */



More information about the Sumover-dev mailing list