1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:27:45 +00:00

LibAudio: Use AllocatingMemoryStream as the MP3 loader bit reservoir

This commit is contained in:
Tim Schumacher 2023-01-10 11:24:33 +01:00 committed by Linus Groh
parent 52cb066cae
commit 5896f8cf2b
3 changed files with 36 additions and 45 deletions

View file

@ -106,13 +106,13 @@ struct HuffmanDecodeResult {
};
template<typename T>
HuffmanDecodeResult<T> huffman_decode(InputBitStream& bitstream, Span<HuffmanNode<T> const> tree, size_t max_bits_to_read)
HuffmanDecodeResult<T> huffman_decode(Core::Stream::BigEndianInputBitStream& bitstream, Span<HuffmanNode<T> const> tree, size_t max_bits_to_read)
{
HuffmanNode<T> const* node = &tree[0];
size_t bits_read = 0;
while (!node->is_leaf() && !bitstream.has_any_error() && max_bits_to_read-- > 0) {
bool const direction = bitstream.read_bit_big_endian();
while (!node->is_leaf() && max_bits_to_read-- > 0) {
bool const direction = bitstream.read_bit().release_value_but_fixme_should_propagate_errors();
++bits_read;
if (direction) {
if (node->left == -1)