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
7171e237
Commit
7171e237
authored
Dec 30, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player/Thread: make seeking into a new song non-blocking
parent
dee378b7
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
33 deletions
+12
-33
Thread.cxx
src/player/Thread.cxx
+12
-33
No files found.
src/player/Thread.cxx
View file @
7171e237
...
...
@@ -211,37 +211,6 @@ private:
bool
CheckDecoderStartup
()
noexcept
;
/**
* Call CheckDecoderStartup() repeatedly until the decoder has
* finished startup. Returns false on decoder error (and
* finishes the #PlayerCommand).
*
* This method does not check for commands. It is only
* allowed to be used while a command is being handled.
*
* Caller must lock the mutex.
*
* @return false if the decoder has failed
*/
bool
WaitDecoderStartup
()
noexcept
{
while
(
decoder_starting
)
{
if
(
!
CheckDecoderStartup
())
{
/* if decoder startup fails, make sure
the previous song is not being
played anymore */
{
const
ScopeUnlock
unlock
(
pc
.
mutex
);
pc
.
outputs
.
Cancel
();
}
pc
.
CommandFinished
();
return
false
;
}
}
return
true
;
}
/**
* Stop the decoder and clears (and frees) its music pipe.
*
* Caller must lock the mutex.
...
...
@@ -555,6 +524,12 @@ Player::CheckDecoderStartup() noexcept
/* re-fill the buffer after seeking */
buffering
=
true
;
}
else
if
(
pc
.
seeking
)
{
pc
.
seeking
=
false
;
pc
.
ClientSignal
();
/* re-fill the buffer after seeking */
buffering
=
true
;
}
if
(
!
paused
&&
!
OpenOutput
())
{
...
...
@@ -669,8 +644,12 @@ Player::SeekDecoder() noexcept
StartDecoder
(
*
pipe
);
ActivateDecoder
();
if
(
!
WaitDecoderStartup
())
return
false
;
pc
.
seeking
=
true
;
pc
.
CommandFinished
();
assert
(
xfade_state
==
CrossFadeState
::
UNKNOWN
);
return
true
;
}
else
{
if
(
!
IsDecoderAtCurrentSong
())
{
/* the decoder is already decoding the "next" song,
...
...
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