Commit f780ac41 authored by Max Kellermann's avatar Max Kellermann

output/alsa: log when generating silence due to slow decoder

MPD used to do that when this code lived in the player thread, but it was removed by commit 98a7c62d; and the replacement code in the ALSA output plugin didn't have it.
parent 61a72a5d
...@@ -7,6 +7,7 @@ ver 0.21.11 (not yet released) ...@@ -7,6 +7,7 @@ ver 0.21.11 (not yet released)
- alsa: fix busy loop while draining - alsa: fix busy loop while draining
- alsa: fix missing drain call - alsa: fix missing drain call
- alsa: improve xrun-avoiding silence generator - alsa: improve xrun-avoiding silence generator
- alsa: log when generating silence due to slow decoder
- alsa, osx: fix distortions with DSD_U32 and DoP on 32 bit CPUs - alsa, osx: fix distortions with DSD_U32 and DoP on 32 bit CPUs
* protocol * protocol
- fix "list" with multiple "group" levels - fix "list" with multiple "group" levels
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "../OutputAPI.hxx" #include "../OutputAPI.hxx"
#include "mixer/MixerList.hxx" #include "mixer/MixerList.hxx"
#include "pcm/PcmExport.hxx" #include "pcm/PcmExport.hxx"
#include "system/PeriodClock.hxx"
#include "thread/Mutex.hxx" #include "thread/Mutex.hxx"
#include "thread/Cond.hxx" #include "thread/Cond.hxx"
#include "util/Manual.hxx" #include "util/Manual.hxx"
...@@ -65,6 +66,8 @@ class AlsaOutput final ...@@ -65,6 +66,8 @@ class AlsaOutput final
*/ */
TimerEvent silence_timer; TimerEvent silence_timer;
PeriodClock throttle_silence_log;
Manual<PcmExport> pcm_export; Manual<PcmExport> pcm_export;
/** /**
...@@ -1073,6 +1076,9 @@ try { ...@@ -1073,6 +1076,9 @@ try {
return; return;
} }
if (throttle_silence_log.CheckUpdate(std::chrono::seconds(5)))
FormatWarning(alsa_output_domain, "Decoder is too slow; playing silence to avoid xrun");
/* insert some silence if the buffer has not enough /* insert some silence if the buffer has not enough
data yet, to avoid ALSA xrun */ data yet, to avoid ALSA xrun */
period_buffer.FillWithSilence(silence, out_frame_size); period_buffer.FillWithSilence(silence, out_frame_size);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment