output/httpd: add "pause" flag
Don't access AudioOutput::pause.
This commit is contained in:
parent
353299168a
commit
ae4b30a697
@ -60,6 +60,8 @@ class HttpdOutput final : ServerSocket, DeferredMonitor {
|
|||||||
*/
|
*/
|
||||||
bool open;
|
bool open;
|
||||||
|
|
||||||
|
bool pause;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The configured encoder plugin.
|
* The configured encoder plugin.
|
||||||
*/
|
*/
|
||||||
|
@ -261,6 +261,7 @@ HttpdOutput::Open(AudioFormat &audio_format)
|
|||||||
timer = new Timer(audio_format);
|
timer = new Timer(audio_format);
|
||||||
|
|
||||||
open = true;
|
open = true;
|
||||||
|
pause = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
@ -302,7 +303,7 @@ HttpdOutput::SendHeader(HttpdClient &client) const
|
|||||||
inline std::chrono::steady_clock::duration
|
inline std::chrono::steady_clock::duration
|
||||||
HttpdOutput::Delay() const noexcept
|
HttpdOutput::Delay() const noexcept
|
||||||
{
|
{
|
||||||
if (!LockHasClients() && base.pause) {
|
if (!LockHasClients() && pause) {
|
||||||
/* if there's no client and this output is paused,
|
/* if there's no client and this output is paused,
|
||||||
then httpd_output_pause() will not do anything, it
|
then httpd_output_pause() will not do anything, it
|
||||||
will not fill the buffer and it will not update the
|
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
|
inline size_t
|
||||||
HttpdOutput::Play(const void *chunk, size_t size)
|
HttpdOutput::Play(const void *chunk, size_t size)
|
||||||
{
|
{
|
||||||
|
pause = false;
|
||||||
|
|
||||||
if (LockHasClients())
|
if (LockHasClients())
|
||||||
EncodeAndPlay(chunk, size);
|
EncodeAndPlay(chunk, size);
|
||||||
|
|
||||||
@ -382,6 +385,8 @@ HttpdOutput::Play(const void *chunk, size_t size)
|
|||||||
bool
|
bool
|
||||||
HttpdOutput::Pause()
|
HttpdOutput::Pause()
|
||||||
{
|
{
|
||||||
|
pause = true;
|
||||||
|
|
||||||
if (LockHasClients()) {
|
if (LockHasClients()) {
|
||||||
static const char silence[1020] = { 0 };
|
static const char silence[1020] = { 0 };
|
||||||
Play(silence, sizeof(silence));
|
Play(silence, sizeof(silence));
|
||||||
|
Loading…
Reference in New Issue
Block a user