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
1191025b
Commit
1191025b
authored
Sep 22, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player/Thread: add attribute `decoder_wakeup_threshold`
Calculate the value only once.
parent
bfd26192
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
4 deletions
+16
-4
Thread.cxx
src/player/Thread.cxx
+16
-4
No files found.
src/player/Thread.cxx
View file @
1191025b
...
...
@@ -79,6 +79,16 @@ class Player {
std
::
unique_ptr
<
Tag
>
cross_fade_tag
;
/**
* If the decoder pipe gets consumed below this threshold,
* it's time to wake up the decoder.
*
* It is calculated in a way which should prevent a wakeup
* after each single consumed chunk; it is more efficient to
* make the decoder decode a larger block at a time.
*/
const
unsigned
decoder_wakeup_threshold
;
/**
* are we waiting for buffered_before_play?
*/
bool
buffering
=
true
;
...
...
@@ -174,7 +184,11 @@ class Player {
public
:
Player
(
PlayerControl
&
_pc
,
DecoderControl
&
_dc
,
MusicBuffer
&
_buffer
)
noexcept
:
pc
(
_pc
),
dc
(
_dc
),
buffer
(
_buffer
)
{}
:
pc
(
_pc
),
dc
(
_dc
),
buffer
(
_buffer
),
decoder_wakeup_threshold
((
pc
.
buffered_before_play
+
buffer
.
GetSize
()
*
3
)
/
4
)
{
}
private
:
/**
...
...
@@ -886,9 +900,7 @@ Player::PlayNextChunk() noexcept
/* this formula should prevent that the decoder gets woken up
with each chunk; it is more efficient to make it decode a
larger block at a time */
if
(
!
dc
.
IsIdle
()
&&
dc
.
pipe
->
GetSize
()
<=
(
pc
.
buffered_before_play
+
buffer
.
GetSize
()
*
3
)
/
4
)
{
if
(
!
dc
.
IsIdle
()
&&
dc
.
pipe
->
GetSize
()
<=
decoder_wakeup_threshold
)
{
if
(
!
decoder_woken
)
{
decoder_woken
=
true
;
dc
.
Signal
();
...
...
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