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

oboe: stop stream if callback requests it #323

Merged
merged 3 commits into from
Jan 3, 2019
Merged

oboe: stop stream if callback requests it #323

merged 3 commits into from
Jan 3, 2019

Conversation

philburk
Copy link
Collaborator

Stop in a separate thread for AAudio before Q.
Call stop directly for OpenSL ES.

Possible fix for #277

Stop in a separate thread for AAudio before Q.
Call stop directly for OpenSL ES.

Possible fix for #277
@@ -263,6 +282,7 @@ Result AudioStreamAAudio::requestStart() {
return Result::OK;
}
}
setDataCallbackEnabled(true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get this - why is dataCallbackEnabled always set to true? what about stream which use nonblocking read/writes?


setDataCallbackEnabled(true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As previous comment. Not sure why the stream should always be using callbacks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enabled just means it is not disabled. It does not mean it will be used. But that is confusing. I will clarify or modify the code.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cleaned up the enable and also refactored requestStart for OpenSL ES.

}
if (stopStream) {
requestStop();
// launchStopThread();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out code

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I removed it.

Copy link
Collaborator

@dturner dturner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of questions and a minor suggestion

Copy link
Collaborator

@dturner dturner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. The only other method name I considered was isCapableOfCallbacks but it's a bit of a mouthful and doesn't add much.

@philburk philburk merged commit 6fa2a1a into master Jan 3, 2019
@philburk philburk deleted the stopcallback branch January 3, 2019 17:56
@philburk
Copy link
Collaborator Author

philburk commented Jan 9, 2019

Fixes #61

@dturner
Copy link
Collaborator

dturner commented Apr 23, 2019

Sorry, your question slipped through the net...

You should still be able to use stream->write() just don't set the callback or set it to nullptr.

You can stop the stream at any time by calling requestStop(), and you can check the stream state (e.g. to see whether it's been disconnected) by calling getState().

Please open a new issue referencing this one if you're still experiencing problems.

@dturner
Copy link
Collaborator

dturner commented Apr 23, 2019

Additionally, you can check the result of stream->write(), if it's Result::ErrorDisconnected then you know the stream has been disconnected

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.

3 participants