Commit 49c04ccf authored by Max Kellermann's avatar Max Kellermann

decoder/sidplay: fix playback speed with libsidplayfp

parent 11ba4487
ver 0.19.20 (not yet released)
* decoder
- ffmpeg: ignore empty packets
- sidplay: fix playback speed with libsidplayfp
ver 0.19.19 (2016/08/23)
* decoder
......
......@@ -354,12 +354,19 @@ sidplay_file_decode(Decoder &decoder, Path path_fs)
DecoderCommand cmd;
do {
short buffer[4096];
size_t nbytes;
nbytes = player.play(buffer, ARRAY_SIZE(buffer));
if (nbytes == 0)
const auto result = player.play(buffer, ARRAY_SIZE(buffer));
if (result <= 0)
break;
#ifdef HAVE_SIDPLAYFP
/* libsidplayfp returns the number of samples */
const size_t nbytes = result * sizeof(buffer[0]);
#else
/* libsidplay2 returns the number of bytes */
const size_t nbytes = result;
#endif
decoder_timestamp(decoder, (double)player.time() / timebase);
cmd = decoder_data(decoder, nullptr, buffer, nbytes, 0);
......
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