Giter Club home page Giter Club logo

Comments (14)

mackron avatar mackron commented on May 21, 2024

What thread are you calling mal_device_uninit() from? What version of Android? Hardware or emulator?

EDIT: Is it happening consistently, or randomly?

from miniaudio.

digitalgust avatar digitalgust commented on May 21, 2024

both the last version of master and dev, Android 7.0 , Hardware , Xiaomi redmi , consistently.
last master line.18239
last dev line.18250

the log pthread 0x7f6a27a450 is the caller thread, a object locked by self ? or the mutexlock need a PTHREAD_MUTEX_RECURSIVE lock ?
or need call some functions to release the object

i found a android issue there:
https://grokbase.com/t/gg/android-ndk/156tayqf1c/opensl-deadlock-issue

https://groups.google.com/forum/#!searchin/android-ndk/deadlock/android-ndk/G7dLKAGGL28/xwlmjpdv2ssJ

from miniaudio.

mackron avatar mackron commented on May 21, 2024

I'm not sure what's going on. This is the first report I've had with this. I'm wondering if it's something to do with the callback being running at the same time as Destroy() is called. Not 100% sure, though... Are you calling mal_device_uninit() from the same thread as the call to mal_device_init()? Also, make sure you're not calling it from the callback thread.

from miniaudio.

mackron avatar mackron commented on May 21, 2024

Is it happening on any other devices or emulators?

from miniaudio.

digitalgust avatar digitalgust commented on May 21, 2024

i have found lots of this issue of opensl, it's not mini_al issue , i create and destroy the device by same thread , and not call it from callback .
i test it only one device, let me test it from other device

from miniaudio.

digitalgust avatar digitalgust commented on May 21, 2024

I test it in huawei 7x / android 8.0, same as xiaomi redmi4x, playback success, but when uninit device , it crash on libwilhelm.so(OpenSLES) pthread_mutex_trylock, error : SIGSEGV (signal SIGSEGV: invalid address (fault address: 0x55555555555591))
xiaomi redmi note4x : deadlock screenshot
image

from miniaudio.

digitalgust avatar digitalgust commented on May 21, 2024

Test in Xiaomi mi6 / Android 8.0, same as Xiaomi redmi note4x, deadlok.

seems ,it's not the random occue event and in less class of device , is there a solution to avoid openSLES issue?

from miniaudio.

mackron avatar mackron commented on May 21, 2024

OpenSL|ES is the only supported backend for Android. An AAudio backend is planned, but this is only supported on later versions of Android.

This feels like a bug in mini_al somewhere. I will need to do a few experiments and get back to you.

from miniaudio.

digitalgust avatar digitalgust commented on May 21, 2024

and i test in android emulator 7.0 (X86_64 without google api) ,it would deadlock too.

from miniaudio.

mackron avatar mackron commented on May 21, 2024

OK something I just saw in your screenshot is that the variable g_malOpenSLInitCounter is set to 0. That means the mal_context object has either been uninitialized before uninitializing the device (you must uninitialize all devices before attempting to uninitialize the context) or you have not initialized the context at all. Can you please check that the context is not getting uninitialized before the device.

Some basic things to consider:

  • If you are using the onStop callback, make sure you're not uninitializing the context in onStop and then again outside of it.
  • Your tear down should look something like this:
mal_device_uninit(device); // <-- Must do this _before_ mal_context_uninit()
mal_context_uninit(context);

Meanwhile, I have pushed an update to the dev branch which checks for this and throws an assert. Can you please let me know what the outcome of that is?

from miniaudio.

digitalgust avatar digitalgust commented on May 21, 2024

Yes, it's my fault, i init mal_context before init mal_device , should be uninit mal_context after uninit mal_device , but before that , thank you point out the error .i changed that it's work. :) :) :)

from miniaudio.

mackron avatar mackron commented on May 21, 2024

That's good to hear! So everything is working now?

from miniaudio.

digitalgust avatar digitalgust commented on May 21, 2024

all ok, please close the thread.

from miniaudio.

mackron avatar mackron commented on May 21, 2024

Great! Closing.

from miniaudio.

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.