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:
parent
d1742a2330
commit
93d8f9f00e
@ -258,8 +258,10 @@ pc_enqueue_song(struct song *song)
|
|||||||
assert(song != NULL);
|
assert(song != NULL);
|
||||||
assert(pc.next_song == NULL);
|
assert(pc.next_song == NULL);
|
||||||
|
|
||||||
|
player_lock();
|
||||||
pc.next_song = song;
|
pc.next_song = song;
|
||||||
player_command(PLAYER_COMMAND_QUEUE);
|
player_command_locked(PLAYER_COMMAND_QUEUE);
|
||||||
|
player_unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
@ -270,9 +272,11 @@ pc_seek(struct song *song, float seek_time)
|
|||||||
if (pc.state == PLAYER_STATE_STOP)
|
if (pc.state == PLAYER_STATE_STOP)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
player_lock();
|
||||||
pc.next_song = song;
|
pc.next_song = song;
|
||||||
pc.seek_where = seek_time;
|
pc.seek_where = seek_time;
|
||||||
player_command(PLAYER_COMMAND_SEEK);
|
player_command_locked(PLAYER_COMMAND_SEEK);
|
||||||
|
player_unlock();
|
||||||
|
|
||||||
assert(pc.next_song == NULL);
|
assert(pc.next_song == NULL);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user