From: sungwook79.park Date: Fri, 3 May 2024 10:34:47 +0000 (+0900) Subject: Add max duration for silent X-Git-Tag: accepted/tizen/unified/toolchain/20240610.173109~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f69184bfc94cff1a2ffd5eed4ba0462fc0a300f5;p=platform%2Fcore%2Fuifw%2Ftts.git Add max duration for silent Change-Id: I387463092d91b339359f8abe998182d1406bd4a8 Signed-off-by: sungwook79.park --- diff --git a/client/tts.c b/client/tts.c index 1e484f9f..a6af1846 100644 --- a/client/tts.c +++ b/client/tts.c @@ -29,6 +29,8 @@ #include "tts_internal.h" +#define MAX_SILENT_DURATION 5000 + static int g_feature_enabled = -1; @@ -1571,6 +1573,16 @@ int tts_add_silent_utterance(tts_h tts, unsigned int duration_in_msec, int* utt_ RETVM_IF(false == tts_core_check_screen_reader(client), TTS_ERROR_SCREEN_READER_OFF, "[ERROR] Screen reader option is not available"); RETVM_IF(false == tts_core_check_credential(client), TTS_ERROR_PERMISSION_DENIED, "[ERROR] Do not have app credential for this engine"); + if (duration_in_msec < 0) { + SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to add silent. The duration of silent should be above than zero."); + return TTS_ERROR_INVALID_PARAMETER; + } + + if (duration_in_msec > MAX_SILENT_DURATION) { + SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to add silent. The max duration for silent is 5000 msec"); + return TTS_ERROR_INVALID_PARAMETER; + } + int ret = tts_core_add_silent_utterance(client, duration_in_msec, utt_id); if (TTS_ERROR_NONE != ret) { SLOG(LOG_ERROR, TAG_TTSC, "[ERROR] Fail to request add silent. ret(%s)", tts_core_covert_error_code(ret)); diff --git a/include/tts.h b/include/tts.h index a66e90cd..e8d94a08 100644 --- a/include/tts.h +++ b/include/tts.h @@ -1126,6 +1126,7 @@ int tts_unset_synthesized_pcm_cb(tts_h tts); /** * @brief Add silence for the specified amount of time * @since_tizen 9.0 + * @remarks The maximum silent time is 5000 msec. If you want to perform a silent time of more than 5000 msec, call this function several times. * @param[in] tts The TTS handle * @param[in] duration_in_ms The duration of the silence * @param[out] utt_id The utterance ID passed to the callback function