Skip to content

Commit 61d1683

Browse files
committed
Wait for AAudioStream status change
1 parent 2da4ee1 commit 61d1683

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/host/aaudio/mod.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -598,18 +598,18 @@ impl DeviceTrait for Device {
598598

599599
impl StreamTrait for Stream {
600600
fn play(&self) -> Result<(), PlayStreamError> {
601-
match self {
602-
Self::Input(stream) => stream
603-
.lock()
604-
.unwrap()
605-
.request_start()
606-
.map_err(PlayStreamError::from),
607-
Self::Output(stream) => stream
608-
.lock()
609-
.unwrap()
610-
.request_start()
611-
.map_err(PlayStreamError::from),
601+
let stream = match self {
602+
Self::Input(stream) => stream,
603+
Self::Output(stream) => stream,
612604
}
605+
.lock()
606+
.unwrap();
607+
608+
stream.request_start().map_err(PlayStreamError::from)?;
609+
stream
610+
.wait_for_state_change(ndk::audio::AudioStreamState::Starting, 300_000_000)
611+
.map(|_| ())
612+
.map_err(PlayStreamError::from)
613613
}
614614

615615
fn pause(&self) -> Result<(), PauseStreamError> {

0 commit comments

Comments
 (0)