diff --git a/NEWS b/NEWS index c873cbc2fa19d7f488795997ce69cb6743f51c41..0f11eea76902544db6c3d589c5508e0cf4eb2428 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ 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 diff --git a/src/decoder/plugins/SidplayDecoderPlugin.cxx b/src/decoder/plugins/SidplayDecoderPlugin.cxx index 794a5dab82a514c1c036dd2454e5d4ad45e5861d..8793a41b26c312b226e7eb55d3cb0c1d6fd2c983 100644 --- a/src/decoder/plugins/SidplayDecoderPlugin.cxx +++ b/src/decoder/plugins/SidplayDecoderPlugin.cxx @@ -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);