[Freeswitch-svn] [commit] r4101 - freeswitch/trunk/src/mod/endpoints/mod_portaudio

Freeswitch SVN anthm at freeswitch.org
Wed Jan 31 12:12:42 EST 2007


Author: anthm
Date: Wed Jan 31 12:12:42 2007
New Revision: 4101

Modified:
   freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c

Log:
only 1 call can control the ring device

Modified: freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c
==============================================================================
--- freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	(original)
+++ freeswitch/trunk/src/mod/endpoints/mod_portaudio/mod_portaudio.c	Wed Jan 31 12:12:42 2007
@@ -53,7 +53,8 @@
 typedef enum {
     GFLAG_NONE = 0,
     GFLAG_EAR = (1 << 0),
-    GFLAG_MOUTH = (1 << 1)
+    GFLAG_MOUTH = (1 << 1),
+    GFLAG_RING = (1 << 2)
 } GFLAGS;
 
 typedef enum {
@@ -105,6 +106,7 @@
 	switch_hash_t *call_hash;
 	switch_mutex_t *device_lock;
 	switch_mutex_t *pvt_lock;
+	switch_mutex_t *flag_mutex;
 	int sample_rate;
 	int codec_ms;
 	PABLIO_Stream *audio_stream;
@@ -215,6 +217,10 @@
                 ring_file = val;
             }
 
+            if (switch_test_flag((&globals), GFLAG_RING)) {
+                ring_file = NULL;
+            }
+            switch_set_flag_locked((&globals), GFLAG_RING);
             if (ring_file) {
                 if (switch_core_file_open(&fh,
                                           ring_file,
@@ -267,6 +273,7 @@
             switch_yield(globals.read_codec.implementation->microseconds_per_frame);
 
         }
+        switch_clear_flag_locked((&globals), GFLAG_RING);
     }
 
     if (ring_file) {
@@ -896,6 +903,7 @@
 	switch_core_hash_init(&globals.call_hash, module_pool);
 	switch_mutex_init(&globals.device_lock, SWITCH_MUTEX_NESTED, module_pool);
 	switch_mutex_init(&globals.pvt_lock, SWITCH_MUTEX_NESTED, module_pool);
+	switch_mutex_init(&globals.flag_mutex, SWITCH_MUTEX_NESTED, module_pool);
 
 
 



More information about the Freeswitch-svn mailing list