os: extend Audio_out with queue query method

Issue #1767.
This commit is contained in:
Josef Söntgen 2015-11-04 17:49:58 +01:00 committed by Christian Helmuth
parent d8b95c263b
commit 83e5a64864
1 changed files with 15 additions and 0 deletions

View File

@ -177,6 +177,21 @@ class Audio_out::Stream
*/
unsigned tail() const { return _tail; }
/**
* Number of packets between playback and allocation position
*
* \return number
*/
unsigned queued() const
{
if (_tail > _pos)
return _tail - _pos;
else if (_pos > _tail)
return QUEUE_SIZE - (_pos - _tail);
else
return 0;
}
/**
* Retrieve next packet for given packet
*