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
739e1da2
Commit
739e1da2
authored
Dec 22, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
player/Thread: move mutex lock out of ActivateDecoder()
parent
08b4a7aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
19 deletions
+21
-19
Thread.cxx
src/player/Thread.cxx
+21
-19
No files found.
src/player/Thread.cxx
View file @
739e1da2
...
...
@@ -299,7 +299,7 @@ private:
* yet, therefore we don't know the audio format yet. To
* finish decoder startup, call CheckDecoderStartup().
*
*
The player lock is not held
.
*
Caller must lock the mutex
.
*/
void
ActivateDecoder
()
noexcept
;
...
...
@@ -419,27 +419,26 @@ Player::ActivateDecoder() noexcept
queued
=
false
;
{
const
std
::
lock_guard
<
Mutex
>
lock
(
pc
.
mutex
);
pc
.
ClearTaggedSong
();
pc
.
ClearTaggedSong
(
);
song
=
std
::
exchange
(
pc
.
next_song
,
nullptr
);
song
=
std
::
exchange
(
pc
.
next_song
,
nullptr
)
;
elapsed_time
=
pc
.
seek_time
;
elapsed_time
=
pc
.
seek_time
;
/* set the "starting" flag, which will be cleared by
player_check_decoder_startup() */
decoder_starting
=
true
;
/* set the "starting" flag, which will be cleared by
player_check_decoder_startup() */
decoder_starting
=
true
;
/* update PlayerControl's song information */
pc
.
total_time
=
song
->
GetDuration
();
pc
.
bit_rate
=
0
;
pc
.
audio_format
.
Clear
();
/* update PlayerControl's song information */
pc
.
total_time
=
song
->
GetDuration
();
pc
.
bit_rate
=
0
;
pc
.
audio_format
.
Clear
();
{
/* call syncPlaylistWithQueue() in the main thread */
const
ScopeUnlock
unlock
(
pc
.
mutex
)
;
pc
.
listener
.
OnPlayerSync
();
}
/* call syncPlaylistWithQueue() in the main thread */
pc
.
listener
.
OnPlayerSync
();
}
/**
...
...
@@ -634,9 +633,9 @@ Player::SeekDecoder() noexcept
/* re-start the decoder */
StartDecoder
(
*
pipe
);
const
std
::
lock_guard
<
Mutex
>
lock
(
pc
.
mutex
);
ActivateDecoder
();
const
std
::
lock_guard
<
Mutex
>
lock
(
pc
.
mutex
);
if
(
!
WaitDecoderStartup
())
return
false
;
}
else
{
...
...
@@ -966,7 +965,10 @@ Player::SongBorder() noexcept
pc
.
outputs
.
SongBorder
();
ActivateDecoder
();
{
const
std
::
lock_guard
<
Mutex
>
lock
(
pc
.
mutex
);
ActivateDecoder
();
}
const
bool
border_pause
=
pc
.
LockApplyBorderPause
();
if
(
border_pause
)
{
...
...
@@ -981,9 +983,9 @@ Player::Run() noexcept
pipe
=
new
MusicPipe
();
StartDecoder
(
*
pipe
);
pc
.
Lock
();
ActivateDecoder
();
pc
.
Lock
();
pc
.
state
=
PlayerState
::
PLAY
;
pc
.
CommandFinished
();
...
...
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