google / ExoPlayer

This project is deprecated and stale. The latest ExoPlayer code is available in https://github.com/androidx/media
https://developer.android.com/media/media3/exoplayer
Apache License 2.0
21.7k stars 6.02k forks source link

Exoplayer throwing createRendererException on start of playback #7491

Closed krackjack234 closed 3 years ago

krackjack234 commented 4 years ago

[REQUIRED] Issue description

Playback failing on STB box, throwing java.lang.IllegalStateException in MediaCodecRenderer.render function on start

[REQUIRED] Reproduction steps

We have an OTT app on our client's STB platform. On certain variants of stb boxes when we play AD + content, we see a 100% failure with neither content (clear files no drm) nor ads playing

[REQUIRED] Link to test content

Unfortunately this is a device specific problem and we can't share any public link

[REQUIRED] A full bug report captured from the device

Adb logcat & bug report attached. https://drive.google.com/drive/folders/1GGVVYWhi_Ftw_icXP6FxxTdgOAq15-vk?usp=sharing

We see the below exception which looks to be for some unsupported codecs. But the issue is happening on a particular variant, so will be great if we can get the actual root cause (which codec/profile/action etc.) is causing the issue and how we can avoid this.

2020-06-11 18:23:00.519 23126-23126/com.jiotv.sonyliv D/vmax: Instruction Action = noaction
2020-06-11 18:23:00.584 23126-23657/com.jiotv.sonyliv E/ACodec: [OMX.amlogic.avc.decoder.awesome] ERROR(0x80001001)
2020-06-11 18:23:00.584 23126-23657/com.jiotv.sonyliv E/ACodec: signalError(omxError 0x80001001, internalError -2147483648)
2020-06-11 18:23:00.584 23126-23656/com.jiotv.sonyliv E/MediaCodec: Codec reported err 0x80001001, actionCode 0, while in state 6
2020-06-11 18:23:00.584 23126-23656/com.jiotv.sonyliv E/libc: Access denied finding property "media.metrics.enabled"
2020-06-11 18:23:00.582 23126-23126/com.jiotv.sonyliv W/MediaCodec_loop: type=1400 audit(0.0:381): avc: denied { read } for name="u:object_r:media_prop:s0" dev="tmpfs" ino=11824 scontext=u:r:untrusted_app:s0:c103,c256,c512,c768 tcontext=u:object_r:media_prop:s0 tclass=file permissive=0
2020-06-11 18:23:00.591 23126-23656/com.jiotv.sonyliv D/SurfaceUtils: disconnecting from surface 0x7c87f808, reason disconnectFromSurface
2020-06-11 18:23:00.618 23126-23636/com.jiotv.sonyliv E/ExoPlayerImplInternal: Renderer error: index=0, type=video, format=Format(1, null, null, video/avc, avc1.4D4015, 576784, null, [512, 288, 25.0], [-1, -1]), rendererSupport=YES
    com.google.android.exoplayer2.ExoPlaybackException: java.lang.IllegalStateException
        at com.google.android.exoplayer2.BaseRenderer.createRendererException(BaseRenderer.java:359)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:732)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:599)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:329)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:193)
        at android.os.HandlerThread.run(HandlerThread.java:65)
     Caused by: java.lang.IllegalStateException
        at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method)
        at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2698)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1515)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:718)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:599) 
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:329) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:193) 
        at android.os.HandlerThread.run(HandlerThread.java:65) 
2020-06-11 18:23:00.621 23126-23636/com.jiotv.sonyliv E/ExoPlayerImplInternal: Disable failed.
    java.lang.IllegalStateException
        at android.media.MediaCodec.native_flush(Native Method)
        at android.media.MediaCodec.flush(MediaCodec.java:2131)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.flushOrReleaseCodec(MediaCodecRenderer.java:773)
        at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.flushOrReleaseCodec(MediaCodecVideoRenderer.java:724)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onDisabled(MediaCodecRenderer.java:634)
        at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onDisabled(MediaCodecVideoRenderer.java:569)
        at com.google.android.exoplayer2.BaseRenderer.disable(BaseRenderer.java:168)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.disableRenderer(ExoPlayerImplInternal.java:1136)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:891)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.stopInternal(ExoPlayerImplInternal.java:850)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:382)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:193)
        at android.os.HandlerThread.run(HandlerThread.java:65)
2020-06-11 18:23:00.694 23126-23126/com.jiotv.sonyliv W/ExoPlayerImplIn: type=1400 audit(0.0:382): avc: denied { read } for name="u:object_r:media_prop:s0" dev="tmpfs" ino=11824 scontext=u:r:untrusted_app:s0:c103,c256,c512,c768 tcontext=u:object_r:media_prop:s0 tclass=file permissive=0

[REQUIRED] Version of ExoPlayer being used

Exoplayer version used is 2.11.3

[REQUIRED] Device(s) and version(s) of Android being used

Android 9 aosp stb box

ojw28 commented 4 years ago

We don't see any obvious root cause in the bug report. Does your client have a relationship with that device manufacturer (presumably Amlogic)? If so then I'd suggest you get help directly from them, since they're better positioned to be able to root case the problem.

If not then let us know, and we can try and point Amlogic in the direction of this issue.

krackjack234 commented 4 years ago

hi @ojw28 it will very helpful if you can try from our side. We will also try in parallel

Is the error code (E/ACodec: [OMX.amlogic.avc.decoder.awesome] ERROR(0x80001001)) specific to codec implementation ?

Please note we are using 2 exoplayers here, one to play Ad and another to play content and when Ad is playing both are present. Can that be a problem?

ojw28 commented 4 years ago

Please note we are using 2 exoplayers here, one to play Ad and another to play content and when Ad is playing both are present. Can that be a problem?

It may well be the problem. You could simply be exceeding the capabilities of the device, in terms of what decoder components it's able to allocate at any one point in time.

Note that it's not necessary to have two players in order to implement ad-insertion use cases, as demonstrated by ExoPlayer's IMA extension. The two player approach has really quite significant downsides (higher device requirements, lack of ability to coordinate buffering of the ad and the content, etc). So it would probably be a good idea for you to try and move away from that approach.

Is the error code (E/ACodec: [OMX.amlogic.avc.decoder.awesome] ERROR(0x80001001)) specific to codec implementation ?

I'm not certain, but I suspect the error code is specific to the implementation.

krackjack234 commented 4 years ago

hi @ojw28 in our case we are using a 3rd party Ad engine and player to play ads. Hence we cannot use exoplayer ima extension.

ojw28 commented 4 years ago

The IMA extension is just an example. It's possible to implement the AdsLoader interface to talk to a different ad provider. If the ad provider you're using doesn't provide you with sufficient flexibility for you to implement AdsLoader, or provide you with their own implementation of AdsLoader, then perhaps that should be a feature request to them.

kuailedeadai commented 3 years ago

It can be solved by reinitializing the hard decoder or converting to soft solution

ojw28 commented 3 years ago

Closing because this is (or was) a device specific issue, relating to a specific STB platform. It sounds like the correct path forward is (or was) to follow up with the STB manufacturer directly.