ExoPlayer: CodecException: Error 0xffffffff
Hi. A strange issue has come about in a project.
com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:586)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:154)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: android.media.MediaCodec$CodecException: Error 0xffffffff
at android.media.MediaCodec.native_setSurface(Native Method)
at android.media.MediaCodec.setOutputSurface(MediaCodec.java:1901)
at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.setOutputSurface(SynchronousMediaCodecAdapter.java:165)
at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setOutputSurfaceV23(MediaCodecVideoRenderer.java:1253)
at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setSurface(MediaCodecVideoRenderer.java:556)
at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.handleMessage(MediaCodecVideoRenderer.java:507)
at com.google.android.exoplayer2.ExoPlayerImplInternal.deliverMessage(ExoPlayerImplInternal.java:1502)
at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessageToTarget(ExoPlayerImplInternal.java:1466)
at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessageInternal(ExoPlayerImplInternal.java:1441)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:508)
at android.os.Handler.dispatchMessage(Handler.java:98)
at android.os.Looper.loop(Looper.java:154)
at android.os.HandlerThread.run(HandlerThread.java:61)
As I said before this bug arises in the strange way. What happens? I had to add supporting of ad to the project so I used ExoPlayer’s ima extensions. The application supports rotation and I keep the player inside of a retain fragment.
It happens When the first ad is playing and I change the orientation of the device at the same time. But when the main content is playing after rotation and the ad was in progress and then I try to change orientation again I will catch this exception moreover if I wait for a while and get the next ad and then I change orientation I will not catch this error. In other words I have this bug when rotation was changed when the ad was playing then it ended and then I change orientation again.
However, “codecNeedsSetOutputSurfaceWorkaround” helps to escape this error but I have a little delay therefore It’s not suitable for me.
Finally, Only emulators can work fine. I have this problem on almost all physical devices. Honestly speaking, I have not been able to repeat this issue in a demo project.
Maybe the problem is that the retain fragment re-creates views… It means that a Surface is not ready to handle the player… Can It happen? I use Widevine DASH
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 17 (3 by maintainers)
Commits related to this issue
- Fix incorrect re-use of non-secure DummySurface with secure decoder Issue: #8776 PiperOrigin-RevId: 376186877 — committed to google/ExoPlayer by ojw28 3 years ago
- Fix incorrect re-use of non-secure DummySurface with secure decoder Issue: #8776 PiperOrigin-RevId: 376186877 — committed to google/ExoPlayer by ojw28 3 years ago
This should be fixed by the commit referenced above. We’ll get it into 2.14.1.
@saurabharora90 - This issue was tracking a specific bug that would cause a
CodecException: Error 0xffffffffto occur. However,CodecException: Error 0xffffffffis a generic failure reported from the underlying platform, and so it’s not the case that all such errors would be caused by the bug that this issue was tracking. There are likely other causes of the same generic failure, some of which are likely in the platform itself. If you have reliable reproduction steps for causing such a failure, please file a new issue containing all of the information requested in the issue template.This is a bug in ExoPlayer, rather than in the underlying platform. Which is good news, since it means we can easily fix it!
The problem occurs when
MediaCodecVideoRenderertries to reuse a previously instantiated non-secureDummySurfacewith a secure decoder.MediaCodecVideoRenderershould throw away aDummySurfacewhen switching from a non-secure decoder to a secure decoder, and vice-versa.