decoder_api: use the correct format to calculate elapsed time

When decoder->timestamp is calculated, the PCM data is already
converted to out_audio_format; using in_audio_format may cause funny
speedups/slowdowns.
This commit is contained in:
Max Kellermann 2010-03-17 18:26:36 +01:00
parent 469c9b5def
commit 68017b1254

View File

@ -354,7 +354,7 @@ decoder_data(struct decoder *decoder,
length -= nbytes;
decoder->timestamp += (double)nbytes /
audio_format_time_to_size(&dc->in_audio_format);
audio_format_time_to_size(&dc->out_audio_format);
if (dc->song->end_ms > 0 &&
decoder->timestamp >= dc->song->end_ms / 1000.0)