Commit 76283c25 authored by Max Kellermann's avatar Max Kellermann

player_thread: initialize chunk->times in silence generator

When waiting for the decoder to provide more data, the player thread generates silence chunks if needed. However, it forgot to initialize the chunk.times attribute, which had now an undefined value. This patch sets it to -1.0, meaning "value is undefined". Add a ">= 0.0" check to audio_output_all_check(). This fixes spurious relative seeking errors, because sometimes, the "elapsed" value falls back to 0.0.
parent b9866e43
...@@ -441,7 +441,10 @@ audio_output_all_check(void) ...@@ -441,7 +441,10 @@ audio_output_all_check(void)
this chunk */ this chunk */
return music_pipe_size(g_mp); return music_pipe_size(g_mp);
audio_output_all_elapsed_time = chunk->times; if (chunk->length > 0 && chunk->times >= 0.0)
/* only update elapsed_time if the chunk
provides a defined value */
audio_output_all_elapsed_time = chunk->times;
is_tail = chunk->next == NULL; is_tail = chunk->next == NULL;
if (is_tail) if (is_tail)
......
...@@ -333,6 +333,7 @@ player_send_silence(struct player *player) ...@@ -333,6 +333,7 @@ player_send_silence(struct player *player)
chunk->audio_format = player->play_audio_format; chunk->audio_format = player->play_audio_format;
#endif #endif
chunk->times = -1.0; /* undefined time stamp */
chunk->length = num_frames * frame_size; chunk->length = num_frames * frame_size;
memset(chunk->data, 0, chunk->length); memset(chunk->data, 0, chunk->length);
......
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