diff --git a/src/encoder/plugins/FlacEncoderPlugin.cxx b/src/encoder/plugins/FlacEncoderPlugin.cxx index 4490d1c48..69b76c77e 100644 --- a/src/encoder/plugins/FlacEncoderPlugin.cxx +++ b/src/encoder/plugins/FlacEncoderPlugin.cxx @@ -43,7 +43,7 @@ class FlacEncoder final : public Encoder { /** * This buffer will hold encoded data from libFLAC until it is - * picked up with flac_encoder_read(). + * picked up with Read(). */ DynamicFifoBuffer output_buffer{8192}; @@ -73,8 +73,10 @@ public: void Write(std::span src) override; - std::span Read(std::span buffer) noexcept override { - return buffer.first(output_buffer.Read(buffer.data(), buffer.size())); + std::span Read(std::span) noexcept override { + auto r = output_buffer.Read(); + output_buffer.Consume(r.size()); + return r; } private: