From 1725739d9156ca134be27851ecca6b336d1d4010 Mon Sep 17 00:00:00 2001 From: Wojciech Kozyra Date: Fri, 29 Nov 2024 15:57:11 +0100 Subject: [PATCH] Move OPUS decoder buffer to heap --- build_tools/nix/flake.lock | 20 +++++++++---------- .../src/pipeline/decoder/audio/opus.rs | 4 ++-- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/build_tools/nix/flake.lock b/build_tools/nix/flake.lock index cee05f05e..9aeda3d74 100644 --- a/build_tools/nix/flake.lock +++ b/build_tools/nix/flake.lock @@ -5,11 +5,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1722555600, - "narHash": "sha256-XOQkdLafnb/p9ij77byFQjDf5m5QYl9b2REiVClC+x4=", + "lastModified": 1730504689, + "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "8471fe90ad337a8074e957b69ca4d0089218391d", + "rev": "506278e768c2a08bec68eb62932193e341f55c90", "type": "github" }, "original": { @@ -19,11 +19,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1723175592, - "narHash": "sha256-M0xJ3FbDUc4fRZ84dPGx5VvgFsOzds77KiBMW/mMTnI=", + "lastModified": 1732521221, + "narHash": "sha256-2ThgXBUXAE1oFsVATK1ZX9IjPcS4nKFOAjhPNKuiMn0=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5e0ca22929f3342b19569b21b2f3462f053e497b", + "rev": "4633a7c72337ea8fd23a4f2ba3972865e3ec685d", "type": "github" }, "original": { @@ -35,14 +35,14 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1722555339, - "narHash": "sha256-uFf2QeW7eAHlYXuDktm9c25OxOyCoUOQmh5SZ9amE5Q=", + "lastModified": 1730504152, + "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/a5d394176e64ab29c852d03346c1fc9b0b7d33eb.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" } }, "root": { diff --git a/compositor_pipeline/src/pipeline/decoder/audio/opus.rs b/compositor_pipeline/src/pipeline/decoder/audio/opus.rs index 42835946f..379658b59 100644 --- a/compositor_pipeline/src/pipeline/decoder/audio/opus.rs +++ b/compositor_pipeline/src/pipeline/decoder/audio/opus.rs @@ -12,7 +12,7 @@ use super::{AudioDecoderExt, DecodedSamples, DecodingError}; pub(super) struct OpusDecoder { decoder: opus::Decoder, - decoded_samples_buffer: [i16; 100_000], + decoded_samples_buffer: Vec, forward_error_correction: bool, decoded_sample_rate: u32, } @@ -29,7 +29,7 @@ impl OpusDecoder { // Max sample rate for opus is 48kHz. // Usually packets contain 20ms audio chunks, but for safety we use buffer // that can hold >1s of 48kHz stereo audio (96k samples) - let decoded_samples_buffer = [0i16; 100_000]; + let decoded_samples_buffer = vec![0; 100_000]; Ok(Self { decoder,