增加播放限制在录音时不进行播放 2039/3
authorhcj <1224667075@qq.com>
Sat, 2 Aug 2025 07:36:44 +0000 (15:36 +0800)
committerhcj <1224667075@qq.com>
Sat, 2 Aug 2025 07:36:44 +0000 (15:36 +0800)
code/sdk/drivers/peripheral/slip/cat1Service/cat1_ai_server.cpp
code/sdk/middleware/services/media/foundation/sample/wrapper/voice_call_volte_sample_wrapper.cpp

index 6ffb35a..4a09f9a 100644 (file)
@@ -164,8 +164,8 @@ void uapi_UI_start_asr(uint8_t type)
     tts_break=1;
     tts_server_deinit();
     tts_reconnect=1;
-
     AIStreamFlush();
+    
     send_msg_data_into_Ai_msg_queue((uint8_t *)"tts_recv_buf",13,201);
 
    
@@ -1358,7 +1358,7 @@ void bk_websocket_tts(void *data) {
             memset_s(tts_recv_buf,1024*4,0,1024*4);
             int len=receive_websocket_message(tts_client,(unsigned char *)tts_recv_buf,1024*4,&type);
             // if(type==WS_CONT || 
-            if( type==WS_CLOSE || len==-1)//|| type==WS_CONT )
+            if( type==WS_CLOSE || len==-1 || tts_reconnect==1)//|| type==WS_CONT )
             {
                 printf("WS_lwip_close bk_websocket_tts\r\n");
                 break;
@@ -1789,6 +1789,8 @@ bool start_ai_voice_chat()
     active_md5_buf((char *)timestamp_str_2,md5_buf);
     printf("md5_buf:%s",md5_buf);
 
+    // 释放timestamp_str_2内存
+    free(timestamp_str_2);
 
      char jsonString[800]={0}; 
      sprintf(jsonString, "{ \
@@ -2072,6 +2074,8 @@ void voice_chat_websocket(void *data) {
         lwip_close_websocket_client(voice_chat_client);
         voice_chat_client=NULL;
 
+        // 释放voice_chat_client_buf内存
+        free(voice_chat_client_buf);
       
         // return;
     }
index 702b2a2..bfcfbdf 100755 (executable)
@@ -1454,18 +1454,18 @@ int32_t AIStreamWrite(uint8_t *buf, uint32_t size)
         uapi_set_tts_break(0);
         return -1;
     }
-    if(uapi_get_tts_break())
+    if(uapi_get_tts_break() && AudioCaptureTask_is_run)
     {
         MEDIA_ERR_LOG("uapi_get_tts_break");
         return -1;
     }
     
     // 原有流写入逻辑
-    if (g_stream_out_downink && RunVoiceCallVolteAI_is_ready)
+    if (g_stream_out_downink && RunVoiceCallVolteAI_is_ready && AudioCaptureTask_is_run!=1)
     {
     StreamWrite_retry:
 
-        if(uapi_get_tts_break())
+        if(uapi_get_tts_break() && AudioCaptureTask_is_run)
         {
             return -1;
         }