output/Interface: pass std::span to Play()

This commit is contained in:
Max Kellermann
2022-07-12 12:31:35 +02:00
parent f5d104e7af
commit 45071607aa
29 changed files with 138 additions and 141 deletions

View File

@@ -309,19 +309,19 @@ HttpdOutput::EncodeAndPlay(std::span<const std::byte> src)
BroadcastFromEncoder();
}
size_t
HttpdOutput::Play(const void *chunk, size_t size)
std::size_t
HttpdOutput::Play(std::span<const std::byte> src)
{
pause = false;
if (LockHasClients())
EncodeAndPlay({(const std::byte *)chunk, size});
EncodeAndPlay(src);
if (!timer->IsStarted())
timer->Start();
timer->Add(size);
timer->Add(src.size());
return size;
return src.size();
}
bool
@@ -330,8 +330,8 @@ HttpdOutput::Pause()
pause = true;
if (LockHasClients()) {
static const char silence[1020] = { 0 };
Play(silence, sizeof(silence));
static constexpr std::byte silence[1020]{};
Play(std::span{silence});
}
return true;