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:
parent
52cb066cae
commit
5896f8cf2b
3 changed files with 36 additions and 45 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue