diff options
author | Max Kellermann <max@duempel.org> | 2009-11-12 18:41:25 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-11-12 18:41:25 +0100 |
commit | 76283c25a5f17873b37f18564e62f9e16ba2e90e (patch) | |
tree | 13744c8b258e9cb5447bc945d22f8e237b8f1c74 /src/output_all.c | |
parent | b9866e43d3311e9ce147442e378e12b2806b50ab (diff) | |
download | mpd-76283c25a5f17873b37f18564e62f9e16ba2e90e.tar.gz mpd-76283c25a5f17873b37f18564e62f9e16ba2e90e.tar.xz mpd-76283c25a5f17873b37f18564e62f9e16ba2e90e.zip |
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.
Diffstat (limited to '')
-rw-r--r-- | src/output_all.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/output_all.c b/src/output_all.c index 415221aa4..194a65924 100644 --- a/src/output_all.c +++ b/src/output_all.c @@ -441,7 +441,10 @@ audio_output_all_check(void) this chunk */ 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; if (is_tail) |