From aa7efd3d5bd1202c8b5754843ad77482acfdcc7e Mon Sep 17 00:00:00 2001 From: casey langen Date: Sun, 14 Mar 2021 22:24:48 -0700 Subject: [PATCH] Fix pointer arithmetic --- src/plugins/pipewireout/PipeWireOut.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/plugins/pipewireout/PipeWireOut.cpp b/src/plugins/pipewireout/PipeWireOut.cpp index bdd80033d..4437e02a4 100644 --- a/src/plugins/pipewireout/PipeWireOut.cpp +++ b/src/plugins/pipewireout/PipeWireOut.cpp @@ -71,7 +71,7 @@ void PipeWireOut::OnStreamProcess(void* data) { struct spa_buffer* spaBuffer = pwBuffer->buffer; auto& outBufferData = spaBuffer->datas[0]; - void* outBufferPtr = outBufferData.data; + char* outBufferPtr = (char*) outBufferData.data; uint32_t outBufferRemaining = outBufferData.maxsize; int channelCount = 2; @@ -82,7 +82,7 @@ void PipeWireOut::OnStreamProcess(void* data) { BufferContext* inputBufferContext = nullptr; uint32_t inBufferSize = 0; uint32_t inBufferRemaining = 0; - void* inBufferPtr; + char* inBufferPtr; uint32_t bytesToCopy = 0; std::cerr << "[PipeWire] " << outBufferRemaining << " bytes still need to be filled...\n"; @@ -103,7 +103,7 @@ void PipeWireOut::OnStreamProcess(void* data) { channelCount = inputBufferContext->buffer->Channels(); inBufferSize = (uint32_t) inputBufferContext->buffer->Bytes(); inBufferRemaining = inputBufferContext->remaining; - inBufferPtr = inputBufferContext->buffer->BufferPointer(); + inBufferPtr = (char*) inputBufferContext->buffer->BufferPointer(); if (outBufferRemaining >= inBufferRemaining) { self->buffers.pop_front(); @@ -133,7 +133,7 @@ void PipeWireOut::OnStreamProcess(void* data) { outBufferData.chunk->offset = 0; outBufferData.chunk->stride = frameSize; outBufferData.chunk->size = outBufferData.maxsize; - pwBuffer->size = outBufferData.maxsize; + pwBuffer->size = outBufferData.maxsize / frameSize; pw_stream_queue_buffer(self->pwStream, pwBuffer);