player_thread: lock player in player_check_decoder_startup()

Don't access attributes without the lock.
This commit is contained in:
Max Kellermann 2009-11-03 21:23:48 +01:00
parent 98d30ac9cf
commit 56b8081af6
1 changed files with 8 additions and 0 deletions

View File

@ -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;
}