dos2unix
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5618 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
e02f28a8df
commit
646a812eef
|
@ -91,7 +91,7 @@ typedef struct {
|
|||
apr_pool_t *pool;
|
||||
switch_speech_flag_t flags;
|
||||
switch_mutex_t *flag_mutex;
|
||||
switch_thread_cond_t *wait_object;
|
||||
switch_thread_cond_t *wait_object;
|
||||
} openmrcp_session_t;
|
||||
|
||||
typedef enum {
|
||||
|
@ -137,10 +137,10 @@ static openmrcp_session_t* openmrcp_session_create(openmrcp_profile_t *profile)
|
|||
openmrcp_session->mrcp_message_last_rcvd = NULL;
|
||||
|
||||
switch_mutex_init(&openmrcp_session->flag_mutex, SWITCH_MUTEX_NESTED, openmrcp_session->pool);
|
||||
|
||||
if (switch_thread_cond_create(&openmrcp_session->wait_object, openmrcp_session->pool)) {
|
||||
|
||||
if (switch_thread_cond_create(&openmrcp_session->wait_object, openmrcp_session->pool)) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "wait object creation failed\n");
|
||||
}
|
||||
}
|
||||
|
||||
openmrcp_session->client_session = mrcp_client_context_session_create(openmrcp_session->profile->mrcp_context,openmrcp_session);
|
||||
if (!openmrcp_session->client_session) {
|
||||
|
@ -184,11 +184,11 @@ static mrcp_status_t openmrcp_on_channel_add(mrcp_client_context_t *context, mrc
|
|||
if(!openmrcp_session) {
|
||||
return MRCP_STATUS_FAILURE;
|
||||
}
|
||||
switch_mutex_lock(openmrcp_session->flag_mutex);
|
||||
switch_mutex_lock(openmrcp_session->flag_mutex);
|
||||
openmrcp_session->control_channel = control_channel;
|
||||
openmrcp_session->audio_channel = audio_channel;
|
||||
switch_thread_cond_signal(openmrcp_session->wait_object);
|
||||
switch_mutex_unlock(openmrcp_session->flag_mutex);
|
||||
switch_thread_cond_signal(openmrcp_session->wait_object);
|
||||
switch_mutex_unlock(openmrcp_session->flag_mutex);
|
||||
return MRCP_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
@ -333,11 +333,11 @@ static switch_status_t openmrcp_asr_open(switch_asr_handle_t *ah, char *codec, i
|
|||
|
||||
mrcp_client_context_channel_add(asr_session->profile->mrcp_context, asr_session->client_session, asr_channel, NULL);
|
||||
|
||||
switch_mutex_lock(asr_session->flag_mutex);
|
||||
if(switch_thread_cond_timedwait(asr_session->wait_object,asr_session->flag_mutex,5000*1000) != APR_SUCCESS) {
|
||||
switch_mutex_lock(asr_session->flag_mutex);
|
||||
if(switch_thread_cond_timedwait(asr_session->wait_object,asr_session->flag_mutex,5000*1000) != APR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No response from client stack\n");
|
||||
}
|
||||
switch_mutex_unlock(asr_session->flag_mutex);
|
||||
}
|
||||
switch_mutex_unlock(asr_session->flag_mutex);
|
||||
if(!asr_session->control_channel) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No recognizer channel available\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
@ -579,11 +579,11 @@ static switch_status_t openmrcp_tts_open(switch_speech_handle_t *sh, char *voice
|
|||
}
|
||||
mrcp_client_context_channel_add(tts_session->profile->mrcp_context, tts_session->client_session, tts_channel, NULL);
|
||||
|
||||
switch_mutex_lock(tts_session->flag_mutex);
|
||||
if(switch_thread_cond_timedwait(tts_session->wait_object,tts_session->flag_mutex,5000*1000) != APR_SUCCESS) {
|
||||
switch_mutex_lock(tts_session->flag_mutex);
|
||||
if(switch_thread_cond_timedwait(tts_session->wait_object,tts_session->flag_mutex,5000*1000) != APR_SUCCESS) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No response from client stack\n");
|
||||
}
|
||||
switch_mutex_unlock(tts_session->flag_mutex);
|
||||
}
|
||||
switch_mutex_unlock(tts_session->flag_mutex);
|
||||
if(!tts_session->control_channel) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No synthesizer channel available\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
|
@ -631,8 +631,8 @@ static switch_status_t openmrcp_read_tts(switch_speech_handle_t *sh, void *data,
|
|||
{
|
||||
openmrcp_session_t *tts_session = (openmrcp_session_t *) sh->private_info;
|
||||
size_t return_len=0;
|
||||
media_frame_t media_frame;
|
||||
audio_source_t *audio_source;
|
||||
media_frame_t media_frame;
|
||||
audio_source_t *audio_source;
|
||||
|
||||
if (switch_test_flag(tts_session, FLAG_SPEAK_COMPLETE)) {
|
||||
/* tell fs we are done */
|
||||
|
@ -640,7 +640,7 @@ static switch_status_t openmrcp_read_tts(switch_speech_handle_t *sh, void *data,
|
|||
return SWITCH_STATUS_BREAK;
|
||||
}
|
||||
|
||||
audio_source = mrcp_client_audio_source_get(tts_session->audio_channel);
|
||||
audio_source = mrcp_client_audio_source_get(tts_session->audio_channel);
|
||||
if(!audio_source) {
|
||||
return SWITCH_STATUS_BREAK;
|
||||
}
|
||||
|
@ -654,16 +654,16 @@ static switch_status_t openmrcp_read_tts(switch_speech_handle_t *sh, void *data,
|
|||
|
||||
/* sampling rate and frame size should be retrieved from audio source */
|
||||
*rate = 8000;
|
||||
media_frame.codec_frame.size = 160;
|
||||
while(return_len < *datalen) {
|
||||
media_frame.codec_frame.buffer = (char*)data + return_len;
|
||||
audio_source->method_set->read_frame(audio_source,&media_frame);
|
||||
if(media_frame.type != MEDIA_FRAME_TYPE_AUDIO) {
|
||||
memset(media_frame.codec_frame.buffer,0,media_frame.codec_frame.size);
|
||||
}
|
||||
return_len += media_frame.codec_frame.size;
|
||||
}
|
||||
*datalen = return_len;
|
||||
media_frame.codec_frame.size = 160;
|
||||
while(return_len < *datalen) {
|
||||
media_frame.codec_frame.buffer = (char*)data + return_len;
|
||||
audio_source->method_set->read_frame(audio_source,&media_frame);
|
||||
if(media_frame.type != MEDIA_FRAME_TYPE_AUDIO) {
|
||||
memset(media_frame.codec_frame.buffer,0,media_frame.codec_frame.size);
|
||||
}
|
||||
return_len += media_frame.codec_frame.size;
|
||||
}
|
||||
*datalen = return_len;
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue