From 45fbafae946e8f2a67ae825e8e5be368889e7d64 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Mon, 24 Apr 2017 11:11:09 +0200 Subject: [PATCH] decoder/pcm: split variable "frame_size" in "in_*" and "out_*" --- src/decoder/plugins/PcmDecoderPlugin.cxx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/decoder/plugins/PcmDecoderPlugin.cxx b/src/decoder/plugins/PcmDecoderPlugin.cxx index 6382e8c07..85e177751 100644 --- a/src/decoder/plugins/PcmDecoderPlugin.cxx +++ b/src/decoder/plugins/PcmDecoderPlugin.cxx @@ -136,10 +136,11 @@ pcm_stream_decode(DecoderClient &client, InputStream &is) return; } - const auto frame_size = audio_format.GetFrameSize(); + const auto out_frame_size = audio_format.GetFrameSize(); + const auto in_frame_size = out_frame_size; const auto total_time = is.KnownSize() - ? SignedSongTime::FromScale(is.GetSize() / frame_size, + ? SignedSongTime::FromScale(is.GetSize() / in_frame_size, audio_format.sample_rate) : SignedSongTime::Negative(); @@ -156,7 +157,7 @@ pcm_stream_decode(DecoderClient &client, InputStream &is) /* round down to the nearest frame size, because we must not pass partial frames to DecoderClient::SubmitData() */ - r.size -= r.size % frame_size; + r.size -= r.size % in_frame_size; buffer.Consume(r.size); if (reverse_endian) @@ -170,7 +171,7 @@ pcm_stream_decode(DecoderClient &client, InputStream &is) : client.GetCommand(); if (cmd == DecoderCommand::SEEK) { uint64_t frame = client.GetSeekFrame(); - offset_type offset = frame * frame_size; + offset_type offset = frame * in_frame_size; try { is.LockSeek(offset);