Commit ae4b30a6 authored by Max Kellermann's avatar Max Kellermann

output/httpd: add "pause" flag

Don't access AudioOutput::pause.
parent 35329916
......@@ -60,6 +60,8 @@ class HttpdOutput final : ServerSocket, DeferredMonitor {
*/
bool open;
bool pause;
/**
* The configured encoder plugin.
*/
......
......@@ -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));
......
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