[Freeswitch-branches] [commit] r5590 - freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp
Freeswitch SVN
greenlizard at freeswitch.org
Mon Aug 13 13:27:10 EDT 2007
Author: greenlizard
Date: Mon Aug 13 13:27:10 2007
New Revision: 5590
Modified:
freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
Log:
the tts stuff works now at the most basic level, however the audio sounds choppy since there is some discrepancy in the rtp packet sizes between openmrcp and what fs is expecting, and buffering in this module needs to be improved.
Modified: freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c
==============================================================================
--- freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c (original)
+++ freeswitch/branches/greenlizard/src/mod/asr_tts/mod_openmrcp/mod_openmrcp.c Mon Aug 13 13:27:10 2007
@@ -1124,50 +1124,21 @@
{
media_frame_t *queue_frame = NULL;
tts_session_t *tts_session = (tts_session_t *) sh->private_info;
- size_t len = *datalen;
- size_t x = 0;
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "openmrcp_read_tts, datalen: %d\n", len);
+ size_t requested_len = *datalen;
+ size_t return_len = 0;
if (switch_queue_trypop(tts_session->audio_queue, (void *) &queue_frame)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "could not pop from queue\n");
- //return SWITCH_STATUS_FALSE;
return SWITCH_STATUS_SUCCESS;
}
else {
- if (queue_frame->codec_frame.size != len) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "You must recompile openmrcp with #define CODEC_FRAME_TIME_BASE 20\n");
- return SWITCH_STATUS_FALSE;
- }
-
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "add_up queue_frame: %li\n",
- add_up_buffer(queue_frame->codec_frame.buffer, len));
-
-
-
- switch_byte_t *bytedata = (switch_byte_t *) data;
- switch_byte_t *sourcedata = (switch_byte_t *) queue_frame->codec_frame.buffer;
-
- // memcpy(data, queue_frame->codec_frame.buffer, len);
- for (int i=0; i<len; i++) {
- *(bytedata + i) = sourcedata[i];
- }
-
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "add_up bytedata: %li\n",
- add_up_buffer(bytedata, len));
-
-
-
- // assume openmrcp is using 8kz for now
+ memcpy(data, queue_frame->codec_frame.buffer, queue_frame->codec_frame.size);
+ *datalen = queue_frame->codec_frame.size;
*rate = 8000;
-
return SWITCH_STATUS_SUCCESS;
}
-
- return SWITCH_STATUS_FALSE;
}
static void openmrcp_text_param_tts(switch_speech_handle_t *sh, char *param, char *val)
More information about the Freeswitch-branches
mailing list