From 80fb29597d013b45090d14351484a9a7d30e80b5 Mon Sep 17 00:00:00 2001 From: Daniel Kulp Date: Mon, 5 Aug 2024 14:18:06 -0400 Subject: [PATCH] Make sure the final frames are flushed to the encoder. --- xLights/AudioManager.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/xLights/AudioManager.cpp b/xLights/AudioManager.cpp index 08a6b214f..11e1a1ad1 100644 --- a/xLights/AudioManager.cpp +++ b/xLights/AudioManager.cpp @@ -3511,6 +3511,10 @@ bool AudioManager::EncodeAudio(const std::vector& left_channel, #endif return false; } + if (sample_index >= left_channel.size()) { + // at the end, flush everything + avcodec_send_frame(codec_context, nullptr); + } // Receive the encoded packets while (ret >= 0) {