Search code examples
androidandroid-tvexoplayersmooth-streamingplayready

ExoPlayer: "Internal runtime error" on certain PlayReady-protected assets


I'm working on an app for Android TV devices, which uses ExoPlayer as the video player and I'm using Smooth Streaming video with PlayReady DRM. The app is capable of perform key requests, etc. without any issues and most of the content is playing.

I am, however, experiencing issues with certain video assets. The following error log is visible in Logcat:

E/ExoPlayerImplInternal: Internal runtime error.
android.media.MediaCodec$CodecException: Error 0xffffffff
at android.media.MediaCodec.native_queueSecureInputBuffer(Native Method)
at android.media.MediaCodec.queueSecureInputBuffer(MediaCodec.java:2535)
at com.google.android.exoplayer.MediaCodecTrackRenderer.feedInputBuffer(MediaCodecTrackRenderer.java:721)
at com.google.android.exoplayer.MediaCodecTrackRenderer.doSomeWork(MediaCodecTrackRenderer.java:529)
at com.google.android.exoplayer.SampleSourceTrackRenderer.doSomeWork(SampleSourceTrackRenderer.java:128)
at com.google.android.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:432)
at com.google.android.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:211)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:148)
at android.os.HandlerThread.run(HandlerThread.java:61)
at com.google.android.exoplayer.util.PriorityHandlerThread.run(PriorityHandlerThread.java:40)

I know that the assets in question work, as we're successfully using them on Chromecast.

I'm pretty puzzled by the error as it only happens on some assets and there's seemingly no connection between them. Any help would be much appreciated.


Solution

  • The answer was posted by an Nvidia engineer working on the Nvidia SHIELD device here:

    Looking into the uniqueness of the samples, the reason why it was not working on Nvidia Shield is because the encrypted samples had all IV's zeroed out. Our PlayReady reference implementation had this restricted to avoid "replay" attacks (https://crypto.stackexchange.com/questions/8600/why-should-i-use-an-initialization-vector-iv-when-i-have-unique-keys ), and always liked salted IV's. However, it was later realized that, if the keys are always different and do not repeat in CTR mode, having all zero IV is still secure enough. (https://crypto.stackexchange.com/questions/8151/counter-mode-static-iv-but-different-keys ). This issue has been fixed and the next OTA of Nvidia Shield would have this fixed.

    It's worth mentioning that the mentioned OTA update has been out for well over half a year now.