Skip to content

Possible crash on disconnect with streams using Oboe sample rate conversion #2035

@philburk

Description

@philburk

If a stream was opened using setSampleRate() and the setSampleRateConversionQuality() was not None,
then if a headset was plugged in or unplugged,
and another thread or the user closed the stream,
then it was possible to get a crash in oboe_aaudio_error_thread_proc().

Note that this bug could also occur if any of these other conversion functions were enabled:

builder.setChannelConversionAllowed(true);
builder.setFormatConversionAllowed(true);

To avoid this bug, use Oboe v1.9.0 or later.

Note that the bug was due to not using shared_ptr when calling builder->openStream().
Because it is so dangerous, we are disabling the openStream(AudioStream **streamPP)
method. It was deprecated a long time ago. Now if you call it you will get an error and no stream.

The root cause was because the AudioStreamBuilder.openStream() was not using a shared_ptr
when creating a child stream. buggy code

Using a shared_ptr is necessary to prevent an error callback from using a raw pointer and referencing a deleted stream.
It also prevents the stream from being deleted while a data callback is active.

Metadata

Metadata

Assignees

Labels

P0very high prioritybug

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions