aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-03 21:23:48 +0100
committerMax Kellermann <max@duempel.org>2009-11-03 21:23:48 +0100
commit56b8081af6a623a96ef24fff027b0b40f478cbf2 (patch)
treea6e469f93ae5114317052b4f5c3468117d287426
parent98d30ac9cfdd12c5bb5932145adc7218ff4fca9e (diff)
downloadmpd-56b8081af6a623a96ef24fff027b0b40f478cbf2.tar.gz
mpd-56b8081af6a623a96ef24fff027b0b40f478cbf2.tar.xz
mpd-56b8081af6a623a96ef24fff027b0b40f478cbf2.zip
player_thread: lock player in player_check_decoder_startup()
Don't access attributes without the lock.
Diffstat (limited to '')
-rw-r--r--src/player_thread.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/player_thread.c b/src/player_thread.c
index b6599ed0d..012cc3964 100644
--- a/src/player_thread.c
+++ b/src/player_thread.c
@@ -236,8 +236,10 @@ player_check_decoder_startup(struct player *player)
/* the decoder failed */
decoder_unlock(dc);
+ player_lock();
pc.errored_song = dc->song;
pc.error = PLAYER_ERROR_FILE;
+ player_unlock();
return false;
} else if (!decoder_is_starting(dc)) {
@@ -251,8 +253,11 @@ player_check_decoder_startup(struct player *player)
all chunks yet - wait for that */
return true;
+ player_lock();
pc.total_time = dc->total_time;
pc.audio_format = dc->in_audio_format;
+ player_unlock();
+
player->play_audio_format = dc->out_audio_format;
player->decoder_starting = false;
@@ -264,11 +269,14 @@ player_check_decoder_startup(struct player *player)
"while playing \"%s\"", uri);
g_free(uri);
+ player_lock();
pc.error = PLAYER_ERROR_AUDIO;
/* pause: the user may resume playback as soon
as an audio output becomes available */
pc.state = PLAYER_STATE_PAUSE;
+ player_unlock();
+
player->paused = true;
return true;
}