[Freeswitch-svn] [commit] r4751 - freeswitch/trunk/src/mod/applications/mod_conference

Freeswitch SVN anthm at freeswitch.org
Fri Mar 23 12:34:14 EDT 2007


Author: anthm
Date: Fri Mar 23 12:34:13 2007
New Revision: 4751

Modified:
   freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c

Log:
fixes

Modified: freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_conference/mod_conference.c	Fri Mar 23 12:34:13 2007
@@ -735,7 +735,7 @@
 			if (conference->fnode->leadin) {
 				conference->fnode->leadin--;
 			} else {
-				ready++;
+				file_sample_len = samples;
 				if (conference->fnode->type == NODE_TYPE_SPEECH) {
 					switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_BLOCKING;
 					uint32_t rate = conference->rate;
@@ -758,34 +758,40 @@
 				}
 			}
 			has_file_data = 1;
+			ready++;
 		} else {
 			has_file_data = 0;
 		}
 
 		if (conference->async_fnode) {
-			switch_core_file_read(&conference->async_fnode->fh, async_file_frame, &file_sample_len);
-
-			if (file_sample_len <= 0) {
-				conference->async_fnode->done++;
+			/* Lead in time */
+			if (conference->async_fnode->leadin) {
+				conference->async_fnode->leadin--;
 			} else {
-				if (has_file_data) {
-					switch_size_t x;			
-					for (x = 0; x < file_sample_len; x++) {
-						int32_t z;
-						int16_t *bptr, *muxed;
-						
-						muxed = (int16_t *) file_frame;
-						bptr = (int16_t *) async_file_frame;
-						z = muxed[x] + bptr[x];
-						switch_normalize_to_16bit(z);
-						muxed[x] = (int16_t)z;
-					}
+				file_sample_len = samples;
+				switch_core_file_read(&conference->async_fnode->fh, async_file_frame, &file_sample_len);
+				if (file_sample_len <= 0) {
+					conference->async_fnode->done++;
 				} else {
-					memcpy(file_frame, async_file_frame, file_sample_len * 2);
-					has_file_data = 1;
+					if (has_file_data) {
+						switch_size_t x;			
+						for (x = 0; x < file_sample_len; x++) {
+							int32_t z;
+							int16_t *bptr, *muxed;
+							
+							muxed = (int16_t *) file_frame;
+							bptr = (int16_t *) async_file_frame;
+							z = muxed[x] + bptr[x];
+							switch_normalize_to_16bit(z);
+							muxed[x] = (int16_t)z;
+						}
+					} else {
+						memcpy(file_frame, async_file_frame, file_sample_len * 2);
+						has_file_data = 1;
+						ready++;
+					}
 				}
 			}
-
 		}
 
 		if (ready) {
@@ -833,22 +839,22 @@
 						if (imember->read > imember->len) {
 							imember->len = imember->read;
 						}
-
+						
 						bptr = (int16_t *) imember->frame;
 						muxed = (int16_t *) omember->mux_frame;
 
-
+						
 						for (x = 0; x < imember->read / 2; x++) {
 							int32_t z = muxed[x] + bptr[x];
 							switch_normalize_to_16bit(z);
 							muxed[x] = (int16_t)z;
 						}
-
+						
 						ready++;
 					}
 				}
 			}
-
+			
 			/* Go back and write each member his dedicated copy of the audio frame that does not contain his own audio. */
 			for (imember = conference->members; imember; imember = imember->next) {
 				if (switch_test_flag(imember, MFLAG_RUNNING)) {
@@ -1958,7 +1964,7 @@
         }
     }
 
-    if (!strncasecmp(file, "say:", 4)) {
+    if (!async && !strncasecmp(file, "say:", 4)) {
         status = conference_say(conference, file + 4, leadin);
         goto done;
     } 
@@ -1969,10 +1975,12 @@
                 goto done;
             }
             file = dfile;
-        } else {
+        } else if (!async) {
             status = conference_say(conference, file, leadin);
             goto done;  
-        }
+        } else {
+			goto done;
+		}
     }
 
     /* Setup a memory pool to use. */
@@ -2017,8 +2025,10 @@
 		conference->async_fnode = fnode;
 
 		if (nptr) {
-			switch_speech_flag_t flags = SWITCH_SPEECH_FLAG_NONE;
-			switch_core_speech_close(&conference->fnode->sh, &flags);
+			switch_memory_pool_t *pool;
+			switch_core_file_close(&nptr->fh);
+			pool = nptr->pool;
+            switch_core_destroy_memory_pool(&pool);
 		}
 		
 	} else {



More information about the Freeswitch-svn mailing list