Commit 71ef0faa authored by Max Kellermann's avatar Max Kellermann

output/Source: move code to DropCurrentChunk()

parent 328a6de8
...@@ -216,7 +216,7 @@ AudioOutputSource::Fill(Mutex &mutex) ...@@ -216,7 +216,7 @@ AudioOutputSource::Fill(Mutex &mutex)
{ {
if (current_chunk != nullptr && pending_tag == nullptr && if (current_chunk != nullptr && pending_tag == nullptr &&
pending_data.empty()) pending_data.empty())
pipe.Consume(*std::exchange(current_chunk, nullptr)); DropCurrentChunk();
if (current_chunk != nullptr) if (current_chunk != nullptr)
return true; return true;
...@@ -247,7 +247,7 @@ AudioOutputSource::ConsumeData(size_t nbytes) noexcept ...@@ -247,7 +247,7 @@ AudioOutputSource::ConsumeData(size_t nbytes) noexcept
pending_data.skip_front(nbytes); pending_data.skip_front(nbytes);
if (pending_data.empty()) if (pending_data.empty())
pipe.Consume(*std::exchange(current_chunk, nullptr)); DropCurrentChunk();
} }
ConstBuffer<void> ConstBuffer<void>
......
...@@ -212,6 +212,12 @@ private: ...@@ -212,6 +212,12 @@ private:
unsigned *replay_gain_serial_p); unsigned *replay_gain_serial_p);
ConstBuffer<void> FilterChunk(const MusicChunk &chunk); ConstBuffer<void> FilterChunk(const MusicChunk &chunk);
void DropCurrentChunk() noexcept {
assert(current_chunk != nullptr);
pipe.Consume(*std::exchange(current_chunk, nullptr));
}
}; };
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment