From 2093e536414f985886280e361fa5510c492bbf4f Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 26 Jun 2019 15:48:18 +0200 Subject: [PATCH] pcm/Export: add GetInputFrameSize() --- src/pcm/Export.cxx | 2 +- src/pcm/Export.hxx | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pcm/Export.cxx b/src/pcm/Export.cxx index 5c7acc174..f70fe8064 100644 --- a/src/pcm/Export.cxx +++ b/src/pcm/Export.cxx @@ -141,7 +141,7 @@ PcmExport::GetOutputFrameSize() const noexcept } #endif - return channels * sample_format_size(src_sample_format); + return GetInputFrameSize(); } unsigned diff --git a/src/pcm/Export.hxx b/src/pcm/Export.hxx index 722c7556c..251576e60 100644 --- a/src/pcm/Export.hxx +++ b/src/pcm/Export.hxx @@ -184,6 +184,14 @@ public: */ void Reset() noexcept; + /** + * Calculate the size of one input frame. + */ + gcc_pure + size_t GetInputFrameSize() const noexcept { + return channels * sample_format_size(src_sample_format); + } + /** * Calculate the size of one output frame. */