diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-11-06 17:10:52 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-11-06 17:10:52 +1100 |
| commit | 8309e67a863bb825ee6ec4921c5de0407f404d5f (patch) | |
| tree | ca913fa69a6698acbee3a366d3845bb2ec6ad6e9 /src/codecs | |
| parent | c6f2b523312320f1ab2f6b2396c507d1e76d4a5b (diff) | |
| download | tangara-fw-8309e67a863bb825ee6ec4921c5de0407f404d5f.tar.gz | |
Read in larger chunks from SD at a time
This helps a little with the stuttering. Some kind of readahead is
probably the ideal tho.
Diffstat (limited to 'src/codecs')
| -rw-r--r-- | src/codecs/source_buffer.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/codecs/source_buffer.cpp b/src/codecs/source_buffer.cpp index 3d06afa0..8e40ba42 100644 --- a/src/codecs/source_buffer.cpp +++ b/src/codecs/source_buffer.cpp @@ -18,7 +18,8 @@ namespace codecs { [[maybe_unused]] static constexpr char kTag[] = "dec_buf"; -static constexpr size_t kBufferSize = 1024 * 8; +static constexpr size_t kBufferSize = 1024 * 128; +static constexpr size_t kReadThreshold = 1024 * 8; SourceBuffer::SourceBuffer() : buffer_(reinterpret_cast<std::byte*>( @@ -34,7 +35,7 @@ SourceBuffer::~SourceBuffer() { } auto SourceBuffer::Refill(IStream* src) -> bool { - if (bytes_in_buffer_ == buffer_.size_bytes()) { + if (bytes_in_buffer_ > kReadThreshold) { return false; } bool eof = false; |
