player_control: lock player before setting seek parameters

These parameters must be protected with a mutex, too.  Wrap everything
inside player_lock()/player_unlock(), and use player_command_locked()
instead of player_command().
This commit is contained in:
Max Kellermann 2009-11-02 17:02:05 +01:00
parent d1742a2330
commit 93d8f9f00e

View File

@ -258,8 +258,10 @@ pc_enqueue_song(struct song *song)
assert(song != NULL);
assert(pc.next_song == NULL);
player_lock();
pc.next_song = song;
player_command(PLAYER_COMMAND_QUEUE);
player_command_locked(PLAYER_COMMAND_QUEUE);
player_unlock();
}
bool
@ -270,9 +272,11 @@ pc_seek(struct song *song, float seek_time)
if (pc.state == PLAYER_STATE_STOP)
return false;
player_lock();
pc.next_song = song;
pc.seek_where = seek_time;
player_command(PLAYER_COMMAND_SEEK);
player_command_locked(PLAYER_COMMAND_SEEK);
player_unlock();
assert(pc.next_song == NULL);