ExoPlayer
ExoPlayer copied to clipboard
ERROR_CODE_FAILED_RUNTIME_CHECK & ERROR_CODE_DECODER_INIT_FAILED
Bug
I have a ViewPager2 + Fragment. Each Fragment has an ExoPlayer. There a pool for avoiding recreating ExoPlayer all the time. Everytime ViewPager2 recycle the fragment, i put the player into the pool for reusing. (player.stop() and player.clearMediaItems() will be invoked before get into the pool)
When scrolling the ViewPager2, sometimes the video failed to play with the "ERROR_CODE_FAILED_RUNTIME_CHECK" error. The detail log is the following log1. Then i release the player and create a new one, prepare it and play again, a new error occur (log2).
there is no problem with the video url. (it could be played for most cases)
Is there any good suggestion to avoid this happening?
the phone is HUAWEI Mate 10
android version: 8.1.0
- log1:
timeline [eventTime=72.64, mediaPos=0.00, window=0, periodCount=1, windowCount=1, reason=PLAYLIST_CHANGED
period [?]
window [?, seekable=false, dynamic=true]
]
mediaItem [eventTime=72.64, mediaPos=0.00, window=0, reason=PLAYLIST_CHANGED]
state [eventTime=72.64, mediaPos=0.00, window=0, BUFFERING]
loading [eventTime=72.65, mediaPos=0.00, window=0, period=0, true]
timeline [eventTime=72.65, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
period [?]
window [?, seekable=false, dynamic=false]
]
timeline [eventTime=72.84, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
period [91.07]
window [91.07, seekable=true, dynamic=false]
]
surfaceSize [eventTime=77.56, mediaPos=0.30, window=0, period=0, 0, 0]
state [eventTime=72.34, mediaPos=0.77, window=0, period=0, IDLE]
timeline [eventTime=72.34, mediaPos=0.00, window=0, periodCount=0, windowCount=0, reason=PLAYLIST_CHANGED
]
positionDiscontinuity [eventTime=72.34, mediaPos=0.00, window=0, reason=REMOVE, PositionInfo:old [mediaItem=0, period=0, pos=766], PositionInfo:new [mediaItem=0, period=-1, pos=0]]
mediaItem [eventTime=72.34, mediaPos=0.00, window=0, reason=PLAYLIST_CHANGED]
tracks [eventTime=72.34, mediaPos=0.00, window=0
]
playWhenReady [eventTime=73.69, mediaPos=0.00, window=0, period=0, true, USER_REQUEST]
isPlaying [eventTime=73.69, mediaPos=0.00, window=0, period=0, true]
videoEnabled [eventTime=72.88, mediaPos=0.00, window=0, period=0]
audioEnabled [eventTime=72.88, mediaPos=0.00, window=0, period=0]
tracks [eventTime=72.88, mediaPos=0.00, window=0, period=0
group [
[X] Track:0, id=1, mimeType=video/avc, codecs=avc1.64001F, res=360x640, fps=60.0, supported=YES
]
group [
[X] Track:0, id=2, mimeType=audio/mp4a-latm, bitrate=64060, codecs=mp4a.40.2, channels=2, sample_rate=44100, language=und, supported=YES
]
]
downstreamFormat [eventTime=72.89, mediaPos=0.00, window=0, period=0, id=1, mimeType=video/avc, codecs=avc1.64001F, res=360x640, fps=60.0]
videoDisabled [eventTime=72.36, mediaPos=0.00, window=0, period=0]
audioDisabled [eventTime=72.36, mediaPos=0.00, window=0, period=0]
surfaceSize [eventTime=72.89, mediaPos=0.00, window=0, period=0, 1039, 1848]
videoDecoderInitialized [eventTime=72.93, mediaPos=0.00, window=0, period=0, OMX.hisi.video.decoder.avc]
videoInputFormat [eventTime=72.93, mediaPos=0.00, window=0, period=0, id=1, mimeType=video/avc, codecs=avc1.64001F, res=360x640, fps=60.0]
downstreamFormat [eventTime=72.93, mediaPos=0.00, window=0, period=0, id=2, mimeType=audio/mp4a-latm, bitrate=64060, codecs=mp4a.40.2, channels=2, sample_rate=44100, language=und]
audioDecoderInitialized [eventTime=72.94, mediaPos=0.00, window=0, period=0, OMX.google.aac.decoder]
audioInputFormat [eventTime=72.94, mediaPos=0.00, window=0, period=0, id=2, mimeType=audio/mp4a-latm, bitrate=64060, codecs=mp4a.40.2, channels=2, sample_rate=44100, language=und]
state [eventTime=72.96, mediaPos=0.00, window=0, period=0, READY]
videoDecoderReleased [eventTime=72.45, mediaPos=0.00, window=0, period=0, OMX.hisi.video.decoder.avc]
audioDecoderReleased [eventTime=72.45, mediaPos=0.00, window=0, period=0, OMX.google.aac.decoder]
state [eventTime=72.99, mediaPos=0.00, window=0, period=0, BUFFERING]
videoSize [eventTime=73.00, mediaPos=0.00, window=0, period=0, 360, 640]
renderedFirstFrame [eventTime=73.00, mediaPos=0.00, window=0, period=0, Surface(name=android.graphics.SurfaceTexture@f271f04) (appName =null) ( mSurfaceControllerIsValid =true) (mNativeObject =76f87cd000)/@0x339ced]
surfaceSize [eventTime=73.01, mediaPos=0.00, window=0, period=0, 1080, 1920]
state [eventTime=73.01, mediaPos=0.00, window=0, period=0, READY]
loading [eventTime=73.06, mediaPos=0.00, window=0, period=0, false]
ClipPlayer.initView() set play listener
playWhenReady [eventTime=75.18, mediaPos=1.39, window=0, period=0, false, USER_REQUEST]
isPlaying [eventTime=75.18, mediaPos=1.39, window=0, period=0, false]
ClipPlayer.load() name=http://192.168.2.21:8083/movie/m3u8/25d72b1439/recommend.mp4 name=我是好人王
timeline [eventTime=73.89, mediaPos=0.00, window=0, periodCount=1, windowCount=1, reason=PLAYLIST_CHANGED
period [?]
window [?, seekable=false, dynamic=true]
]
mediaItem [eventTime=73.89, mediaPos=0.00, window=0, reason=PLAYLIST_CHANGED]
state [eventTime=73.89, mediaPos=0.00, window=0, BUFFERING]
loading [eventTime=73.90, mediaPos=0.00, window=0, period=0, true]
timeline [eventTime=73.90, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
period [?]
window [?, seekable=false, dynamic=false]
]
timeline [eventTime=73.96, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
period [116.40]
window [116.40, seekable=true, dynamic=false]
]
videoEnabled [eventTime=73.97, mediaPos=0.00, window=0, period=0]
audioEnabled [eventTime=73.97, mediaPos=0.00, window=0, period=0]
tracks [eventTime=73.97, mediaPos=0.00, window=0, period=0
group [
[X] Track:0, id=2, mimeType=video/avc, codecs=avc1.640032, res=1080x1920, fps=30.0, supported=YES
]
group [
[X] Track:0, id=1, mimeType=audio/mp4a-latm, bitrate=64053, codecs=mp4a.40.2, channels=2, sample_rate=44100, language=und, supported=YES
]
]
downstreamFormat [eventTime=73.98, mediaPos=0.00, window=0, period=0, id=2, mimeType=video/avc, codecs=avc1.640032, res=1080x1920, fps=30.0]
surfaceSize [eventTime=79.02, mediaPos=0.24, window=0, period=0, 0, 0]
state [eventTime=79.29, mediaPos=0.30, window=0, period=0, IDLE]
timeline [eventTime=79.29, mediaPos=0.00, window=0, periodCount=0, windowCount=0, reason=PLAYLIST_CHANGED
]
positionDiscontinuity [eventTime=79.29, mediaPos=0.00, window=0, reason=REMOVE, PositionInfo:old [mediaItem=0, period=0, pos=300], PositionInfo:new [mediaItem=0, period=-1, pos=0]]
mediaItem [eventTime=79.29, mediaPos=0.00, window=0, reason=PLAYLIST_CHANGED]
tracks [eventTime=79.29, mediaPos=0.00, window=0
]
playWhenReady [eventTime=74.58, mediaPos=0.00, window=0, period=0, true, USER_REQUEST]
isPlaying [eventTime=74.58, mediaPos=0.00, window=0, period=0, true]
videoDisabled [eventTime=79.30, mediaPos=0.00, window=0, period=0]
audioDisabled [eventTime=79.30, mediaPos=0.00, window=0, period=0]
surfaceSize [eventTime=74.08, mediaPos=0.00, window=0, period=0, 1038, 1848]
videoDecoderInitialized [eventTime=74.08, mediaPos=0.00, window=0, period=0, OMX.hisi.video.decoder.avc]
videoInputFormat [eventTime=74.08, mediaPos=0.00, window=0, period=0, id=2, mimeType=video/avc, codecs=avc1.640032, res=1080x1920, fps=30.0]
downstreamFormat [eventTime=74.08, mediaPos=0.00, window=0, period=0, id=1, mimeType=audio/mp4a-latm, bitrate=64053, codecs=mp4a.40.2, channels=2, sample_rate=44100, language=und]
audioDecoderInitialized [eventTime=74.11, mediaPos=0.00, window=0, period=0, OMX.google.aac.decoder]
audioInputFormat [eventTime=74.11, mediaPos=0.00, window=0, period=0, id=1, mimeType=audio/mp4a-latm, bitrate=64053, codecs=mp4a.40.2, channels=2, sample_rate=44100, language=und]
state [eventTime=74.13, mediaPos=0.00, window=0, period=0, READY]
videoDecoderReleased [eventTime=79.38, mediaPos=0.00, window=0, period=0, OMX.hisi.video.decoder.avc]
audioDecoderReleased [eventTime=79.38, mediaPos=0.00, window=0, period=0, OMX.google.aac.decoder]
videoDisabled [eventTime=74.19, mediaPos=0.00, window=0, period=0]
audioDisabled [eventTime=74.20, mediaPos=0.00, window=0, period=0]
videoDecoderReleased [eventTime=74.26, mediaPos=0.00, window=0, period=0, OMX.hisi.video.decoder.avc]
audioDecoderReleased [eventTime=74.26, mediaPos=0.00, window=0, period=0, OMX.google.aac.decoder]
playerFailed [eventTime=74.26, mediaPos=0.00, window=0, period=0, errorCode=ERROR_CODE_FAILED_RUNTIME_CHECK
com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:628)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:166)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: java.lang.IllegalArgumentException
at android.media.MediaCodec.native_setSurface(Native Method)
at android.media.MediaCodec.setOutputSurface(MediaCodec.java:1975)
at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.setOutputSurface(SynchronousMediaCodecAdapter.java:189)
at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setOutputSurfaceV23(MediaCodecVideoRenderer.java:1500)
at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.setOutput(MediaCodecVideoRenderer.java:694)
at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.handleMessage(MediaCodecVideoRenderer.java:632)
at com.google.android.exoplayer2.ExoPlayerImplInternal.deliverMessage(ExoPlayerImplInternal.java:1566)
at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessageToTarget(ExoPlayerImplInternal.java:1530)
at com.google.android.exoplayer2.ExoPlayerImplInternal.sendMessageInternal(ExoPlayerImplInternal.java:1505)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:533)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:166)
at android.os.HandlerThread.run(HandlerThread.java:65)
ERROR_CODE_DECODER_INIT_FAILED
- log2:
playWhenReady [eventTime=0.01, mediaPos=0.00, window=0, true, USER_REQUEST]
surfaceSize [eventTime=0.02, mediaPos=0.00, window=0, 1080, 1848]
timeline [eventTime=0.03, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
period [?]
window [?, seekable=false, dynamic=false]
]
loading [eventTime=0.03, mediaPos=0.00, window=0, period=0, true]
surfaceSize [eventTime=197.69, mediaPos=0.21, window=0, period=0, 1080, 1920]
videoSize [eventTime=197.71, mediaPos=0.21, window=0, period=0, 360, 640]
renderedFirstFrame [eventTime=197.71, mediaPos=0.21, window=0, period=0, Surface(name=android.graphics.SurfaceTexture@9216947) (appName =null) ( mSurfaceControllerIsValid =true) (mNativeObject =76d533c000)/@0x537a574]
timeline [eventTime=0.11, mediaPos=0.00, window=0, period=0, periodCount=1, windowCount=1, reason=SOURCE_UPDATE
period [112.66]
window [112.66, seekable=true, dynamic=false]
]
videoEnabled [eventTime=0.12, mediaPos=0.00, window=0, period=0]
audioEnabled [eventTime=0.12, mediaPos=0.00, window=0, period=0]
tracks [eventTime=0.12, mediaPos=0.00, window=0, period=0
group [
[X] Track:0, id=2, mimeType=video/avc, codecs=avc1.64001F, res=480x854, fps=30.0, supported=YES
]
group [
[X] Track:0, id=1, mimeType=audio/mp4a-latm, bitrate=64058, codecs=mp4a.40.2, channels=2, sample_rate=44100, language=und, supported=YES
]
]
downstreamFormat [eventTime=0.12, mediaPos=0.00, window=0, period=0, id=2, mimeType=video/avc, codecs=avc1.64001F, res=480x854, fps=30.0]
videoDisabled [eventTime=0.30, mediaPos=0.00, window=0, period=0]
audioDisabled [eventTime=0.30, mediaPos=0.00, window=0, period=0]
playerFailed [eventTime=0.31, mediaPos=0.00, window=0, period=0, errorCode=ERROR_CODE_DECODER_INIT_FAILED
com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(2, null, null, video/avc, avc1.64001F, -1, null, [480, 854, 30.0], [-1, -1]), format_supported=YES
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:578)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:166)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.hisi.video.decoder.avc, Format(2, null, null, video/avc, avc1.64001F, -1, null, [480, 854, 30.0], [-1, -1])
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1029)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:537)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1453)
at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:917)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:954)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:769)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1007)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:502)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:166)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: java.lang.IllegalArgumentException
at android.media.MediaCodec.native_configure(Native Method)
at android.media.MediaCodec.configure(MediaCodec.java:1956)
at android.media.MediaCodec.configure(MediaCodec.java:1885)
at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter$Factory.createAdapter(SynchronousMediaCodecAdapter.java:51)
at com.google.android.exoplayer2.mediacodec.DefaultMediaCodecAdapterFactory.createAdapter(DefaultMediaCodecAdapterFactory.java:113)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.initCodec(MediaCodecRenderer.java:1099)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:1010)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecOrBypass(MediaCodecRenderer.java:537)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:1453)
at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:917)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.readSourceOmittingSampleData(MediaCodecRenderer.java:954)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:769)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1007)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:502)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:166)
at android.os.HandlerThread.run(HandlerThread.java:65)
]
Hi, I have a similar use case with viewpager2 and I see same ERROR_CODE_DECODER_INIT_FAILED errors, any updates regarding this one?
set DefaultRenderersFactory(context).setEnableDecoderFallback(true) ; make the video play normal, but this setting may use soft decoder