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;
}
-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;
return NULL;
}
+ switch_mutex_lock(session->frame_read_mutex);
+
channel = switch_core_session_get_channel(session);
switch_channel_set_flag(channel, CF_SERVICE);
}
}
+ switch_mutex_unlock(session->frame_read_mutex);
+
switch_core_session_rwunlock(session);
+
return NULL;
}
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
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);