Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPEECH_CHANNEL_TIMEOUT_USEC #9

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app-unimrcp/app_mrcprecog.c
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ static int recog_channel_start(speech_channel_t *schannel, const char *name, int
}

/* Wait for IN PROGRESS. */
apr_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
apr_thread_cond_timedwait(schannel->cond, schannel->mutex, globals.speech_channel_timeout_usec);

if (schannel->state != SPEECH_CHANNEL_PROCESSING) {
apr_thread_mutex_unlock(schannel->mutex);
Expand Down Expand Up @@ -670,7 +670,7 @@ static int recog_channel_load_grammar(speech_channel_t *schannel, const char *na
return -1;
}

apr_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
apr_thread_cond_timedwait(schannel->cond, schannel->mutex, globals.speech_channel_timeout_usec);

if (schannel->state != SPEECH_CHANNEL_READY) {
apr_thread_mutex_unlock(schannel->mutex);
Expand Down
2 changes: 1 addition & 1 deletion app-unimrcp/app_mrcpsynth.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ static int synth_channel_speak(speech_channel_t *schannel, const char *content,
}

/* Wait for IN PROGRESS. */
apr_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
apr_thread_cond_timedwait(schannel->cond, schannel->mutex, globals.speech_channel_timeout_usec);

if (schannel->state != SPEECH_CHANNEL_PROCESSING) {
apr_thread_mutex_unlock(schannel->mutex);
Expand Down
6 changes: 3 additions & 3 deletions app-unimrcp/app_synthandrecog.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ static int synth_channel_speak(speech_channel_t *schannel, const char *content,
}

/* Wait for IN PROGRESS. */
apr_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
apr_thread_cond_timedwait(schannel->cond, schannel->mutex, globals.speech_channel_timeout_usec);

if (schannel->state != SPEECH_CHANNEL_PROCESSING) {
apr_thread_mutex_unlock(schannel->mutex);
Expand Down Expand Up @@ -810,7 +810,7 @@ static int recog_channel_start(speech_channel_t *schannel, const char *name, int
}

/* Wait for IN PROGRESS. */
apr_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
apr_thread_cond_timedwait(schannel->cond, schannel->mutex, globals.speech_channel_timeout_usec);

if (schannel->state != SPEECH_CHANNEL_PROCESSING) {
apr_thread_mutex_unlock(schannel->mutex);
Expand Down Expand Up @@ -880,7 +880,7 @@ static int recog_channel_load_grammar(speech_channel_t *schannel, const char *na
return -1;
}

apr_thread_cond_timedwait(schannel->cond, schannel->mutex, SPEECH_CHANNEL_TIMEOUT_USEC);
apr_thread_cond_timedwait(schannel->cond, schannel->mutex, globals.speech_channel_timeout_usec);

if (schannel->state != SPEECH_CHANNEL_READY) {
apr_thread_mutex_unlock(schannel->mutex);
Expand Down
6 changes: 6 additions & 0 deletions app-unimrcp/ast_unimrcp_framework.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ static void globals_null(void)
globals.apps = NULL;
globals.mutex = NULL;
globals.speech_channel_number = 0;
globals.speech_channel_timeout_usec = 30000000;
globals.profiles = NULL;
}

Expand Down Expand Up @@ -129,6 +130,7 @@ static void globals_default(void)
globals.unimrcp_offer_new_connection = NULL;
globals.unimrcp_log_level = DEFAULT_UNIMRCP_LOG_LEVEL;
globals.speech_channel_number = 0;
globals.speech_channel_timeout_usec = 30000000;
}

void globals_destroy(void)
Expand Down Expand Up @@ -801,6 +803,10 @@ int load_mrcp_config(const char *filename, const char *who_asked)
ast_log(LOG_DEBUG, "general.request-timeout=%s\n", value);
globals.unimrcp_request_timeout = apr_pstrdup(globals.pool, value);
}
if ((value = ast_variable_retrieve(cfg, "general", "speech-channel-timeout-usec")) != NULL) {
ast_log(LOG_DEBUG, "general.speech-channel-timeout-usec=%s\n", value);
globals.speech_channel_timeout_usec = apr_pstrdup(globals.pool, value);
}

while ((cat = ast_category_browse(cfg, cat)) != NULL) {
if (strcasecmp(cat, "general") != 0) {
Expand Down
2 changes: 2 additions & 0 deletions app-unimrcp/ast_unimrcp_framework.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ struct ast_mrcp_globals_t {
char *unimrcp_default_recog_profile;
/* Log level to use for the UniMRCP library. */
char *unimrcp_log_level;
/* The speech channel timeout configuration. */
char *speech_channel_timeout_usec;

/* The MRCP client stack. */
mrcp_client_t *mrcp_client;
Expand Down
1 change: 1 addition & 0 deletions conf/mrcp.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ offer-new-connection = 1
; rx-buffer-size = 1024
; tx-buffer-size = 1024
; request-timeout = 5000
speech-channel-timeout-usec = 30000000

;
; Profile for Nuance Speech Server MRCPv1
Expand Down