player/Thread: log message when decoder is too slow

This commit is contained in:
Max Kellermann 2017-10-25 20:26:09 +02:00
parent 1de19b921a
commit 28e864e096
2 changed files with 11 additions and 0 deletions

2
NEWS
View File

@ -1,6 +1,8 @@
ver 0.20.12 (not yet released) ver 0.20.12 (not yet released)
* input * input
- curl: fix seeking - curl: fix seeking
* player
- log message when decoder is too slow
ver 0.20.11 (2017/10/18) ver 0.20.11 (2017/10/18)
* storage * storage

View File

@ -32,6 +32,7 @@
#include "output/MultipleOutputs.hxx" #include "output/MultipleOutputs.hxx"
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
#include "Idle.hxx" #include "Idle.hxx"
#include "system/PeriodClock.hxx"
#include "util/Domain.hxx" #include "util/Domain.hxx"
#include "thread/Name.hxx" #include "thread/Name.hxx"
#include "Log.hxx" #include "Log.hxx"
@ -146,6 +147,8 @@ class Player {
*/ */
SongTime elapsed_time; SongTime elapsed_time;
PeriodClock throttle_silence_log;
public: public:
Player(PlayerControl &_pc, DecoderControl &_dc, Player(PlayerControl &_pc, DecoderControl &_dc,
MusicBuffer &_buffer) MusicBuffer &_buffer)
@ -934,6 +937,8 @@ Player::SongBorder()
{ {
FormatDefault(player_domain, "played \"%s\"", song->GetURI()); FormatDefault(player_domain, "played \"%s\"", song->GetURI());
throttle_silence_log.Reset();
ReplacePipe(dc.pipe); ReplacePipe(dc.pipe);
pc.outputs.SongBorder(); pc.outputs.SongBorder();
@ -1095,6 +1100,10 @@ Player::Run()
/* the decoder is too busy and hasn't provided /* the decoder is too busy and hasn't provided
new PCM data in time: send silence (if the new PCM data in time: send silence (if the
output pipe is empty) */ output pipe is empty) */
if (throttle_silence_log.CheckUpdate(std::chrono::seconds(5)))
FormatWarning(player_domain, "Decoder is too slow; playing silence to avoid xrun");
if (!SendSilence()) if (!SendSilence())
break; break;
} }