fix to avoid null checking error in tts_tidl_request_add_text_with_synthesis_parameter 81/318781/1
authordyamy-lee <dyamy.lee@samsung.com>
Tue, 8 Oct 2024 08:30:35 +0000 (17:30 +0900)
committerdyamy-lee <dyamy.lee@samsung.com>
Tue, 8 Oct 2024 08:36:13 +0000 (17:36 +0900)
Rpc_port api checks parameters' null value in their side.
But, synthesis parameter handle can have null value if client is not setting.
So, to prevent this error return, this patch adds 'NULL' string.

Change-Id: Ic393cf17b3dbe2a5cdad00b7749639bd9dba4865

client/tts.c
client/tts_tidl.c

index 0583294714a91ceaddaf53626dd5b19e6076a80a..950c16452fc2049cd44c791fe5fb34a0769a830f 100644 (file)
@@ -1698,8 +1698,8 @@ int tts_add_text_with_synthesis_parameter(tts_h tts, const char* text, tts_synth
        RETVM_IF(NULL == utt_id, TTS_ERROR_INVALID_PARAMETER, "[ERROR] Input parameter is null");
        RETVM_IF(false == tts_core_is_valid_text(text), TTS_ERROR_INVALID_PARAMETER, "[ERROR] Input text is invalid");
 
-       SLOG(LOG_ERROR, TAG_TTSC, "[INFO] Add text with synthesis parameter: text(%s), language(%s), ptts_id(%s), type(%d), speed(%d), pitch(%d), volume(%lf), background_volume(%lf)",
-       (NULL == text) ? "NULL" : text, (NULL == parameter->language) ? "NULL" : parameter->language, (NULL == parameter->ptts_id) ? "NULL" : parameter->ptts_id, parameter->voice_type, parameter->speed, parameter->pitch, parameter->volume, parameter->background_volume_ratio);
+       SLOG(LOG_ERROR, TAG_TTSC, "[INFO] Add text with synthesis parameter: text(%s), language(%s), ptts_id(%s), engine_type(%s), type(%d), speed(%d), pitch(%d), volume(%lf), background_volume(%lf)",
+       (NULL == text) ? "NULL" : text, (NULL == parameter->language) ? "NULL" : parameter->language, (NULL == parameter->ptts_id) ? "NULL" : parameter->ptts_id, (NULL == parameter->engine_type) ? "NULL" : parameter->engine_type, parameter->voice_type, parameter->speed, parameter->pitch, parameter->volume, parameter->background_volume_ratio);
 
        tts_client_s* client = tts_client_get(tts);
        RETVM_IF(NULL == client, TTS_ERROR_INVALID_PARAMETER, "[ERROR] A handle is not valid. tts(%p)", tts);
index fb2c7f635566b5d10ba2217e091eb2819ceb65b1..3e29e16ed4123df6f74c3a6bdc5c417814af3995 100644 (file)
@@ -758,6 +758,7 @@ int tts_tidl_request_add_text_with_synthesis_parameter(unsigned int uid, const c
 
        char *language = (parameter->language) ? (parameter->language) : "default";
        char *ptts_id = (parameter->ptts_id) ? (parameter->ptts_id) : "#NULL";
+       char *engine_type = (parameter->engine_type) ? (parameter->engine_type) : "#NULL";
 
 
        SLOG(LOG_DEBUG, TAG_TTSC, "info->rpc_h (%p)", info->rpc_h);
@@ -770,9 +771,9 @@ int tts_tidl_request_add_text_with_synthesis_parameter(unsigned int uid, const c
        SLOG(LOG_DEBUG, TAG_TTSC, "parameter->pitch (%d)", parameter->pitch);
        SLOG(LOG_DEBUG, TAG_TTSC, "parameter->volume (%f)", parameter->volume);
        SLOG(LOG_DEBUG, TAG_TTSC, "parameter->background_volume_ratio (%f)", parameter->background_volume_ratio);
-       SLOG(LOG_DEBUG, TAG_TTSC, "parameter->engine_type(%s)", (parameter->engine_type) ? (parameter->engine_type) : "null");
+       SLOG(LOG_DEBUG, TAG_TTSC, "parameter->engine_type(%s), input engine_type(%s)", (parameter->engine_type) ? (parameter->engine_type) : "null", engine_type);
 
-       int ret = rpc_port_proxy_tts_invoke_add_text_with_synthesis_parameter(info->rpc_h, uid, text, language, ptts_id, parameter->voice_type, parameter->speed, parameter->pitch, parameter->volume, parameter->background_volume_ratio, parameter->engine_type, uttid, not_null_credential);
+       int ret = rpc_port_proxy_tts_invoke_add_text_with_synthesis_parameter(info->rpc_h, uid, text, language, ptts_id, parameter->voice_type, parameter->speed, parameter->pitch, parameter->volume, parameter->background_volume_ratio, engine_type, uttid, not_null_credential);
        int exception = get_last_result();
        if (RPC_PORT_ERROR_NONE != exception) {
                ret = __convert_and_handle_tidl_error(exception, info);