Commit bf1d77a4 authored by Max Kellermann's avatar Max Kellermann

output/alsa: un-inline several methods

parent a9344faf
......@@ -344,39 +344,9 @@ private:
/**
* @return false if no data was moved
*/
bool CopyRingToPeriodBuffer() noexcept {
if (period_buffer.IsFull())
return false;
size_t nbytes = ring_buffer->pop(period_buffer.GetTail(),
period_buffer.GetSpaceBytes());
if (nbytes == 0)
return false;
period_buffer.AppendBytes(nbytes);
const std::lock_guard<Mutex> lock(mutex);
/* notify the OutputThread that there is now
room in ring_buffer */
cond.notify_one();
return true;
}
snd_pcm_sframes_t WriteFromPeriodBuffer() noexcept {
assert(period_buffer.IsFull());
assert(period_buffer.GetFrames(out_frame_size) > 0);
auto frames_written = snd_pcm_writei(pcm, period_buffer.GetHead(),
period_buffer.GetFrames(out_frame_size));
if (frames_written > 0) {
written = true;
period_buffer.ConsumeFrames(frames_written,
out_frame_size);
}
bool CopyRingToPeriodBuffer() noexcept;
return frames_written;
}
snd_pcm_sframes_t WriteFromPeriodBuffer() noexcept;
void LockCaughtError() noexcept {
period_buffer.Clear();
......@@ -833,6 +803,44 @@ AlsaOutput::Recover(int err) noexcept
return err;
}
bool
AlsaOutput::CopyRingToPeriodBuffer() noexcept
{
if (period_buffer.IsFull())
return false;
size_t nbytes = ring_buffer->pop(period_buffer.GetTail(),
period_buffer.GetSpaceBytes());
if (nbytes == 0)
return false;
period_buffer.AppendBytes(nbytes);
const std::lock_guard<Mutex> lock(mutex);
/* notify the OutputThread that there is now
room in ring_buffer */
cond.notify_one();
return true;
}
snd_pcm_sframes_t
AlsaOutput::WriteFromPeriodBuffer() noexcept
{
assert(period_buffer.IsFull());
assert(period_buffer.GetFrames(out_frame_size) > 0);
auto frames_written = snd_pcm_writei(pcm, period_buffer.GetHead(),
period_buffer.GetFrames(out_frame_size));
if (frames_written > 0) {
written = true;
period_buffer.ConsumeFrames(frames_written,
out_frame_size);
}
return frames_written;
}
inline bool
AlsaOutput::DrainInternal()
{
......
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