Code Monkey home page Code Monkey logo

Comments (8)

philburk avatar philburk commented on June 11, 2024

I notice from the crash dump that the output callback is using Legacy mode and the input read() is using MMAP.
That situation may be more common on the MT6833.

There could also be timing differences that cause race conditions.

Are you using a shared_ptr for your stream variables?

std::shared_ptr<oboe::AudioStream> mStream;

That can help prevent some use-after-free bugs.

from oboe.

philburk avatar philburk commented on June 11, 2024

Do you think this could be happening when the user plugs in or unplugs a headset?

from oboe.

flamme avatar flamme commented on June 11, 2024

It is hard to tell if there is any headset connection change just with the stack trace. We used to have an old bug b/220061515 reporting a similar crash with sound amplifier on android S. It is closed due to no longer reproduced. That may be the same root cause while the issue is not really fixed. I will take a look.

from oboe.

flamme avatar flamme commented on June 11, 2024

Looking more into the code, it looks like this could be caused by the audio stream is freed when the data callback is fired. In aaudio, the audio stream is held by the clients. @sonicdebris, could you please share if you are using a shared pointer for your stream variables as Phil mentioned above? It will also be good to know if you will free the stream immediately when receiving disconnect error.

from oboe.

sonicdebris avatar sonicdebris commented on June 11, 2024

Hello, sorry for the delay in the response.

We are using shared pointers for the streams, and using AudioStreamBuilder::openStream to set them up.

We handle stream errors by implementing AudioStreamErrorCallback::onError(), where we stop and close the stream (and reset the pointer).

We protect all accesses to the stream with a mutex, and in the audio callback we do a try-lock, followed by a null-check on the stream pointer, so the audio callback will just do nothing in case some other function is messing with the stream or has reset the pointer.

I might add that we have the same issue reported on crashlytics, where we log when onError is called and also when audio route changes happen (we listen to such events on the jvm side by using AudioManager.registerAudioDeviceCallback), but in the logs associated to the crashes we don't see any such events related to stream errors or route changes.

from oboe.

philburk avatar philburk commented on June 11, 2024

@sonicdebris - you wrote:

We handle stream errors by implementing AudioStreamErrorCallback::onError(), where we stop and close the stream (and reset the pointer).

Do you return true from your onError() call? If you return false then Oboe might close the stream again!

from oboe.

sonicdebris avatar sonicdebris commented on June 11, 2024

Yes, we do return true

from oboe.

philburk avatar philburk commented on June 11, 2024

The reason you see more crashes on MTK6833 may be because Mediatek may have set compiler options that are detecting numeric overflows. Or there may be lower memory on those devices.

from oboe.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.