Commit 209c8a54 authored by Max Kellermann's avatar Max Kellermann

player_thread: wait for decoder before seeking

When the decoder initialization has not been completed yet, all calls to dc_seek() will fail, because dc.seekable is not initialized yet. Wait for the decoder to complete its initialization, i.e. until it has called decoder_initialized().
parent 1e9659bf
...@@ -86,6 +86,7 @@ dc_stop(struct notify *notify) ...@@ -86,6 +86,7 @@ dc_stop(struct notify *notify)
bool bool
dc_seek(struct notify *notify, double where) dc_seek(struct notify *notify, double where)
{ {
assert(dc.state != DECODE_STATE_START);
assert(where >= 0.0); assert(where >= 0.0);
if (dc.state == DECODE_STATE_STOP || if (dc.state == DECODE_STATE_STOP ||
......
...@@ -301,6 +301,17 @@ static bool player_seek_decoder(struct player *player) ...@@ -301,6 +301,17 @@ static bool player_seek_decoder(struct player *player)
player->queued = false; player->queued = false;
} }
/* wait for the decoder to complete initialization */
while (player->decoder_starting) {
ret = player_check_decoder_startup(player);
if (!ret) {
/* decoder failure */
player_command_finished();
return false;
}
}
/* send the SEEK command */ /* send the SEEK command */
where = pc.seek_where; where = pc.seek_where;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment