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

Bug in example: getTimestamp(), FilterAudioStream.h needs a NULL check on framePosition #1166

Closed
extreamsd opened this issue Jan 18, 2021 · 2 comments · Fixed by #1171
Closed
Assignees
Labels
bug P1 high priority

Comments

@extreamsd
Copy link

I was ready to write a crash report on Oboe 1.5.0, when I realized that my code calling getTimestamp(CLOCK_MONOTONIC, 0, 0) was wrong. I thought I probably copied it quite some time ago from example code and indeed, PlayAudioEngine.cpp of the hello-oboe sample contains it as well:

mIsLatencyDetectionSupported = (mPlayStream->getTimestamp(CLOCK_MONOTONIC, 0, 0) !=
oboe::Result::ErrorUnimplemented);

In FilterAudioStream.h, this leads to a crash in:
*framePosition = childPosition * mRateScaler;
or perhaps
getTimeStamp(clockId, &childPosition, timeNanoseconds);
if something is done using timeNanoseconds in that call.

Don't know why it survived in my app all the time and only started crashing with 1.5.0, but perhaps some null pointer checks are in order here. At least the sample code should be changed.

@philburk
Copy link
Collaborator

Thanks! You are right that FilterAudioStream.h needs a NULL check on framePosition.

getTimestamp(CLOCK_MONOTONIC, 0, 0)

I cannot find that code in hello-oboe. I suspect you are using an old copy of the sample code.

@philburk philburk self-assigned this Jan 18, 2021
@extreamsd
Copy link
Author

Ah, you are right. I copied 1.5.0 on top of 1.4.x and 1.4.x (or perhaps an even older version) had PlayAudioEngine.cpp which is not part of 1.5.0 anymore.

@philburk philburk changed the title Bug in example: getTimestamp() Bug in example: getTimestamp(), FilterAudioStream.h needs a NULL check on framePosition Jan 22, 2021
@philburk philburk added P1 high priority bug labels Jan 22, 2021
philburk added a commit that referenced this issue Jan 22, 2021
philburk added a commit that referenced this issue Jan 22, 2021
* Check for nullptr in FilterAudioStream::getTimestamp()

Was crashing.

Fixes #1166
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug P1 high priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants