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
+4 -4
View File
@@ -290,7 +290,7 @@ private:
}
[[nodiscard]] std::chrono::steady_clock::duration Delay() const noexcept override;
size_t Play(const void *chunk, size_t size) override;
std::size_t Play(std::span<const std::byte> src) override;
void Drain() override;
void Cancel() noexcept override;
@@ -828,8 +828,8 @@ PipeWireOutput::Delay() const noexcept
return result;
}
size_t
PipeWireOutput::Play(const void *chunk, size_t size)
std::size_t
PipeWireOutput::Play(std::span<const std::byte> src)
{
const PipeWire::ThreadLoopLock lock(thread_loop);
@@ -839,7 +839,7 @@ PipeWireOutput::Play(const void *chunk, size_t size)
CheckThrowError();
std::size_t bytes_written =
ring_buffer->push((const std::byte *)chunk, size);
ring_buffer->push(src.data(), src.size());
if (bytes_written > 0) {
drained = false;
return bytes_written;