Browse Source

应该没有崩溃现象

xuxinyi 4 tháng trước cách đây
mục cha
commit
8c045e91fe
4 tập tin đã thay đổi với 10 bổ sung3 xóa
  1. BIN
      image.png
  2. 4 1
      log.md
  3. 4 2
      main/application.cc
  4. 2 0
      main/application.h

BIN
image.png


+ 4 - 1
log.md

@@ -149,4 +149,7 @@ I (380623) Application: <<
 你好啊!我是鹅大厨,扬州淮扬菜代表,来迎宾馆等你尝鲜!
 你好啊!我是鹅大厨,扬州淮扬菜代表,来迎宾馆等你尝鲜!
 I (380653) Adev_Codec: Open codec device OK
 I (380653) Adev_Codec: Open codec device OK
 I (380653) AudioCodec: Set output enable to true
 I (380653) AudioCodec: Set output enable to true
-I (387653) Application: STATE: listening
+I (387653) Application: STATE: listening
+
+
+![alt text](image.png)

+ 4 - 2
main/application.cc

@@ -842,10 +842,12 @@ void Application::SetDeviceState(DeviceState state) {
             display->SetEmotion("neutral");
             display->SetEmotion("neutral");
             ResetDecoder();
             ResetDecoder();
             vTaskDelay(pdMS_TO_TICKS(1000));//这里的延迟可以避免音频处理芯片异常时候,导致程序崩溃。但是还是没解决音频异常后的处理。
             vTaskDelay(pdMS_TO_TICKS(1000));//这里的延迟可以避免音频处理芯片异常时候,导致程序崩溃。但是还是没解决音频异常后的处理。
-            opus_encoder_->ResetState();
+            if (!lintening_flag_){
+                opus_encoder_->ResetState();
 #if CONFIG_USE_AUDIO_PROCESSOR
 #if CONFIG_USE_AUDIO_PROCESSOR
-            audio_processor_.Start();
+                audio_processor_.Start();
 #endif
 #endif
+            }
             UpdateIotStates();
             UpdateIotStates();
             if (previous_state == kDeviceStateSpeaking) {
             if (previous_state == kDeviceStateSpeaking) {
                 // FIXME: Wait for the speaker to empty the buffer
                 // FIXME: Wait for the speaker to empty the buffer

+ 2 - 0
main/application.h

@@ -95,6 +95,8 @@ private:
     bool voice_detected_ = false;
     bool voice_detected_ = false;
     int clock_ticks_ = 0;
     int clock_ticks_ = 0;
 
 
+    bool lintening_flag_ = false; //测试,用于打断时候的lintening,防止多次start编解码器
+
     // Audio encode / decode
     // Audio encode / decode
     BackgroundTask* background_task_ = nullptr;
     BackgroundTask* background_task_ = nullptr;
     std::chrono::steady_clock::time_point last_output_time_;
     std::chrono::steady_clock::time_point last_output_time_;