decoder/dsf: count the blocks, not the remaining bytes
Prepare refactoring the whole plugin to use blocks instead of bytes. A block is the smallest addressable unit, and it will simplify the seeking code.
This commit is contained in:
parent
2335fdbb5a
commit
6fe06cad98
@ -255,9 +255,9 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
|
||||
|
||||
const size_t block_size = channels * DSF_BLOCK_SIZE;
|
||||
|
||||
while (chunk_size >= block_size) {
|
||||
chunk_size -= block_size;
|
||||
const offset_type n_blocks = chunk_size / block_size;
|
||||
|
||||
for (offset_type i = 0; i < n_blocks;) {
|
||||
if (!decoder_read_full(&decoder, is, buffer, block_size))
|
||||
return false;
|
||||
|
||||
@ -272,6 +272,7 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
|
||||
sample_rate / 1000);
|
||||
switch (cmd) {
|
||||
case DecoderCommand::NONE:
|
||||
++i;
|
||||
break;
|
||||
|
||||
case DecoderCommand::START:
|
||||
|
Loading…
Reference in New Issue
Block a user