Commit 28e864e0 authored by Max Kellermann's avatar Max Kellermann

player/Thread: log message when decoder is too slow

parent 1de19b92
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
......
...@@ -32,6 +32,7 @@ ...@@ -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 { ...@@ -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() ...@@ -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() ...@@ -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;
} }
......
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