output/Source: move code to DropCurrentChunk()

This commit is contained in:
Max Kellermann 2019-08-27 19:04:51 +02:00
parent 328a6de86e
commit 71ef0faa2c
2 changed files with 8 additions and 2 deletions

View File

@ -216,7 +216,7 @@ AudioOutputSource::Fill(Mutex &mutex)
{
if (current_chunk != nullptr && pending_tag == nullptr &&
pending_data.empty())
pipe.Consume(*std::exchange(current_chunk, nullptr));
DropCurrentChunk();
if (current_chunk != nullptr)
return true;
@ -247,7 +247,7 @@ AudioOutputSource::ConsumeData(size_t nbytes) noexcept
pending_data.skip_front(nbytes);
if (pending_data.empty())
pipe.Consume(*std::exchange(current_chunk, nullptr));
DropCurrentChunk();
}
ConstBuffer<void>

View File

@ -212,6 +212,12 @@ private:
unsigned *replay_gain_serial_p);
ConstBuffer<void> FilterChunk(const MusicChunk &chunk);
void DropCurrentChunk() noexcept {
assert(current_chunk != nullptr);
pipe.Consume(*std::exchange(current_chunk, nullptr));
}
};
#endif