Merge branch 'v0.21.x'

This commit is contained in:
Max Kellermann 2019-03-25 08:11:07 +01:00
commit ca4e53859d
2 changed files with 14 additions and 1 deletions

View File

@ -65,7 +65,7 @@ public:
/** /**
* Flush pending data and return it. This should be called * Flush pending data and return it. This should be called
* repepatedly until it returns nullptr. * repeatedly until it returns nullptr.
*/ */
virtual ConstBuffer<void> Flush(); virtual ConstBuffer<void> Flush();
}; };

View File

@ -55,6 +55,7 @@ public:
} }
ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override; ConstBuffer<void> FilterPCM(ConstBuffer<void> src) override;
ConstBuffer<void> Flush() override;
}; };
class PreparedAutoConvertFilter final : public PreparedFilter { class PreparedAutoConvertFilter final : public PreparedFilter {
@ -103,6 +104,18 @@ AutoConvertFilter::FilterPCM(ConstBuffer<void> src)
return filter->FilterPCM(src); return filter->FilterPCM(src);
} }
ConstBuffer<void>
AutoConvertFilter::Flush()
{
if (convert != nullptr) {
auto result = convert->Flush();
if (!result.IsNull())
return filter->FilterPCM(result);
}
return filter->Flush();
}
std::unique_ptr<PreparedFilter> std::unique_ptr<PreparedFilter>
autoconvert_filter_new(std::unique_ptr<PreparedFilter> filter) noexcept autoconvert_filter_new(std::unique_ptr<PreparedFilter> filter) noexcept
{ {