article

Amelia@Amazon avatar image
Amelia@Amazon posted

Using new MediaCodec features in Android 5.0 to diagnose issues

Issue

With Android 5.0, there are now more diagnosis tools built in to find problems with media codecs.

Resolution

Google's recommendations for troubleshooting MediaCodec issues are as follows:

When receiving a MediaCodec.CodecException you can find the issue by using the isRecoverable() and the isTransient() method calls on the CodecException object, as well as from reading the diagnosticInformation. For more information about the MediaCodec.CodecException, refer to: MediaCodec.CodecException.

Note that the minimum API level for this is 21, meaning for non-Lollipop versions of Android you will not be able to diagnose in this fashion.

As of API level 21 Google has added the MediaCodec.Callback abstract class. This allows developers to be able to react to specific MediaCodec events, including error events. For more information about the MediaCodec.Callback, refer to: MediaCodec.Callback.

Useful Links

MediaCodec.CodecException: https://developer.android.com/reference/android/media/MediaCodec.CodecException.html

isRecoverable(): https://developer.android.com/reference/android/media/MediaCodec.CodecException.html#isRecoverable%28%29

isTransient(): https://developer.android.com/reference/android/media/MediaCodec.CodecException.html#isTransient%28%29

MediaCodec.Callback: https://developer.android.com/reference/android/media/MediaCodec.Callback.html

Keywords: Codec, logging, MediaCodec

KB_0016

androidlollipop
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Article

Contributors

nick_gardner contributed to this article brizzlebrazzle contributed to this article