From 6b24344031690778cd5d7438348133eed0a0dbfe Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 12 Jul 2022 09:47:18 +0200 Subject: [PATCH] output/shout: move buffer to stack --- src/output/plugins/ShoutOutputPlugin.cxx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/output/plugins/ShoutOutputPlugin.cxx b/src/output/plugins/ShoutOutputPlugin.cxx index 57271b850..0ddf3cfcf 100644 --- a/src/output/plugins/ShoutOutputPlugin.cxx +++ b/src/output/plugins/ShoutOutputPlugin.cxx @@ -71,8 +71,6 @@ struct ShoutOutput final : AudioOutput { Encoder *encoder; - uint8_t buffer[32768]; - explicit ShoutOutput(const ConfigBlock &block); ~ShoutOutput() override; @@ -325,11 +323,11 @@ HandleShoutError(shout_t *shout_conn, int err) } static void -EncoderToShout(shout_t *shout_conn, Encoder &encoder, - unsigned char *buffer, size_t buffer_size) +EncoderToShout(shout_t *shout_conn, Encoder &encoder) { while (true) { - size_t nbytes = encoder.Read(buffer, buffer_size); + uint8_t buffer[32768]; + size_t nbytes = encoder.Read(buffer, sizeof(buffer)); if (nbytes == 0) return; @@ -343,7 +341,7 @@ ShoutOutput::WritePage() { assert(encoder != nullptr); - EncoderToShout(shout_conn, *encoder, buffer, sizeof(buffer)); + EncoderToShout(shout_conn, *encoder); } void