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

This commit is contained in:
Max Kellermann 2017-04-24 11:11:09 +02:00
parent 803b73a34b
commit 45fbafae94

View File

@ -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)
/* 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)
: 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);