Results 1 to 2 of 2

Thread: Too many objects on Android JNI

  1. #1
    Newbie Newbie
    Join Date
    Mar 2015

    Too many objects on Android JNI

    I'm using OpenSL ES on Android via JNI to play sounds.

    I use an asset and a source for each sound, but I can't destroy them. The destroy method works on the source, but not on asset. In this way the engine stores objects and I reach the limit of 30 sounds very soon simply using the app.

    The destroy method is called in a callback on the buffer queue as the decode is done. Calling the destroy method on the player object, my app is in Application Not Responding state.

    Which is the best way to create and destroy sound sources?

  2. #2
    Member Contributor
    Join Date
    Mar 2009
    Hi Dariux881,

    It sounds like you are working cross-context and destroying a player in a callback, and then when the callback returns the execution thread does not have a context in which to work. Since your callback is still active, I'm guessing the implementation can't do a complete cleanup of the player and sources. Therefore your sources are still hanging around even though the player object is no longer valid. Note that contexts are implementation specific.

    I suggest you take a look at section 3.3 of the OpenSL ES 1.0.1 spec. To handle avoid cross-context issues, post a message to the main thread in your callback and clean up your players from your main thread. I recommend that you create and destroy all your objects from the main thread and not in callbacks.


    Erik Noreke,
    Working Group Chair OpenSL ES, OpenMAX AL and Safety Critical

Similar Threads

  1. OpenGL Android - Rotate objects other than a cube or triangle
    By androidDev in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 03-20-2016, 07:03 PM
  2. depth buffer: far objects bleed through closer objects
    By geohoffman49431 in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 06-15-2004, 10:47 AM
  3. Replies: 4
    Last Post: 12-30-2003, 10:49 AM
  4. GLslang: no reuse of shader objects in other program objects?
    By Ostsol in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 12-29-2003, 11:22 PM
  5. Replies: 2
    Last Post: 05-24-2002, 06:21 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Proudly hosted by Digital Ocean