Skip to content

Commit ef686ca

Browse files
committed
aaudio: Relax update_state's STOPPING assert.
It's possible the AAudio stream is still in the process of starting when stream_stop is called, so relax the assert to permit this.
1 parent 1de1094 commit ef686ca

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/cubeb_aaudio.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,16 @@ update_state(cubeb_stream * stm)
586586
}
587587
break;
588588
case stream_state::STOPPING:
589-
assert(!istate || istate == AAUDIO_STREAM_STATE_PAUSING ||
589+
// If stream_stop happens while the stream is still starting, we may see
590+
// STARTING/STARTED, ignore these and handle STATE_STOPPED once we reach
591+
// PAUSED.
592+
assert(!istate || istate == AAUDIO_STREAM_STATE_STARTING ||
593+
istate == AAUDIO_STREAM_STATE_STARTED ||
594+
istate == AAUDIO_STREAM_STATE_PAUSING ||
590595
istate == AAUDIO_STREAM_STATE_PAUSED);
591-
assert(!ostate || ostate == AAUDIO_STREAM_STATE_PAUSING ||
596+
assert(!ostate || ostate == AAUDIO_STREAM_STATE_STARTING ||
597+
ostate == AAUDIO_STREAM_STATE_STARTED ||
598+
ostate == AAUDIO_STREAM_STATE_PAUSING ||
592599
ostate == AAUDIO_STREAM_STATE_PAUSED);
593600
if ((!istate || istate == AAUDIO_STREAM_STATE_PAUSED) &&
594601
(!ostate || ostate == AAUDIO_STREAM_STATE_PAUSED)) {

0 commit comments

Comments
 (0)