MediaCodec from another app causing issues

Viewed 721

I'm aware that I can check the max supported instances of MediaCodec using getMaxSupportedInstances

The problem I have is - If another application is using MediaCodec, and I open my application then my application fails. In other words, if another developer is not handling the release of MediaCodec correctly then my application will "suffer" from this.

I doubt that there is a way to release current instances of MediaCodec which my application did not create?

What I currently do is, I use a try/catch block to check if there was an error initializing/creating an instance of MediaCodec, as shown below:

try {
    //Prepare MediaCodec
} catch (InterruptedException ie) {
    Log.e("Log", "Thread was interrupted");
} catch (Exception e) {
    //Show alert dialog
}

In the alert dialog, I let the user know that he/she should make sure that there isn't any other video/camera applications open in the background.

This is not ideal, but I couldn't find any other solution.

Any suggestions would be appreciated.


Edit

Just to add, the exception I get is Error 0xffffec77

0 Answers
Related