MediaCodec from another app causing issues

夙愿已清 提交于 2019-12-11 19:13:02

问题


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

来源:https://stackoverflow.com/questions/58324341/mediacodec-from-another-app-causing-issues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!