From d64106331f682c464b303e40b791ae59c821d8ff Mon Sep 17 00:00:00 2001 From: Hans-Kristian Arntzen Date: Sun, 15 Oct 2023 19:46:27 +0200 Subject: [PATCH] Report when realtime underflow happens. --- video/ffmpeg_decode.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/video/ffmpeg_decode.cpp b/video/ffmpeg_decode.cpp index 119f43f9..e43a586a 100644 --- a/video/ffmpeg_decode.cpp +++ b/video/ffmpeg_decode.cpp @@ -235,6 +235,10 @@ size_t AVFrameRingStream::accumulate_samples(float *const *channels, const float memset(tmp_resampler_ptrs[i], 0, required * sizeof(float)); } size_t accum = accumulate_samples_inner(tmp_resampler_ptrs, gain, required); + + if (accum < required) + LOGW("Underflow in audio thread (%zu < %zu).\n", accum, required); + for (unsigned i = 0; i < num_channels; i++) { resamplers[i]->set_sample_rate_ratio(ratio);