Add PlayStreamError and PauseStreamError.

This allows for properly handling potential failure on macOS. We should
also consider propagating the mutex/channel poison errors through these
new types, especially considering the potential removal of the event
loop in favour of switching over to high-priority audio threads on
windows and linux.
This commit is contained in:
mitchmindtree 2019-06-21 03:03:03 +02:00
parent ba8d354e93
commit eae0e18714
9 changed files with 86 additions and 18 deletions

View file

@ -23,6 +23,8 @@ use std::sync::atomic::Ordering;
use BackendSpecificError;
use BuildStreamError;
use Format;
use PauseStreamError;
use PlayStreamError;
use SampleFormat;
use StreamData;
use UnknownTypeOutputBuffer;
@ -642,13 +644,15 @@ impl EventLoop {
}
#[inline]
pub fn play_stream(&self, stream: StreamId) {
pub fn play_stream(&self, stream: StreamId) -> Result<(), PlayStreamError> {
self.push_command(Command::PlayStream(stream));
Ok(())
}
#[inline]
pub fn pause_stream(&self, stream: StreamId) {
pub fn pause_stream(&self, stream: StreamId) -> Result<(), PauseStreamError> {
self.push_command(Command::PauseStream(stream));
Ok(())
}
#[inline]