commit 027047ed7b07832456cd5d13f4c85da24aca26b5

Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Tue Jul 14 18:17:37 2009 +0000

    Added missing UNIMRCP_APU_INCLUDES in pkg-config files
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1054 f001bc3a-424a-0410-80a0-a715b8f413a8

commit b0e1c8251f8039a8a22662120e5a362340733a9e
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Mon Jul 13 17:25:34 2009 +0000

    if state != RECOGNIZING, there is nothing to do on deactivation
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1053 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 3581b9d3ba59177f4aaced327e20b8dc53e234e3
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Mon Jul 13 16:14:38 2009 +0000

    Do not include Completion-Cause header field in the IN-PROGRESS response sent by PocketSphinx plugin
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1052 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 831f43f9071e491169d4d5a7e3d0cb2009c3af21
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Mon Jul 13 15:27:33 2009 +0000

    Using MRCP_SESSION_SID(session) macro wherever session id is logged
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1051 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 9349bd2b393ee0b300942bfa8cacc264687ecea9
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Sat Jul 11 15:17:42 2009 +0000

    Sent async channel_open and channel_close responses
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1050 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 5775dfc74e8fe982735da32dfa12dc05f0d20892
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Sat Jul 11 15:15:47 2009 +0000

    Sent async channel_close response
    
    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1049 f001bc3a-424a-0410-80a0-a715b8f413a8

commit efa4d10b2dc3de238dfb4a26b25ef3a580fb0bf0
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Sat Jul 11 12:54:47 2009 +0000

    Enhanced state machine to STOP in-progress SPEAK or RECOGNIZE requests on session termination, thus guarantee there is no remaining request, when plugin cha
nnel_close() method is called.

    channel_open() -> SPEAK -> STOP -> channel_close()
    channel_open() -> SPEAK -> SPEAK-COMPLETE -> channel_close()

    This allows to simplify implementation of plugins (nothing has to be changed).

    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1048 f001bc3a-424a-0410-80a0-a715b8f413a8

commit aaf53907ea0705bc2a44fe785c8f7762e20e52cf
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Fri Jul 10 12:57:33 2009 +0000

    Added utility function to get attributes of NLSML results such as confidence and grammar

    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1047 f001bc3a-424a-0410-80a0-a715b8f413a8

commit f7c4dff83199cb9af8dc7ec6f121c384d2b6cea0
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Fri Jul 10 09:51:23 2009 +0000

    Added missing includes for <stdlib.h> and <stdio.h> required on some platforms

    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1046 f001bc3a-424a-0410-80a0-a715b8f413a8

commit 1cb7ccb6e63f4d34b6cfcbdc386446a36d052af1
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Thu Jul 9 19:05:18 2009 +0000

    Using NLSML processor in demo

    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1045 f001bc3a-424a-0410-80a0-a715b8f413a8

commit cd74eee440dd94cabe814c7d4f64dfef187b7445
Author: achaloyan <achaloyan@f001bc3a-424a-0410-80a0-a715b8f413a8>
Date:   Thu Jul 9 18:52:49 2009 +0000

    Added basic NLSML document processor

    git-svn-id: https://unimrcp.googlecode.com/svn/trunk@1044 f001bc3a-424a-0410-80a0-a715b8f413a8



git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@14260 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris
2009-07-15 20:30:39 +00:00
parent 8e90e5433f
commit ef375bd654
29 changed files with 514 additions and 155 deletions

View File

@@ -237,7 +237,10 @@ static mrcp_engine_channel_t* pocketsphinx_engine_recognizer_create(mrcp_resourc
recognizer, /* object to associate */
NULL, /* codec descriptor might be NULL by default */
pool); /* pool to allocate memory from */
apr_thread_mutex_create(&recognizer->mutex,APR_THREAD_MUTEX_DEFAULT,channel->pool);
apr_thread_cond_create(&recognizer->wait_object,channel->pool);
recognizer->channel = channel;
return channel;
}
@@ -245,6 +248,15 @@ static mrcp_engine_channel_t* pocketsphinx_engine_recognizer_create(mrcp_resourc
/** Destroy pocketsphinx recognizer */
static apt_bool_t pocketsphinx_recognizer_destroy(mrcp_engine_channel_t *channel)
{
pocketsphinx_recognizer_t *recognizer = channel->method_obj;
if(recognizer->mutex) {
apr_thread_mutex_destroy(recognizer->mutex);
recognizer->mutex = NULL;
}
if(recognizer->wait_object) {
apr_thread_cond_destroy(recognizer->wait_object);
recognizer->wait_object = NULL;
}
return TRUE;
}
@@ -256,17 +268,10 @@ static apt_bool_t pocketsphinx_recognizer_open(mrcp_engine_channel_t *channel)
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Open Channel "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
apr_thread_mutex_create(&recognizer->mutex,APR_THREAD_MUTEX_DEFAULT,channel->pool);
apr_thread_cond_create(&recognizer->wait_object,channel->pool);
/* Launch a thread to run recognition in */
rv = apr_thread_create(&recognizer->thread,NULL,pocketsphinx_recognizer_run,recognizer,channel->pool);
if(rv != APR_SUCCESS) {
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Failed to Launch Thread "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
apr_thread_mutex_destroy(recognizer->mutex);
recognizer->mutex = NULL;
apr_thread_cond_destroy(recognizer->wait_object);
recognizer->wait_object = NULL;
return mrcp_engine_channel_open_respond(channel,FALSE);
}
@@ -278,25 +283,16 @@ static apt_bool_t pocketsphinx_recognizer_close(mrcp_engine_channel_t *channel)
{
pocketsphinx_recognizer_t *recognizer = channel->method_obj;
apt_log(APT_LOG_MARK,APT_PRIO_INFO,"Close Channel "APT_SIDRES_FMT,RECOGNIZER_SIDRES(recognizer));
if(recognizer->thread) {
apr_status_t rv;
/* Signal recognition thread to terminate */
apr_thread_mutex_lock(recognizer->mutex);
recognizer->close_requested = TRUE;
apr_thread_cond_signal(recognizer->wait_object);
apr_thread_mutex_unlock(recognizer->mutex);
apr_thread_join(&rv,recognizer->thread);
recognizer->thread = NULL;
apr_thread_mutex_destroy(recognizer->mutex);
recognizer->mutex = NULL;
apr_thread_cond_destroy(recognizer->wait_object);
recognizer->wait_object = NULL;
if(!recognizer->thread) {
return mrcp_engine_channel_close_respond(channel);
}
return mrcp_engine_channel_close_respond(channel);
/* Signal recognition thread to terminate */
apr_thread_mutex_lock(recognizer->mutex);
recognizer->close_requested = TRUE;
apr_thread_cond_signal(recognizer->wait_object);
apr_thread_mutex_unlock(recognizer->mutex);
return TRUE;
}
/** Process MRCP request (asynchronous response MUST be sent)*/
@@ -533,12 +529,10 @@ static apt_bool_t pocketsphinx_recognize(pocketsphinx_recognizer_t *recognizer,
return FALSE;
}
response_recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_SUCCESS;
mrcp_resource_header_property_add(response,RECOGNIZER_HEADER_COMPLETION_CAUSE);
if(!recognizer->decoder || ps_start_utt(recognizer->decoder, NULL) < 0) {
response->start_line.status_code = MRCP_STATUS_CODE_METHOD_FAILED;
response_recog_header->completion_cause = RECOGNIZER_COMPLETION_CAUSE_ERROR;
mrcp_resource_header_property_add(response,RECOGNIZER_HEADER_COMPLETION_CAUSE);
return FALSE;
}
@@ -755,17 +749,6 @@ static void* APR_THREAD_FUNC pocketsphinx_recognizer_run(apr_thread_t *thread, v
}
while(recognizer->close_requested == FALSE);
/* check if recognition is still active */
if(recognizer->inprogress_recog) {
apr_thread_mutex_lock(recognizer->mutex);
recognizer->stop_response = recognizer->inprogress_recog;
apr_thread_cond_wait(recognizer->wait_object,recognizer->mutex);
apr_thread_mutex_unlock(recognizer->mutex);
if(recognizer->complete_event) {
pocketsphinx_recognition_complete(recognizer,recognizer->complete_event);
}
}
/** Clear all the defined grammars */
pocketsphinx_grammars_clear(recognizer);
@@ -776,6 +759,10 @@ static void* APR_THREAD_FUNC pocketsphinx_recognizer_run(apr_thread_t *thread, v
recognizer->decoder = NULL;
}
recognizer->thread = NULL;
/** Finally send response to channel_close request */
mrcp_engine_channel_close_respond(recognizer->channel);
/** Exit thread */
apr_thread_exit(thread,APR_SUCCESS);
return NULL;