|
@@ -673,11 +673,11 @@ void Application::ResetDecoder() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void Application::OutputAudio() {
|
|
void Application::OutputAudio() {
|
|
|
- auto now = std::chrono::steady_clock::now();
|
|
|
|
|
|
|
+ auto now = std::chrono::steady_clock::now(); //获取当前时间点的函数
|
|
|
auto codec = Board::GetInstance().GetAudioCodec();
|
|
auto codec = Board::GetInstance().GetAudioCodec();
|
|
|
const int max_silence_seconds = 10;
|
|
const int max_silence_seconds = 10;
|
|
|
|
|
|
|
|
- std::unique_lock<std::mutex> lock(mutex_);
|
|
|
|
|
|
|
+ std::unique_lock<std::mutex> lock(mutex_); //是 C++ 中用于线程同步的互斥锁(Mutex),用于保护共享资源,防止多个线程同时访问导致数据竞争(Data Race)
|
|
|
if (audio_decode_queue_.empty()) {
|
|
if (audio_decode_queue_.empty()) {
|
|
|
// Disable the output if there is no audio data for a long time
|
|
// Disable the output if there is no audio data for a long time
|
|
|
if (device_state_ == kDeviceStateIdle) {
|
|
if (device_state_ == kDeviceStateIdle) {
|