test/run_filter: pass ConstBuffer<void> to FullWrite()
This commit is contained in:
parent
9617bd6c85
commit
b0a04b3da8
|
@ -95,20 +95,23 @@ FullRead(FileDescriptor fd, void *_buffer, size_t size)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
FullWrite(FileDescriptor fd, const void *_buffer, size_t size)
|
FullWrite(FileDescriptor fd, ConstBuffer<uint8_t> src)
|
||||||
{
|
{
|
||||||
auto buffer = (const uint8_t *)_buffer;
|
while (!src.empty()) {
|
||||||
|
size_t nbytes = WriteOrThrow(fd, src.data, src.size);
|
||||||
while (size > 0) {
|
|
||||||
size_t nbytes = WriteOrThrow(fd, buffer, size);
|
|
||||||
if (nbytes == 0)
|
if (nbytes == 0)
|
||||||
throw std::runtime_error("Write failed");
|
throw std::runtime_error("Write failed");
|
||||||
|
|
||||||
buffer += nbytes;
|
src.skip_front(nbytes);
|
||||||
size -= nbytes;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
FullWrite(FileDescriptor fd, ConstBuffer<void> src)
|
||||||
|
{
|
||||||
|
FullWrite(fd, ConstBuffer<uint8_t>::FromVoid(src));
|
||||||
|
}
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
ReadFrames(FileDescriptor fd, void *_buffer, size_t size, size_t frame_size)
|
ReadFrames(FileDescriptor fd, void *_buffer, size_t size, size_t frame_size)
|
||||||
{
|
{
|
||||||
|
@ -177,7 +180,7 @@ try {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
auto dest = filter->FilterPCM({(const void *)buffer, (size_t)nbytes});
|
auto dest = filter->FilterPCM({(const void *)buffer, (size_t)nbytes});
|
||||||
FullWrite(output_fd, dest.data, dest.size);
|
FullWrite(output_fd, dest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* cleanup and exit */
|
/* cleanup and exit */
|
||||||
|
|
Loading…
Reference in New Issue