ExoPlayer:"Internal runtime error" 某些受 PlayReady 保护的资产

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

我正在开发适用于 Android 电视设备的应用程序,它使用 ExoPlayer 作为视频播放器,并且我正在使用带有 PlayReady DRM 的平滑流式传输视频。该应用程序能够执行关键请求等,没有任何问题,大部分内容正在播放。

但是,我遇到了某些视频资产的问题。在 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)

我知道有问题的资产有效,因为我们在 Chromecast 上成功使用了它们。

我对这个错误感到非常困惑,因为它只发生在某些资产上,而且它们之间似乎没有任何联系。任何帮助将不胜感激。

答案是由一位在 Nvidia SHIELD 设备上工作的 Nvidia 工程师发布的 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.

值得一提的是,提到的OTA更新已经发布半年多了。