question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CodecException: Error 0xffffffff

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:17 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
ojw28commented, May 27, 2021

This should be fixed by the commit referenced above. We’ll get it into 2.14.1.

1reaction
ojw28commented, Jun 14, 2021

@saurabharora90 - This issue was tracking a specific bug that would cause a ​CodecException: Error 0xffffffff to occur. However, CodecException: Error 0xffffffff is 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

MediaCodec - Android Developers
Internal codec errors result in a CodecException , which may be due to media ... Constant Value: -1 (0xffffffff) ... CodecException, upon codec...
Read more >
OEM testing - ExoPlayer
Some of the common failure modes encountered when running ExoPlayer's playback tests are described below, ... MediaCodec$CodecException: Error 0xffffffff.
Read more >
google/ExoPlayer r2.14.1 on GitHub - NewReleases.io
Fix bug that could cause CodecException: Error 0xffffffff to be thrown from MediaCodec.native_setSurface in use cases that involve both swapping the output ...
Read more >
How to diagnose "Error: 0xffffffff"? : r/bashonubuntuonwindows
WSL 2 has started failing consistently with "Error: 0xffffffff". How do I diagnose or fix this? In the past, whenever this happens, ...
Read more >
RELEASENOTES.md · master · Lahlouh, Ishak / RFC_Player
Fix bug that could cause CodecException: Error 0xffffffff to be thrown from MediaCodec.native_setSurface in use cases that involve both ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found