util/CircularBuffer: use std::span
This commit is contained in:
@@ -240,7 +240,7 @@ AlsaInputStream::DispatchSockets() noexcept
|
||||
const std::scoped_lock<Mutex> protect(mutex);
|
||||
|
||||
auto w = PrepareWriteBuffer();
|
||||
const snd_pcm_uframes_t w_frames = w.size / frame_size;
|
||||
const snd_pcm_uframes_t w_frames = w.size() / frame_size;
|
||||
if (w_frames == 0) {
|
||||
/* buffer is full */
|
||||
Pause();
|
||||
@@ -249,7 +249,7 @@ AlsaInputStream::DispatchSockets() noexcept
|
||||
|
||||
snd_pcm_sframes_t n_frames;
|
||||
while ((n_frames = snd_pcm_readi(capture_handle,
|
||||
w.data, w_frames)) < 0) {
|
||||
w.data(), w_frames)) < 0) {
|
||||
if (n_frames == -EAGAIN)
|
||||
return;
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ UringInputStream::SubmitRead() noexcept
|
||||
|
||||
read_operation = std::make_unique<Uring::ReadOperation>();
|
||||
read_operation->Start(uring, fd, next_offset,
|
||||
std::min(w.size, URING_MAX_READ),
|
||||
std::min(w.size(), URING_MAX_READ),
|
||||
*this);
|
||||
}
|
||||
|
||||
@@ -158,8 +158,8 @@ UringInputStream::OnRead(std::unique_ptr<std::byte[]> data,
|
||||
}
|
||||
|
||||
auto w = PrepareWriteBuffer();
|
||||
assert(w.size >= nbytes);
|
||||
memcpy(w.data, data.get(), nbytes);
|
||||
assert(w.size() >= nbytes);
|
||||
memcpy(w.data(), data.get(), nbytes);
|
||||
CommitWriteBuffer(nbytes);
|
||||
next_offset += nbytes;
|
||||
SubmitRead();
|
||||
|
||||
Reference in New Issue
Block a user