Fixed an issue where the tail of the sound might be truncated in auto mode. (#1675)
This commit is contained in:
@ -740,6 +740,13 @@ bool AudioService::IsIdle() {
|
||||
return audio_encode_queue_.empty() && audio_decode_queue_.empty() && audio_playback_queue_.empty() && audio_testing_queue_.empty();
|
||||
}
|
||||
|
||||
void AudioService::WaitForPlaybackQueueEmpty() {
|
||||
std::unique_lock<std::mutex> lock(audio_queue_mutex_);
|
||||
audio_queue_cv_.wait(lock, [this]() {
|
||||
return service_stopped_ || (audio_decode_queue_.empty() && audio_playback_queue_.empty());
|
||||
});
|
||||
}
|
||||
|
||||
void AudioService::ResetDecoder() {
|
||||
std::lock_guard<std::mutex> lock(audio_queue_mutex_);
|
||||
std::unique_lock<std::mutex> decoder_lock(decoder_mutex_);
|
||||
|
||||
@ -115,6 +115,7 @@ public:
|
||||
const std::string& GetLastWakeWord() const;
|
||||
bool IsVoiceDetected() const { return voice_detected_; }
|
||||
bool IsIdle();
|
||||
void WaitForPlaybackQueueEmpty();
|
||||
bool IsWakeWordRunning() const { return xEventGroupGetBits(event_group_) & AS_EVENT_WAKE_WORD_RUNNING; }
|
||||
bool IsAudioProcessorRunning() const { return xEventGroupGetBits(event_group_) & AS_EVENT_AUDIO_PROCESSOR_RUNNING; }
|
||||
bool IsAfeWakeWord();
|
||||
|
||||
Reference in New Issue
Block a user