From 83e5a648642954c56fc9c5542dd54c2cb00e0d2e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= <josef.soentgen@genode-labs.com>
Date: Wed, 4 Nov 2015 17:49:58 +0100
Subject: [PATCH] os: extend Audio_out with queue query method

Issue #1767.
---
 .../include/audio_out_session/audio_out_session.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/repos/os/include/audio_out_session/audio_out_session.h b/repos/os/include/audio_out_session/audio_out_session.h
index 1867908411..144bcfc371 100644
--- a/repos/os/include/audio_out_session/audio_out_session.h
+++ b/repos/os/include/audio_out_session/audio_out_session.h
@@ -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
 		 *