diff --git a/src/output/plugins/httpd/HttpdInternal.hxx b/src/output/plugins/httpd/HttpdInternal.hxx index 3a1ab1f2b..35268a8cd 100644 --- a/src/output/plugins/httpd/HttpdInternal.hxx +++ b/src/output/plugins/httpd/HttpdInternal.hxx @@ -60,6 +60,8 @@ class HttpdOutput final : ServerSocket, DeferredMonitor { */ bool open; + bool pause; + /** * The configured encoder plugin. */ diff --git a/src/output/plugins/httpd/HttpdOutputPlugin.cxx b/src/output/plugins/httpd/HttpdOutputPlugin.cxx index 31b44dea9..6836dc09a 100644 --- a/src/output/plugins/httpd/HttpdOutputPlugin.cxx +++ b/src/output/plugins/httpd/HttpdOutputPlugin.cxx @@ -261,6 +261,7 @@ HttpdOutput::Open(AudioFormat &audio_format) timer = new Timer(audio_format); open = true; + pause = false; } inline void @@ -302,7 +303,7 @@ HttpdOutput::SendHeader(HttpdClient &client) const inline std::chrono::steady_clock::duration HttpdOutput::Delay() const noexcept { - if (!LockHasClients() && base.pause) { + if (!LockHasClients() && pause) { /* if there's no client and this output is paused, then httpd_output_pause() will not do anything, it will not fill the buffer and it will not update the @@ -369,6 +370,8 @@ HttpdOutput::EncodeAndPlay(const void *chunk, size_t size) inline size_t HttpdOutput::Play(const void *chunk, size_t size) { + pause = false; + if (LockHasClients()) EncodeAndPlay(chunk, size); @@ -382,6 +385,8 @@ HttpdOutput::Play(const void *chunk, size_t size) bool HttpdOutput::Pause() { + pause = true; + if (LockHasClients()) { static const char silence[1020] = { 0 }; Play(silence, sizeof(silence));