Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecorderThread: Use non-blocking reads from AudioRecord #152

Merged
merged 1 commit into from
Oct 9, 2022

Conversation

chenxiaolong
Copy link
Owner

On Samsung devices, when a call ends, AudioRecord.read() blocks until another call becomes active, which prevents recordings from stopping at the correct time. This behavior does not happen in AOSP.

To work around this, use non-blocking reads with a sleep interval of the AudioRecord minimum buffer size. This gives the recording loop a chance to check if recording has been cancelled.

Issue: #143

@chenxiaolong chenxiaolong self-assigned this Oct 9, 2022
On Samsung devices, when a call ends, AudioRecord.read() blocks until
another call becomes active, which prevents recordings from stopping at
the correct time. This behavior does not happen in AOSP.

To work around this, use non-blocking reads with a sleep interval of the
AudioRecord minimum buffer size. This gives the recording loop a chance
to check if recording has been cancelled.

Issue: #143

Signed-off-by: Andrew Gunnerson <[email protected]>
@chenxiaolong chenxiaolong merged commit de65330 into master Oct 9, 2022
@chenxiaolong chenxiaolong deleted the non-blocking branch October 9, 2022 19:40
chenxiaolong added a commit that referenced this pull request Oct 9, 2022
Signed-off-by: Andrew Gunnerson <[email protected]>
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