diff --git a/repos/os/include/audio_in_session/audio_in_session.h b/repos/os/include/audio_in_session/audio_in_session.h index f2fe2b39e5..8f2cc1f394 100644 --- a/repos/os/include/audio_in_session/audio_in_session.h +++ b/repos/os/include/audio_in_session/audio_in_session.h @@ -14,7 +14,7 @@ */ /* - * Copyright (C) 2015-2017 Genode Labs GmbH + * Copyright (C) 2015-2022 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU Affero General Public License version 3. @@ -162,6 +162,21 @@ class Audio_in::Stream */ unsigned tail() const { return _tail; } + /** + * Number of packets between record 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 *