Skip to content

fix(aaudio): Wait for AAudioStream status change#1125

Open
osoftware wants to merge 1 commit intoRustAudio:masterfrom
osoftware:master
Open

fix(aaudio): Wait for AAudioStream status change#1125
osoftware wants to merge 1 commit intoRustAudio:masterfrom
osoftware:master

Conversation

@osoftware
Copy link

This PR fixes two bugs at once.

After starting the stream and before the status changes to Started, dropping it causes the main thread to lock permanently. The underlying AAudioStream never closes while the drop method waits for it to close. By using wait_for_state_change method we ensure the play method won't return befor it's safe to drop the stream.

If wait_for_state_change is never called then AAudioStream_getTimestamp always returns InvalidState error leading to info.timestamp().capture and info.timestamp().playback in stream callbacks always returning zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant