修复4GAiUI出现叠字问题,tts播放卡顿问题还需进一步测试
authorluozheng <1732036298@qq.com>
Mon, 21 Jul 2025 06:01:46 +0000 (14:01 +0800)
committerluozheng <1732036298@qq.com>
Mon, 21 Jul 2025 06:01:46 +0000 (14:01 +0800)
code/sdk/application/wearable/fd230app/nativeui/aivoice/include/AiVoiceModel.h
code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp
code/sdk/application/wearable/fd230app/nativeui/uiservice/src/ui_service.cpp
code/sdk/application/wearable/service/ble_service/bleservice/bleService.c

index c6d09c6..6f1a8d0 100644 (file)
@@ -123,10 +123,10 @@ namespace OHOS
         void start_ai4g_connect_timer(uint32_t interval = 1000);
         void stop_ai4g_connect_timer(void);
 
-        void start_ai4g_tts_play_timer(uint32_t interval = 700);
+        void start_ai4g_tts_play_timer(uint32_t interval = 600);
         void stop_ai4g_tts_play_timer(void);
 
-        void start_update_ai_answer_timer(uint32_t interval = 200);
+        void start_update_ai_answer_timer(uint32_t interval = 300);
         void stop_update_ai_answer_timer(void);
 
         void SetSelectAiModel(int index);
index f151a90..a2a91ee 100644 (file)
@@ -823,7 +823,7 @@ namespace OHOS
                 WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "强制发送文本: %s (长度: %zu)",
                               segment.c_str(), segment.length());
                 uapi_start_tts_single_txt((char *)segment.c_str());
-                LOS_Msleep(100);
+                // LOS_Msleep(100);
 
                 // 发送后清空累积文本
                 accumulatedText.clear();
@@ -857,7 +857,7 @@ namespace OHOS
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "按标点发送分段: %s (长度: %zu)",
                           segment.c_str(), segment.length());
             uapi_start_tts_single_txt((char *)segment.c_str());
-            LOS_Msleep(100);
+            // LOS_Msleep(100);
         }
 
         // 更新累积文本
@@ -1686,15 +1686,16 @@ namespace OHOS
         }
         else
         {
-            if(!AiVoiceModel::cur_ai_4g_answer_update)
-            {
-                AiVoiceModel::cur_ai_4g_answer_update = true;
-                if(AiVoiceModel::GetInstance().UpdateAiAnswerStr())
-                {
-                    AiVoiceModel::cur_ai_4g_answer_update = false;
-                    LOS_Msleep(10);
-                }
-            }
+            SendMsgToUIService(UI_UPDATE_AI_ANSWER_STR, 0, nullptr, 0);
+            // if(!AiVoiceModel::cur_ai_4g_answer_update)
+            // {
+            //     AiVoiceModel::cur_ai_4g_answer_update = true;
+            //     if(AiVoiceModel::GetInstance().UpdateAiAnswerStr())
+            //     {
+            //         AiVoiceModel::cur_ai_4g_answer_update = false;
+            //         LOS_Msleep(10);
+            //     }
+            // }
         }
     }
 
index 49d6f80..b284b62 100644 (file)
@@ -344,7 +344,7 @@ extern "C"
     TaskConfig GetServiceTaskConfig(Service *service)
     {
         (void)service;
-        TaskConfig config = {LEVEL_HIGH, PRI_NORMAL, DATA_DIST_STACK_SIZE, DATA_DIST_MAIL_LENGTH, SINGLE_TASK};
+        TaskConfig config = {LEVEL_HIGH, PRI_BELOW_NORMAL, DATA_DIST_STACK_SIZE, DATA_DIST_MAIL_LENGTH, SINGLE_TASK};
         return config;
     }
 
index 4ba80ef..cae2b19 100644 (file)
@@ -2451,11 +2451,15 @@ static void blesrvAi_send_service_task(void const *arg)
             {\r
                 // osal_msg_queue_write_head_copy(g_ble_Ai_record_queue, (void *)&mail,sizeof(blesrv_custom_cmd_t), 0);\r
                 int quesize = osal_msg_queue_get_msg_num(g_ble_Ai_record_queue);\r
-                WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"do_uart_slip_cmd quesize %d\n",quesize);\r
+                WEARABLE_LOGE(WEARABLE_LOG_MODULE_MAIN_SERVICE,"osal_msg_queue_get_msg_num %d\n",quesize);\r
                 while(quesize)\r
                 {\r
-                    osal_msg_queue_read_copy(g_ble_Ai_record_queue, (void *)&mail, &msgsize,\r
+                    ret = osal_msg_queue_read_copy(g_ble_Ai_record_queue, (void *)&mail, &msgsize,\r
                                         OSAL_MSGQ_WAIT_FOREVER);\r
+                    if (ret != OSAL_SUCCESS)\r
+                    {\r
+                        continue;\r
+                    }\r
                     if(mail.msg_data)\r
                     {\r
                         free(mail.msg_data);\r