File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -598,18 +598,18 @@ impl DeviceTrait for Device {
598598
599599impl 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 > {
You can’t perform that action at this time.
0 commit comments