Skip to content

Commit

Permalink
LibAudio: Use ByteBuffer::slice_view() to avoid double memory usage.
Browse files Browse the repository at this point in the history
We only need a temporary copy for passing to ABuffer::from_pcm_data().
  • Loading branch information
awesomekling committed Jul 27, 2019
1 parent 6f397e2 commit be1025c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Libraries/LibAudio/AWavLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ RefPtr<ABuffer> AWavLoader::parse_wav(ByteBuffer& buffer)
// Just make sure we're good before we read the data...
ASSERT(!stream.handle_read_failure());

auto sample_data = buffer.slice(stream.offset(), data_sz);
auto sample_data = buffer.slice_view(stream.offset(), data_sz);

dbgprintf("Read WAV of format PCM with num_channels %d sample rate %d, bits per sample %d\n", num_channels, sample_rate, bits_per_sample);

Expand Down

0 comments on commit be1025c

Please sign in to comment.