output/shout: move buffer to stack

This commit is contained in:
Max Kellermann 2022-07-12 09:47:18 +02:00
parent c55e250c45
commit 6b24344031
1 changed files with 4 additions and 6 deletions

View File

@ -71,8 +71,6 @@ struct ShoutOutput final : AudioOutput {
Encoder *encoder; Encoder *encoder;
uint8_t buffer[32768];
explicit ShoutOutput(const ConfigBlock &block); explicit ShoutOutput(const ConfigBlock &block);
~ShoutOutput() override; ~ShoutOutput() override;
@ -325,11 +323,11 @@ HandleShoutError(shout_t *shout_conn, int err)
} }
static void static void
EncoderToShout(shout_t *shout_conn, Encoder &encoder, EncoderToShout(shout_t *shout_conn, Encoder &encoder)
unsigned char *buffer, size_t buffer_size)
{ {
while (true) { 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) if (nbytes == 0)
return; return;
@ -343,7 +341,7 @@ ShoutOutput::WritePage()
{ {
assert(encoder != nullptr); assert(encoder != nullptr);
EncoderToShout(shout_conn, *encoder, buffer, sizeof(buffer)); EncoderToShout(shout_conn, *encoder);
} }
void void