player/Thread: remove obsolete buffered_before_play attribute

This commit is contained in:
Max Kellermann
2018-09-23 15:47:20 +02:00
parent 5b2374b949
commit 8c638c50a3
7 changed files with 1 additions and 45 deletions

View File

@@ -124,8 +124,6 @@ static constexpr
size_t MIN_BUFFER_SIZE = std::max(CHUNK_SIZE * 32,
64 * KILOBYTE);
static constexpr unsigned DEFAULT_BUFFER_BEFORE_PLAY = 10;
#ifdef ANDROID
Context *context;
LogListener *logListener;
@@ -305,37 +303,6 @@ initialize_decoder_and_player(const ConfigData &config,
throw FormatRuntimeError("buffer size \"%lu\" is too big",
(unsigned long)buffer_size);
float perc;
param = config.GetParam(ConfigOption::BUFFER_BEFORE_PLAY);
if (param != nullptr) {
char *test;
perc = strtod(param->value.c_str(), &test);
if (*test != '%' || perc < 0 || perc > 100) {
throw FormatRuntimeError("buffered before play \"%s\" is not "
"a positive percentage and less "
"than 100 percent, line %i",
param->value.c_str(), param->line);
}
if (perc > 80) {
/* this upper limit should avoid deadlocks
which can occur because the DecoderThread
cannot ever fill the music buffer to
exactly 100%; a few chunks always need to
be available to generate silence in
Player::SendSilence() */
FormatError(config_domain,
"buffer_before_play is too large (%f%%), capping at 80%%; please fix your configuration",
perc);
perc = 80;
}
} else
perc = DEFAULT_BUFFER_BEFORE_PLAY;
unsigned buffered_before_play = (perc / 100) * buffered_chunks;
if (buffered_before_play > buffered_chunks)
buffered_before_play = buffered_chunks;
const unsigned max_length =
config.GetPositive(ConfigOption::MAX_PLAYLIST_LENGTH,
DEFAULT_PLAYLIST_MAX_LENGTH);
@@ -356,7 +323,6 @@ initialize_decoder_and_player(const ConfigData &config,
"default",
max_length,
buffered_chunks,
buffered_before_play,
configured_audio_format,
replay_gain_config);
auto &partition = instance->partitions.back();

View File

@@ -29,7 +29,6 @@ Partition::Partition(Instance &_instance,
const char *_name,
unsigned max_length,
unsigned buffer_chunks,
unsigned buffered_before_play,
AudioFormat configured_audio_format,
const ReplayGainConfig &replay_gain_config)
:instance(_instance),
@@ -38,7 +37,7 @@ Partition::Partition(Instance &_instance,
global_events(instance.event_loop, BIND_THIS_METHOD(OnGlobalEvent)),
playlist(max_length, *this),
outputs(*this),
pc(*this, outputs, buffer_chunks, buffered_before_play,
pc(*this, outputs, buffer_chunks,
configured_audio_format, replay_gain_config)
{
UpdateEffectiveReplayGainMode();

View File

@@ -69,7 +69,6 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
const char *_name,
unsigned max_length,
unsigned buffer_chunks,
unsigned buffered_before_play,
AudioFormat configured_audio_format,
const ReplayGainConfig &replay_gain_config);

View File

@@ -102,7 +102,6 @@ handle_newpartition(Client &client, Request request, Response &response)
// TODO: use real configuration
16384,
1024,
128,
AudioFormat::Undefined(),
ReplayGainConfig());
auto &partition = instance.partitions.back();

View File

@@ -30,12 +30,10 @@
PlayerControl::PlayerControl(PlayerListener &_listener,
PlayerOutputs &_outputs,
unsigned _buffer_chunks,
unsigned _buffered_before_play,
AudioFormat _configured_audio_format,
const ReplayGainConfig &_replay_gain_config) noexcept
:listener(_listener), outputs(_outputs),
buffer_chunks(_buffer_chunks),
buffered_before_play(_buffered_before_play),
configured_audio_format(_configured_audio_format),
thread(BIND_THIS_METHOD(RunThread)),
replay_gain_config(_replay_gain_config)

View File

@@ -118,8 +118,6 @@ class PlayerControl final : public AudioOutputClient {
const unsigned buffer_chunks;
const unsigned buffered_before_play;
/**
* The "audio_output_format" setting.
*/
@@ -237,7 +235,6 @@ public:
PlayerControl(PlayerListener &_listener,
PlayerOutputs &_outputs,
unsigned buffer_chunks,
unsigned buffered_before_play,
AudioFormat _configured_audio_format,
const ReplayGainConfig &_replay_gain_config) noexcept;
~PlayerControl() noexcept;