Commit 45fbafae authored by Max Kellermann's avatar Max Kellermann

decoder/pcm: split variable "frame_size" in "in_*" and "out_*"

parent 803b73a3
...@@ -136,10 +136,11 @@ pcm_stream_decode(DecoderClient &client, InputStream &is) ...@@ -136,10 +136,11 @@ pcm_stream_decode(DecoderClient &client, InputStream &is)
return; 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() const auto total_time = is.KnownSize()
? SignedSongTime::FromScale<uint64_t>(is.GetSize() / frame_size, ? SignedSongTime::FromScale<uint64_t>(is.GetSize() / in_frame_size,
audio_format.sample_rate) audio_format.sample_rate)
: SignedSongTime::Negative(); : SignedSongTime::Negative();
...@@ -156,7 +157,7 @@ pcm_stream_decode(DecoderClient &client, InputStream &is) ...@@ -156,7 +157,7 @@ pcm_stream_decode(DecoderClient &client, InputStream &is)
/* round down to the nearest frame size, because we /* round down to the nearest frame size, because we
must not pass partial frames to must not pass partial frames to
DecoderClient::SubmitData() */ DecoderClient::SubmitData() */
r.size -= r.size % frame_size; r.size -= r.size % in_frame_size;
buffer.Consume(r.size); buffer.Consume(r.size);
if (reverse_endian) if (reverse_endian)
...@@ -170,7 +171,7 @@ pcm_stream_decode(DecoderClient &client, InputStream &is) ...@@ -170,7 +171,7 @@ pcm_stream_decode(DecoderClient &client, InputStream &is)
: client.GetCommand(); : client.GetCommand();
if (cmd == DecoderCommand::SEEK) { if (cmd == DecoderCommand::SEEK) {
uint64_t frame = client.GetSeekFrame(); uint64_t frame = client.GetSeekFrame();
offset_type offset = frame * frame_size; offset_type offset = frame * in_frame_size;
try { try {
is.LockSeek(offset); is.LockSeek(offset);
......
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