-
Notifications
You must be signed in to change notification settings - Fork 573
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
Oboe may need handle the case that openStream failed too many times #1541
Comments
Can you try to reproduce the bug with OboeTester? OboeTester adds logic to handle this case. If OboeTester works, can you copy the logic over to your code? |
I don't think calling close() where you suggested is a good idea. If the stream fails to open, we should aim to not have any resources open for the stream. Perhaps we don't clean up correctly if open fails |
I tried to reproduce this using OboeTester. I prevented TEST INPUT from asking for mic permission.
That is quite possible. What puzzles me is that it is not usually the open() that fails when permissions are not given. @xzhan96 - What device and Android version are you using? (You did not fill out the template so I have to ask.) What error code did the open() return? |
@philburk @robertwu1 thanks for your answer, and sorry for the unclear information. Let me clarify more details: Device: Background: Every time restart, we will call "oboe::AudioStreamBuilder::openStream", but if open failed, such as no permission, we can't get a valid AudioStream, so we can do nothing. How to reproduce on our app and sdk:
My analysis:
Thanks a lot for you kindly help. |
@philburk @robertwu1 please check if the information is enough, thanks a lot. |
Can you help us collect a bug report? We want to investigate why the open() opens halfway. @philburk note that they seem to be using OpenSL ES for some reason |
Is your app on the play store? |
https://intl.cloud.tencent.com/document/product/647/34615 you can download sdk and try the android project in zip, you need register an account firstly, but this step should be quickly. please see this document: |
EngineOpenSLES::open() seems to call close already if open fails. However, AudioOutputStreamOpenSLES::open() doesn't seem to have the same logic. On the bottom of AudioOutputStreamOpenSLES::open(), can you try adding an "AudioStreamOpenSLES::close()"? Same for "AudioInputStreamOpenSLES::open()"
Thanks! |
I was able to reproduce this by Modifying OboeTester.
I long-pressed OboeTester and used "App Info" to turn off the RECORD permission.
Starting with #32 they failures looked like:
The "Too many objects" error seems related to: The open is failing at: By adding close() to the error section of AudioInputStreamOpenSLES::open() I was able to prevent the "Too many objects" error. The close() method calls:
I am preparing a PR that will fix this. Note that there is also a problem in the app. It should check for RECORD permission before trying to open the stream. |
I also noticed that before I made the fix, once I got the "Too many objects" error, that I could never open the stream even if I gave the app RECORD permissions. After the fix I could open the stream when RECORD permission was restored. |
There were resource leaks if the open failed. So now it calls close() internally if open fails. Fixes #1541
@philburk Does aaudio also has this issue? |
@xzhan96 wrote:
I don't think so.
|
There were resource leaks if the open failed. So now it calls close() internally if open fails. Fixes #1541
Android version(s):
Android device(s):
Oboe version: latest
App name used for testing:
(Please try to reproduce the issue using the OboeTester or an Oboe sample.)
Short description
Steps to reproduce
By investigate the oboe source code, I think here may have issue, could you help double check?
The text was updated successfully, but these errors were encountered: