Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
f2a75fbf
Commit
f2a75fbf
authored
Aug 23, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
decoder/dsf: refactor the main decoder loop
Check for STOP before decoding the first chunk. This reduces the command latency.
parent
b1fb09e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
19 deletions
+7
-19
DsfDecoderPlugin.cxx
src/decoder/plugins/DsfDecoderPlugin.cxx
+7
-19
No files found.
src/decoder/plugins/DsfDecoderPlugin.cxx
View file @
f2a75fbf
...
...
@@ -254,7 +254,8 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
{
const
size_t
block_size
=
channels
*
DSF_BLOCK_SIZE
;
for
(
offset_type
i
=
0
;
i
<
n_blocks
;)
{
auto
cmd
=
decoder_get_command
(
decoder
);
for
(
offset_type
i
=
0
;
i
<
n_blocks
&&
cmd
!=
DecoderCommand
::
STOP
;)
{
/* worst-case buffer size */
uint8_t
buffer
[
MAX_CHANNELS
*
DSF_BLOCK_SIZE
];
if
(
!
decoder_read_full
(
&
decoder
,
is
,
buffer
,
block_size
))
...
...
@@ -266,25 +267,12 @@ dsf_decode_chunk(Decoder &decoder, InputStream &is,
uint8_t
interleaved_buffer
[
MAX_CHANNELS
*
DSF_BLOCK_SIZE
];
InterleaveDsfBlock
(
interleaved_buffer
,
buffer
,
channels
);
const
auto
cmd
=
decoder_data
(
decoder
,
is
,
interleaved_buffer
,
block_size
,
sample_rate
/
1000
);
switch
(
cmd
)
{
case
DecoderCommand
:
:
NONE
:
++
i
;
break
;
case
DecoderCommand
:
:
START
:
case
DecoderCommand
:
:
STOP
:
return
false
;
case
DecoderCommand
:
:
SEEK
:
/* not implemented yet */
decoder_seek_error
(
decoder
);
break
;
}
cmd
=
decoder_data
(
decoder
,
is
,
interleaved_buffer
,
block_size
,
sample_rate
/
1000
);
++
i
;
}
return
true
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment