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
0772e571
Commit
0772e571
authored
Dec 22, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player/Thread: move mutex lock out of StartDecoder()
parent
910496ce
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
Thread.cxx
src/player/Thread.cxx
+6
-10
No files found.
src/player/Thread.cxx
View file @
0772e571
...
...
@@ -183,7 +183,7 @@ private:
/**
* Start the decoder.
*
*
Player lock is not held
.
*
Caller must lock the mutex
.
*/
void
StartDecoder
(
MusicPipe
&
pipe
)
noexcept
;
...
...
@@ -361,8 +361,6 @@ Player::StartDecoder(MusicPipe &_pipe) noexcept
assert
(
queued
||
pc
.
command
==
PlayerCommand
::
SEEK
);
assert
(
pc
.
next_song
!=
nullptr
);
const
std
::
lock_guard
<
Mutex
>
protect
(
pc
.
mutex
);
/* copy ReplayGain parameters to the decoder */
dc
.
replay_gain_mode
=
pc
.
replay_gain_mode
;
...
...
@@ -630,9 +628,9 @@ Player::SeekDecoder() noexcept
pipe */
pipe
->
Clear
(
buffer
);
const
std
::
lock_guard
<
Mutex
>
lock
(
pc
.
mutex
);
/* re-start the decoder */
StartDecoder
(
*
pipe
);
const
std
::
lock_guard
<
Mutex
>
lock
(
pc
.
mutex
);
ActivateDecoder
();
if
(
!
WaitDecoderStartup
())
...
...
@@ -699,11 +697,8 @@ Player::ProcessCommand() noexcept
queued
=
true
;
pc
.
CommandFinished
();
{
const
ScopeUnlock
unlock
(
pc
.
mutex
);
if
(
dc
.
LockIsIdle
())
StartDecoder
(
*
new
MusicPipe
());
}
if
(
dc
.
IsIdle
())
StartDecoder
(
*
new
MusicPipe
());
break
;
...
...
@@ -981,8 +976,9 @@ Player::Run() noexcept
{
pipe
=
new
MusicPipe
();
StartDecoder
(
*
pipe
);
pc
.
Lock
();
StartDecoder
(
*
pipe
);
ActivateDecoder
();
pc
.
state
=
PlayerState
::
PLAY
;
...
...
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