Comments (9)
What is the crash? Presumably a null pointer dereference? Please could you post the stack trace.
from oboe.
The last line in android studio logcat is:
01-12 11:29:12.894 29799-29799/jogi.programme.android.testrequeststartproblem A/libc: Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 29799 (eststartproblem), pid 29799 (eststartproblem)
Everything before is normal.
Looks like it could be what you said.
For a stack trace, can I get that easily, do I have to use systrace. If so, then that would take some time, I'm not into that yet (though I'm planning to get to know it at some point).
So, do you think that's from my code?
from oboe.
Please post everything that comes after the SIGSEGV line, that should give more of a clue as to where the crash is coming from.
from oboe.
You're right, it is a null pointer dereference.
Wenn I log the pointer it prints 0x0. So the behaviour from that point is consistent.
What I don't understand is why I get this problem under the described circumstances (I still think it's not a fault in my code).
The difference between working and not working code is (exactly) like this:
working:
JNIEXPORT jint JNICALL
Java_schmaden_programme_android_test_MainActivity_makeOboeAudioStream(
JNIEnv env,
jobject / this */)
{
OpenOboeStreamFunctions openOboeStreamFunctions;
oboe::AudioStreamBuilder localBuilder;
openOboeStreamFunctions.configureCallbackStreamBuilder(&localBuilder, &oboeClassWithCallback);
oboe::Result result(localBuilder.openStream(&pOboeAudioStream));
return 0;
}
problem:
JNIEXPORT jint JNICALL
Java_schmaden_programme_android_test_MainActivity_makeOboeAudioStream(
JNIEnv env,
jobject / this */)
{
OpenOboeStreamFunctions openOboeStreamFunctions;
oboe::AudioStreamBuilder localBuilder;
openOboeStreamFunctions.configureCallbackStreamBuilder(&localBuilder, &oboeClassWithCallback);
openOboeStreamFunctions.openStreamRequestStart(pOboeAudioStream, &localBuilder);
return 0;
}
with openStreamRequestStart being:
int16_t OpenOboeStreamFunctions::openStreamRequestStart(oboe::AudioStream* stream,
oboe::AudioStreamBuilder* builder)
{
oboe::Result result(builder->openStream(&stream));
if (result != oboe::Result::OK)
{
__android_log_print(ANDROID_LOG_ERROR, "AudioEngine", "Error opening stream %s",
oboe::convertToText(result));
return -108;
}
result= stream->requestStart(); // so sound output is started and heard
return 0;
} // from here stream is a nullpointer
In both cases pOboeAudioStream and oboeClassWithCallback are like this (immediately written after the #include-lines):
static oboe::AudioStream* pOboeAudioStream(nullptr);
static CallbackForTest oboeClassWithCallback;
I think it's also possible that the bug was always there but in the way for example hello-aaudio is written, it hard to see. Because, if I got it right, in hello-audio the callback is always running and when the output should be silenced it works with memset 0, an this way something like requestStop is never called.
from oboe.
I suspect the problem is in not passing a pointer to the stream pointer:
This code:
int16_t OpenOboeStreamFunctions::openStreamRequestStart(oboe::AudioStream* stream,
oboe::AudioStreamBuilder* builder) {
oboe::Result result(builder->openStream(&stream));
should use "**stream" not "*stream":
(UPDATED 1/13/18 to restore double star removed by editor)
int16_t OpenOboeStreamFunctions::openStreamRequestStart(oboe::AudioStream** stream,
oboe::AudioStreamBuilder* builder) {
oboe::Result result(builder->openStream(stream)); // <== NO & !!!!!
Then call with an &:
openOboeStreamFunctions.openStreamRequestStart(&pOboeAudioStream, &localBuilder);
Let me know if that helps.
from oboe.
Thanks for the help.
Tried
oboe::Result result(builder->openStream(stream)); // <== NO & !!!!!
but it doesn't compile, I get the following error:
Error:(57, 45) error: cannot initialize a parameter of type 'oboe::AudioStream **' with an lvalue of type 'oboe::AudioStream *'
Strange thing is, when press ctrl and hover over openStream, the preview I get says declared in "AudioStreamBuilder.h" and "oboe::AudioStream *" is needed.
When I follow the link, android studio shows me "AudioStreamBuilder.cpp" and "oboe::AudioStream **"
for calling the function.
from oboe.
I just notice that GitHub removed the double star from my message! The code that I see now in my email is wrong! If I try to fix it then I see the proper code. I will try to edit it with the code tag.
openStreamRequestStart() must be declared with a double star, a pointer to a pointer. But I can't seem to type that without it getting removed.
The builder->openStream() call passes back a pointer to an AudioStream. So you must pass it a pointer to a pointer.
If Preview looks out of sync with the real code, try adding a comment to your CMakeLists.txt file and doing a gradle sync. That can sometime kick it back into sync.
from oboe.
@philburk
Thanks you, that worked, will make my life a lot easier.
Really have to learn the basics better, never would have thought of that.
(To be honest, I still don't get it, because in the working case I also used openStream(&pOboeAudioStream);.
The only difference I see is one time the function was called over the instance (the working version localBuilder.openStream(&pOboeAudioStream);), the other time with pointer dereference of builderpointer (the problemversion builder->openStream(&stream);), with pOboeAudioStream and stream both being an oboe::AudioStream*.
But I have to read about, think on and play with that tomorrow.)
Thanks a lot.
from oboe.
You were passing Oboe a pointer to a pointer. That's good.
But you were passing a pointer to the variable declared in your function.
It received the pointer to the new stream. But it was immediately discarded.
After the fix, you passed a pointer to the variable declared in your object.
That is the one that needed to be set.
from oboe.
Related Issues (20)
- I want to know how to play mp3 file in scoped storage using oboe HOT 1
- Add Usb Device report to OboeTester Device Report
- OboeTester Data Paths test should test more output channel masks
- Typo in RhythmGame example, section 9
- OboeTester loopback should work with low volume HOT 4
- Potential buffer overflows with some hard coded constants in samples
- OboeTester: need checkbox to disable call to setStreamControlByAttributes()
- StreamDataCallback onAudioReady audioData pointer SegFault HOT 9
- Add IEC61937 support in OboeTester
- OboeTester display often too big for small phones
- Oboe Tester - Test Disconnect - Skip the test will leave a "Failed" message in status area
- OboeTester needs a Java echo test HOT 1
- OboeTester should have an option to test sample rates in the data paths test
- OboeTester latency analysis is too slow
- OboeTester Data Paths needs to test input with a session ID
- OboeTester: setting ChannelMask should clear Channels HOT 1
- OpenSL ES using wrong stream type for RINGTONE
- ANR happens if plugin headset while do recording HOT 7
- getPeakLevel() called before setup(), logspam HOT 1
- Warning printed even when shared_ptr is used to call openStream HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oboe.