diff --git a/src/filter/Filter.hxx b/src/filter/Filter.hxx index 6864cec1a..ba68c9266 100644 --- a/src/filter/Filter.hxx +++ b/src/filter/Filter.hxx @@ -65,7 +65,7 @@ public: /** * Flush pending data and return it. This should be called - * repepatedly until it returns nullptr. + * repeatedly until it returns nullptr. */ virtual ConstBuffer Flush(); }; diff --git a/src/filter/plugins/AutoConvertFilterPlugin.cxx b/src/filter/plugins/AutoConvertFilterPlugin.cxx index a55081744..239814a9f 100644 --- a/src/filter/plugins/AutoConvertFilterPlugin.cxx +++ b/src/filter/plugins/AutoConvertFilterPlugin.cxx @@ -55,6 +55,7 @@ public: } ConstBuffer FilterPCM(ConstBuffer src) override; + ConstBuffer Flush() override; }; class PreparedAutoConvertFilter final : public PreparedFilter { @@ -103,6 +104,18 @@ AutoConvertFilter::FilterPCM(ConstBuffer src) return filter->FilterPCM(src); } +ConstBuffer +AutoConvertFilter::Flush() +{ + if (convert != nullptr) { + auto result = convert->Flush(); + if (!result.IsNull()) + return filter->FilterPCM(result); + } + + return filter->Flush(); +} + std::unique_ptr autoconvert_filter_new(std::unique_ptr filter) noexcept {