From a6c571679616dd584da12ffd113d1daa8a3786d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Josef=20S=C3=B6ntgen?= Date: Wed, 3 Jun 2015 13:59:39 +0200 Subject: [PATCH] os: add invalidate_all packets to Audio_out When a stream was stopped it may still contain valid packets that will be played automatically when the stream is started again. The invalidate_all() method may be called after stopping the stream to prevent this. Issue #1647. --- repos/os/include/audio_out_session/audio_out_session.h | 10 ++++++++++ 1 file changed, 10 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 3787312ee..a053502c0 100644 --- a/repos/os/include/audio_out_session/audio_out_session.h +++ b/repos/os/include/audio_out_session/audio_out_session.h @@ -244,6 +244,16 @@ class Audio_out::Stream void reset() { _tail = _pos; } + /** + * Invalidate all packets in stream queue + */ + void invalidate_all() + { + for (int i = 0; i < QUEUE_SIZE; i++) + _buf[i]._valid = false; + } + + /********************************************** ** Intended to be called by the server side ** ***********************************************/