From 8c638c50a31b8931acded3ddf6300420ce6e91f6 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 23 Sep 2018 15:47:20 +0200 Subject: [PATCH] player/Thread: remove obsolete `buffered_before_play` attribute --- doc/user.rst | 2 -- src/Main.cxx | 34 ------------------------------- src/Partition.cxx | 3 +-- src/Partition.hxx | 1 - src/command/PartitionCommands.cxx | 1 - src/player/Control.cxx | 2 -- src/player/Control.hxx | 3 --- 7 files changed, 1 insertion(+), 45 deletions(-) diff --git a/doc/user.rst b/doc/user.rst index e8a6fdc7d..872afe020 100644 --- a/doc/user.rst +++ b/doc/user.rst @@ -575,8 +575,6 @@ Do not change these unless you know what you are doing. - Description * - **audio_buffer_size KBYTES** - 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 ~~~~~~~~ diff --git a/src/Main.cxx b/src/Main.cxx index 93b87a1ce..12340bc7d 100644 --- a/src/Main.cxx +++ b/src/Main.cxx @@ -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(); diff --git a/src/Partition.cxx b/src/Partition.cxx index 5b1c4821d..a8a74ec2c 100644 --- a/src/Partition.cxx +++ b/src/Partition.cxx @@ -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(); diff --git a/src/Partition.hxx b/src/Partition.hxx index 83a0ec69a..38051c7f5 100644 --- a/src/Partition.hxx +++ b/src/Partition.hxx @@ -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); diff --git a/src/command/PartitionCommands.cxx b/src/command/PartitionCommands.cxx index e7e8a0608..e3de9677f 100644 --- a/src/command/PartitionCommands.cxx +++ b/src/command/PartitionCommands.cxx @@ -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(); diff --git a/src/player/Control.cxx b/src/player/Control.cxx index 0b8a695e7..b9a2cfc01 100644 --- a/src/player/Control.cxx +++ b/src/player/Control.cxx @@ -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) diff --git a/src/player/Control.hxx b/src/player/Control.hxx index 3bcb05d58..c3ff23def 100644 --- a/src/player/Control.hxx +++ b/src/player/Control.hxx @@ -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;