forked from xiaozhi/xiaozhi-esp32
将项目版本更新至1.5.9,优化内存使用,增加主任务栈大小至8192,优化固件升级流程,重构主循环为MainEventLoop,添加新版本检查功能,更新音频编解码器的DMA配置常量。
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <condition_variable>
|
||||
|
||||
#include <opus_encoder.h>
|
||||
#include <opus_decoder.h>
|
||||
@@ -28,6 +30,7 @@
|
||||
#define SCHEDULE_EVENT (1 << 0)
|
||||
#define AUDIO_INPUT_READY_EVENT (1 << 1)
|
||||
#define AUDIO_OUTPUT_READY_EVENT (1 << 2)
|
||||
#define CHECK_NEW_VERSION_DONE_EVENT (1 << 3)
|
||||
|
||||
enum DeviceState {
|
||||
kDeviceStateUnknown,
|
||||
@@ -97,7 +100,6 @@ private:
|
||||
bool aborted_ = false;
|
||||
bool voice_detected_ = false;
|
||||
int clock_ticks_ = 0;
|
||||
TaskHandle_t main_loop_task_handle_ = nullptr;
|
||||
TaskHandle_t check_new_version_task_handle_ = nullptr;
|
||||
|
||||
// Audio encode / decode
|
||||
@@ -105,6 +107,7 @@ private:
|
||||
BackgroundTask* background_task_ = nullptr;
|
||||
std::chrono::steady_clock::time_point last_output_time_;
|
||||
std::list<std::vector<uint8_t>> audio_decode_queue_;
|
||||
std::condition_variable audio_decode_cv_;
|
||||
|
||||
std::unique_ptr<OpusEncoderWrapper> opus_encoder_;
|
||||
std::unique_ptr<OpusDecoderWrapper> opus_decoder_;
|
||||
@@ -113,7 +116,7 @@ private:
|
||||
OpusResampler reference_resampler_;
|
||||
OpusResampler output_resampler_;
|
||||
|
||||
void MainLoop();
|
||||
void MainEventLoop();
|
||||
void OnAudioInput();
|
||||
void OnAudioOutput();
|
||||
void ReadAudio(std::vector<int16_t>& data, int sample_rate, int samples);
|
||||
|
||||
Reference in New Issue
Block a user