player_thread: lock player in player_check_decoder_startup()
Don't access attributes without the lock.
This commit is contained in:
@@ -236,8 +236,10 @@ player_check_decoder_startup(struct player *player)
|
|||||||
/* the decoder failed */
|
/* the decoder failed */
|
||||||
decoder_unlock(dc);
|
decoder_unlock(dc);
|
||||||
|
|
||||||
|
player_lock();
|
||||||
pc.errored_song = dc->song;
|
pc.errored_song = dc->song;
|
||||||
pc.error = PLAYER_ERROR_FILE;
|
pc.error = PLAYER_ERROR_FILE;
|
||||||
|
player_unlock();
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
} else if (!decoder_is_starting(dc)) {
|
} else if (!decoder_is_starting(dc)) {
|
||||||
@@ -251,8 +253,11 @@ player_check_decoder_startup(struct player *player)
|
|||||||
all chunks yet - wait for that */
|
all chunks yet - wait for that */
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
player_lock();
|
||||||
pc.total_time = dc->total_time;
|
pc.total_time = dc->total_time;
|
||||||
pc.audio_format = dc->in_audio_format;
|
pc.audio_format = dc->in_audio_format;
|
||||||
|
player_unlock();
|
||||||
|
|
||||||
player->play_audio_format = dc->out_audio_format;
|
player->play_audio_format = dc->out_audio_format;
|
||||||
player->decoder_starting = false;
|
player->decoder_starting = false;
|
||||||
|
|
||||||
@@ -264,11 +269,14 @@ player_check_decoder_startup(struct player *player)
|
|||||||
"while playing \"%s\"", uri);
|
"while playing \"%s\"", uri);
|
||||||
g_free(uri);
|
g_free(uri);
|
||||||
|
|
||||||
|
player_lock();
|
||||||
pc.error = PLAYER_ERROR_AUDIO;
|
pc.error = PLAYER_ERROR_AUDIO;
|
||||||
|
|
||||||
/* pause: the user may resume playback as soon
|
/* pause: the user may resume playback as soon
|
||||||
as an audio output becomes available */
|
as an audio output becomes available */
|
||||||
pc.state = PLAYER_STATE_PAUSE;
|
pc.state = PLAYER_STATE_PAUSE;
|
||||||
|
player_unlock();
|
||||||
|
|
||||||
player->paused = true;
|
player->paused = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user