player/Thread: log message when decoder is too slow
This commit is contained in:
		
							
								
								
									
										2
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								NEWS
									
									
									
									
									
								
							@@ -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
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -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;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user