Commit 8c638c50 authored by Max Kellermann's avatar Max Kellermann

player/Thread: remove obsolete `buffered_before_play` attribute

parent 5b2374b9
...@@ -575,8 +575,6 @@ Do not change these unless you know what you are doing. ...@@ -575,8 +575,6 @@ Do not change these unless you know what you are doing.
- Description - Description
* - **audio_buffer_size KBYTES** * - **audio_buffer_size KBYTES**
- Adjust the size of the internal audio buffer. Default is 4096 (4 MiB). - Adjust the size of the internal audio buffer. Default is 4096 (4 MiB).
* - **buffer_before_play PERCENT**
- Control the percentage of the buffer which is filled before beginning to play. Increasing this reduces the chance of audio file skipping, at the cost of increased time prior to audio playback. Default is 10%.
Zeroconf Zeroconf
~~~~~~~~ ~~~~~~~~
......
...@@ -124,8 +124,6 @@ static constexpr ...@@ -124,8 +124,6 @@ static constexpr
size_t MIN_BUFFER_SIZE = std::max(CHUNK_SIZE * 32, size_t MIN_BUFFER_SIZE = std::max(CHUNK_SIZE * 32,
64 * KILOBYTE); 64 * KILOBYTE);
static constexpr unsigned DEFAULT_BUFFER_BEFORE_PLAY = 10;
#ifdef ANDROID #ifdef ANDROID
Context *context; Context *context;
LogListener *logListener; LogListener *logListener;
...@@ -305,37 +303,6 @@ initialize_decoder_and_player(const ConfigData &config, ...@@ -305,37 +303,6 @@ initialize_decoder_and_player(const ConfigData &config,
throw FormatRuntimeError("buffer size \"%lu\" is too big", throw FormatRuntimeError("buffer size \"%lu\" is too big",
(unsigned long)buffer_size); (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 = const unsigned max_length =
config.GetPositive(ConfigOption::MAX_PLAYLIST_LENGTH, config.GetPositive(ConfigOption::MAX_PLAYLIST_LENGTH,
DEFAULT_PLAYLIST_MAX_LENGTH); DEFAULT_PLAYLIST_MAX_LENGTH);
...@@ -356,7 +323,6 @@ initialize_decoder_and_player(const ConfigData &config, ...@@ -356,7 +323,6 @@ initialize_decoder_and_player(const ConfigData &config,
"default", "default",
max_length, max_length,
buffered_chunks, buffered_chunks,
buffered_before_play,
configured_audio_format, configured_audio_format,
replay_gain_config); replay_gain_config);
auto &partition = instance->partitions.back(); auto &partition = instance->partitions.back();
......
...@@ -29,7 +29,6 @@ Partition::Partition(Instance &_instance, ...@@ -29,7 +29,6 @@ Partition::Partition(Instance &_instance,
const char *_name, const char *_name,
unsigned max_length, unsigned max_length,
unsigned buffer_chunks, unsigned buffer_chunks,
unsigned buffered_before_play,
AudioFormat configured_audio_format, AudioFormat configured_audio_format,
const ReplayGainConfig &replay_gain_config) const ReplayGainConfig &replay_gain_config)
:instance(_instance), :instance(_instance),
...@@ -38,7 +37,7 @@ Partition::Partition(Instance &_instance, ...@@ -38,7 +37,7 @@ Partition::Partition(Instance &_instance,
global_events(instance.event_loop, BIND_THIS_METHOD(OnGlobalEvent)), global_events(instance.event_loop, BIND_THIS_METHOD(OnGlobalEvent)),
playlist(max_length, *this), playlist(max_length, *this),
outputs(*this), outputs(*this),
pc(*this, outputs, buffer_chunks, buffered_before_play, pc(*this, outputs, buffer_chunks,
configured_audio_format, replay_gain_config) configured_audio_format, replay_gain_config)
{ {
UpdateEffectiveReplayGainMode(); UpdateEffectiveReplayGainMode();
......
...@@ -69,7 +69,6 @@ struct Partition final : QueueListener, PlayerListener, MixerListener { ...@@ -69,7 +69,6 @@ struct Partition final : QueueListener, PlayerListener, MixerListener {
const char *_name, const char *_name,
unsigned max_length, unsigned max_length,
unsigned buffer_chunks, unsigned buffer_chunks,
unsigned buffered_before_play,
AudioFormat configured_audio_format, AudioFormat configured_audio_format,
const ReplayGainConfig &replay_gain_config); const ReplayGainConfig &replay_gain_config);
......
...@@ -102,7 +102,6 @@ handle_newpartition(Client &client, Request request, Response &response) ...@@ -102,7 +102,6 @@ handle_newpartition(Client &client, Request request, Response &response)
// TODO: use real configuration // TODO: use real configuration
16384, 16384,
1024, 1024,
128,
AudioFormat::Undefined(), AudioFormat::Undefined(),
ReplayGainConfig()); ReplayGainConfig());
auto &partition = instance.partitions.back(); auto &partition = instance.partitions.back();
......
...@@ -30,12 +30,10 @@ ...@@ -30,12 +30,10 @@
PlayerControl::PlayerControl(PlayerListener &_listener, PlayerControl::PlayerControl(PlayerListener &_listener,
PlayerOutputs &_outputs, PlayerOutputs &_outputs,
unsigned _buffer_chunks, unsigned _buffer_chunks,
unsigned _buffered_before_play,
AudioFormat _configured_audio_format, AudioFormat _configured_audio_format,
const ReplayGainConfig &_replay_gain_config) noexcept const ReplayGainConfig &_replay_gain_config) noexcept
:listener(_listener), outputs(_outputs), :listener(_listener), outputs(_outputs),
buffer_chunks(_buffer_chunks), buffer_chunks(_buffer_chunks),
buffered_before_play(_buffered_before_play),
configured_audio_format(_configured_audio_format), configured_audio_format(_configured_audio_format),
thread(BIND_THIS_METHOD(RunThread)), thread(BIND_THIS_METHOD(RunThread)),
replay_gain_config(_replay_gain_config) replay_gain_config(_replay_gain_config)
......
...@@ -118,8 +118,6 @@ class PlayerControl final : public AudioOutputClient { ...@@ -118,8 +118,6 @@ class PlayerControl final : public AudioOutputClient {
const unsigned buffer_chunks; const unsigned buffer_chunks;
const unsigned buffered_before_play;
/** /**
* The "audio_output_format" setting. * The "audio_output_format" setting.
*/ */
...@@ -237,7 +235,6 @@ public: ...@@ -237,7 +235,6 @@ public:
PlayerControl(PlayerListener &_listener, PlayerControl(PlayerListener &_listener,
PlayerOutputs &_outputs, PlayerOutputs &_outputs,
unsigned buffer_chunks, unsigned buffer_chunks,
unsigned buffered_before_play,
AudioFormat _configured_audio_format, AudioFormat _configured_audio_format,
const ReplayGainConfig &_replay_gain_config) noexcept; const ReplayGainConfig &_replay_gain_config) noexcept;
~PlayerControl() noexcept; ~PlayerControl() noexcept;
......
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