Revision
17065
Author
anthm
Date
2010-03-22 11:22:19 -0500 (Mon, 22 Mar 2010)

Log Message

FSCORE-576

Modified Paths

Diff

Modified: freeswitch/trunk/src/include/private/switch_core_pvt.h (17064 => 17065)


--- freeswitch/trunk/src/include/private/switch_core_pvt.h	2010-03-22 14:24:11 UTC (rev 17064)
+++ freeswitch/trunk/src/include/private/switch_core_pvt.h	2010-03-22 16:22:19 UTC (rev 17065)
@@ -127,6 +127,7 @@
 	switch_mutex_t *codec_read_mutex;
 	switch_mutex_t *codec_write_mutex;
 	switch_thread_cond_t *cond;
+	switch_mutex_t *frame_read_mutex;
 
 	switch_thread_rwlock_t *rwlock;
 

Modified: freeswitch/trunk/src/switch_core.c (17064 => 17065)


--- freeswitch/trunk/src/switch_core.c	2010-03-22 14:24:11 UTC (rev 17064)
+++ freeswitch/trunk/src/switch_core.c	2010-03-22 16:22:19 UTC (rev 17065)
@@ -308,7 +308,7 @@
 }
 
 
-static void *switch_core_service_thread(switch_thread_t *thread, void *obj)
+static void *SWITCH_THREAD_FUNC switch_core_service_thread(switch_thread_t *thread, void *obj)
 {
 	switch_core_session_t *session = obj;
 	switch_channel_t *channel;
@@ -321,6 +321,8 @@
 		return NULL;
 	}
 
+	switch_mutex_lock(session->frame_read_mutex);
+
 	channel = switch_core_session_get_channel(session);
 
 	switch_channel_set_flag(channel, CF_SERVICE);
@@ -336,7 +338,10 @@
 		}
 	}
 
+	switch_mutex_unlock(session->frame_read_mutex);
+
 	switch_core_session_rwunlock(session);
+
 	return NULL;
 }
 
@@ -360,7 +365,7 @@
 	channel = switch_core_session_get_channel(session);
 	switch_assert(channel);
 
-	switch_core_session_launch_thread(session, switch_core_service_thread, session);
+	switch_core_session_launch_thread(session, (void *(*)(switch_thread_t *,void *))switch_core_service_thread, session);
 }
 
 /* This function abstracts the thread creation for modules by allowing you to pass a function ptr and

Modified: freeswitch/trunk/src/switch_core_session.c (17064 => 17065)


--- freeswitch/trunk/src/switch_core_session.c	2010-03-22 14:24:11 UTC (rev 17064)
+++ freeswitch/trunk/src/switch_core_session.c	2010-03-22 16:22:19 UTC (rev 17065)
@@ -1558,6 +1558,7 @@
 	switch_mutex_init(&session->resample_mutex, SWITCH_MUTEX_NESTED, session->pool);
 	switch_mutex_init(&session->codec_read_mutex, SWITCH_MUTEX_NESTED, session->pool);
 	switch_mutex_init(&session->codec_write_mutex, SWITCH_MUTEX_NESTED, session->pool);
+	switch_mutex_init(&session->frame_read_mutex, SWITCH_MUTEX_NESTED, session->pool);
 	switch_thread_rwlock_create(&session->bug_rwlock, session->pool);
 	switch_thread_cond_create(&session->cond, session->pool);
 	switch_thread_rwlock_create(&session->rwlock, session->pool);