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.74k stars 6.03k forks source link

MediaCodec throws IllegalStateException (internalError -110) when pausing the playback. #10219

Open utonautes opened 2 years ago

utonautes commented 2 years ago

ExoPlayer Version

2.17.1

Devices that reproduce the issue

Several devices using qualcomm AVC decoder (OMX.qcom.video.decoder.avc)

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

  1. Change PlayerActivity.java in demos/main to use RandomTrackSelection.
    player =
        new ExoPlayer.Builder(/* context= */ this)
            .setRenderersFactory(renderersFactory)
            .setTrackSelector(new DefaultTrackSelector(this, new RandomTrackSelection.Factory()))  // add..
            .setMediaSourceFactory(createMediaSourceFactory())
            .build();
  2. Launch the demo app.
  3. Play HLS > Apple 16x9 basic stream (TS).
  4. Pause at between 9.5s and 10.0s (00:00:09.22 ~ 00:00:09.25 in the video). Wait for more than 3 seconds(codec timeout)

video: https://drive.google.com/file/d/1nYr6Cq218HL77W4tMjNSo5HCDfoluv6E/view?usp=sharing

It seems that this error happens when the codec is paused while it is processing input format change

Expected result

The media paused successfully.

Actual result

Playback failed with signalError(omxError 0x80001001, internalError -110).

stacktraces:

04-25 22:01:09.219   972  1451 D AudioFlinger:  session 449 still exists for 23703 with 1 refs
04-25 22:01:09.219   815  1839 D msm8974_platform: platform_split_snd_device: snd_device(2) num devices(1) new_snd_devices(0)
04-25 22:01:09.219   815  1839 D ACDB-LOADER: ACDB -> send_audvoltable
04-25 22:01:09.219   815  1839 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_GAIN_DEP_STEP_TABLE_SIZE
04-25 22:01:09.219   815  1839 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_GAIN_DEP_STEP_TABLE, vol index 0
04-25 22:01:09.219   815  1839 D ACDB-LOADER: ACDB -> AUDIO_SET_VOL_CAL cal type = 40
04-25 22:01:09.220   815  1839 D msm8974_platform: platform_split_snd_device: snd_device(2) num devices(1) new_snd_devices(0)
04-25 22:01:09.220   815  1839 D ACDB-LOADER: ACDB -> send_audvoltable
04-25 22:01:09.220   815  1839 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_GAIN_DEP_STEP_TABLE_SIZE
04-25 22:01:09.220   815  1839 D ACDB-LOADER: ACDB -> ACDB_CMD_GET_AUDPROC_INSTANCE_GAIN_DEP_STEP_TABLE, vol index 0
04-25 22:01:09.220   815  1839 D ACDB-LOADER: ACDB -> AUDIO_SET_VOL_CAL cal type = 40
04-25 22:01:09.221   815   815 D msm8974_platform: platform_split_snd_device: snd_device(2) num devices(1) new_snd_devices(0)
04-25 22:01:09.221   815   815 D msm8974_platform: platform_split_snd_device: snd_device(2) num devices(1) new_snd_devices(0)
04-25 22:01:09.222   972  1451 D AudioFlinger: removeClient_l() pid 972, calling pid 972
04-25 22:01:09.222   972  1451 V APM_AudioPolicyManager: stopOutput() portId 82 output 21, stream 3, session 449
04-25 22:01:09.222   972  1451 V APM_AudioPolicyManager: getNewOutputDevices selected devices AUDIO_DEVICE_NONE
04-25 22:01:09.222   972  1451 V APM_AudioPolicyManager: setOutputDevices device AUDIO_DEVICE_NONE delayMs 160
04-25 22:01:09.222   972  1451 V APM_AudioPolicyManager: setOutputDevices() prevDevice {type:0x2,@:}
04-25 22:01:09.224   972  1451 W APM::AudioPolicyEngine: getDevicesForStrategy() unknown strategy: -1
04-25 22:01:09.224   972  1451 V APM_AudioPolicyManager: setOutputDevices setting same device AUDIO_DEVICE_NONE or null device, force=0, patch handle=6
04-25 22:01:09.226   972  1451 W APM::AudioPolicyEngine: getDevicesForStrategy() unknown strategy: -1
04-25 22:01:09.226   972  1451 W APM::AudioPolicyEngine: getDevicesForStrategy() unknown strategy: -1
04-25 22:01:09.227   972  1450 D AudioFlinger: setParameters(): io 0, keyvalue music_sound=0, calling pid 972 calling uid 1041
04-25 22:01:09.227   815   815 D audio_hw_primary: adev_set_parameters: enter: music_sound=0
04-25 22:01:09.227   815   815 V msm8974_platform_lge: LGE_platform_set_parameters: enter: music_sound=0
04-25 22:01:09.227   815   815 D audio_hw_hfp: hfp_set_parameters: enter
04-25 22:01:09.227   815   815 V platform_param: lge_platform_factory_set_parameters: enter: music_sound=0
04-25 22:01:09.227   815   815 V feature_audio_nxp_stereo: lge_nxp_stereo_set_parameters: enter
04-25 22:01:09.227   815   815 V feature_audio_nxp_stereo: lge_nxp_stereo_set_parameters: exit
04-25 22:01:09.227   815   815 D audio_hw_extn: audio_extn_fm_set_parameters: Enter
04-25 22:01:09.227   815   815 E audio_ext_hw_plugin: [ext_hw_plugin_set_parameters] received null pointer
04-25 22:01:09.227   972  1450 D AudioFlinger: setParameters() primary HW return music_sound=0
04-25 22:01:09.228   972  1451 W AudioFlinger: moveEffectChain_l() effect chain for session 0 not on source thread 0xb4000072a4280040
04-25 22:01:09.228   972  1451 V APM_AudioPolicyManager: selectOutputForMusicEffects selected output 13
04-25 22:01:09.444  1934  2213 V WifiServerServiceExt: checkPollTimer Cnt = 0 rssi = -32 threshold = -100
04-25 22:01:10.211 23703 25003 E ACodec  : signalError(omxError 0x80001001, internalError -110)
04-25 22:01:10.211 23703 25002 E MediaCodec: Codec reported err 0xffffff92, actionCode 0, while in state 6
04-25 22:01:10.212 23703 25002 D MediaCodec: ~MediaCodec()
04-25 22:01:10.214 23703 25002 D SurfaceUtils: disconnecting from surface 0x72b58b92a0, reason disconnectFromSurface
04-25 22:01:10.214 23703 25002 E Surface : freeAllBuffers: 6 buffers were freed while being dequeued!
04-25 22:01:10.215 23703 25003 E Surface : getSlotFromBufferLocked: unknown buffer: 0x71a5911300
04-25 22:01:10.215 23703 25003 W ACodec  : [OMX.qcom.video.decoder.avc] can not return buffer 119 to native window
04-25 22:01:10.216 23703 25003 E Surface : getSlotFromBufferLocked: unknown buffer: 0x71a5903cb0
04-25 22:01:10.216 23703 25003 W ACodec  : [OMX.qcom.video.decoder.avc] can not return buffer 123 to native window
04-25 22:01:10.217 23703 25003 E Surface : getSlotFromBufferLocked: unknown buffer: 0x71a590e060
04-25 22:01:10.217 23703 25003 W ACodec  : [OMX.qcom.video.decoder.avc] can not return buffer 124 to native window
04-25 22:01:10.217 23703 25003 E Surface : getSlotFromBufferLocked: unknown buffer: 0x71a58bf610
04-25 22:01:10.217 23703 25003 W ACodec  : [OMX.qcom.video.decoder.avc] can not return buffer 125 to native window
04-25 22:01:10.218 23703 25003 E Surface : getSlotFromBufferLocked: unknown buffer: 0x71a591b1a0
04-25 22:01:10.218 23703 25003 W ACodec  : [OMX.qcom.video.decoder.avc] can not return buffer 135 to native window
04-25 22:01:10.218 23703 25003 E Surface : getSlotFromBufferLocked: unknown buffer: 0x71a5910e80
04-25 22:01:10.218 23703 25003 W ACodec  : [OMX.qcom.video.decoder.avc] can not return buffer 136 to native window
04-25 22:01:10.227  1443 23888 E OMX-VDEC-1080P: Extension: OMX.google.android.index.AndroidNativeBufferConsumerUsage not implemented
04-25 22:01:10.228 23703 25003 D SurfaceUtils: set up nativeWindow 0x72b58b92a0 for 416x240, color 0x7fa30c06, rotation 0, usage 0x0000000020002900
04-25 22:01:10.229 23703 25003 I ACodec  : [OMX.qcom.video.decoder.avc] Allocating 16 meta buffers on output port
04-25 22:01:10.235 23703 25003 W ACodec  : not dequeuing from native window due to fatal error
04-25 22:01:10.235 23703 25003 I ACodec  : [OMX.qcom.video.decoder.avc] Now Executing
04-25 22:01:10.304   906   906 D vendor.lge.hardware.thermal@1.2-impl: Read value from /proc/lge_power/adc/vts, 331
04-25 22:01:10.307   906   906 D vendor.lge.hardware.thermal@1.2-impl: Read value from /proc/lge_power/adc/vts, 331
04-25 22:01:10.525 23703 23890 D CCodecBufferChannel: [c2.android.aac.decoder#56] DEBUG: elapsed: n=6 [in=0 pipeline=0 out=2 smoothness=4]
04-25 22:01:10.525 23703 23890 D PipelineWatcher: DEBUG: elapsed 2 / 6
04-25 22:01:11.046 23703 24992 E MediaCodecVideoRenderer: Video codec error
04-25 22:01:11.046 23703 24992 E MediaCodecVideoRenderer:   java.lang.IllegalStateException
04-25 22:01:11.046 23703 24992 E MediaCodecVideoRenderer:       at android.media.MediaCodec.native_dequeueInputBuffer(Native Method)
04-25 22:01:11.046 23703 24992 E MediaCodecVideoRenderer:       at android.media.MediaCodec.dequeueInputBuffer(MediaCodec.java:2855)
04-25 22:01:11.046 23703 24992 E MediaCodecVideoRenderer:       at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.dequeueInputBufferIndex(SynchronousMediaCodecAdapter.java:99)
04-25 22:01:11.046 23703 24992 E MediaCodecVideoRenderer:       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1177)
04-25 22:01:11.046 23703 24992 E MediaCodecVideoRenderer:       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:794)
04-25 22:01:11.046 23703 24992 E MediaCodecVideoRenderer:       at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:998)
04-25 22:01:11.046 23703 24992 E MediaCodecVideoRenderer:       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:499)
04-25 22:01:11.046 23703 24992 E MediaCodecVideoRenderer:       at android.os.Handler.dispatchMessage(Handler.java:102)
04-25 22:01:11.046 23703 24992 E MediaCodecVideoRenderer:       at android.os.Looper.loop(Looper.java:223)
04-25 22:01:11.046 23703 24992 E MediaCodecVideoRenderer:       at android.os.HandlerThread.run(HandlerThread.java:67)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal: Playback error
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:   com.google.android.exoplayer2.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(0, null, null, video/avc, avc1.4D400D, 263851, null, [416, 234, -1.0], [-1, -1]), format_supported=YES
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:575)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at android.os.Handler.dispatchMessage(Handler.java:102)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at android.os.Looper.loop(Looper.java:223)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at android.os.HandlerThread.run(HandlerThread.java:67)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:   Caused by: com.google.android.exoplayer2.video.MediaCodecVideoDecoderException: Decoder failed: OMX.qcom.video.decoder.avc
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.createDecoderException(MediaCodecVideoRenderer.java:1588)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:813)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:998)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:499)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       ... 3 more
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:   Caused by: java.lang.IllegalStateException
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at android.media.MediaCodec.native_dequeueInputBuffer(Native Method)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at android.media.MediaCodec.dequeueInputBuffer(MediaCodec.java:2855)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.dequeueInputBufferIndex(SynchronousMediaCodecAdapter.java:99)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1177)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:794)
04-25 22:01:11.050 23703 24992 E ExoPlayerImplInternal:       ... 5 more
04-25 22:01:11.051 23703 25002 D MediaCodec: kWhatFlush received
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal: Disable failed.
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:   java.lang.IllegalStateException
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at android.media.MediaCodec.native_flush(Native Method)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at android.media.MediaCodec.flush(MediaCodec.java:2298)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.flush(SynchronousMediaCodecAdapter.java:166)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.flushCodec(MediaCodecRenderer.java:864)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.flushOrReleaseCodec(MediaCodecRenderer.java:857)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onDisabled(MediaCodecRenderer.java:710)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onDisabled(MediaCodecVideoRenderer.java:561)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.BaseRenderer.disable(BaseRenderer.java:186)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.ExoPlayerImplInternal.disableRenderer(ExoPlayerImplInternal.java:1671)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:1411)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.ExoPlayerImplInternal.stopInternal(ExoPlayerImplInternal.java:1374)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:591)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at android.os.Handler.dispatchMessage(Handler.java:102)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at android.os.Looper.loop(Looper.java:223)
04-25 22:01:11.052 23703 24992 E ExoPlayerImplInternal:       at android.os.HandlerThread.run(HandlerThread.java:67)

Media

Bug Report

tonihei commented 2 years ago

Thanks for the reporting and the accurate reproduction steps. I can reproduce the issue and forwarded it to the relevant internal team (internal ref: b/233875661).

gb103 commented 2 years ago

I am able to reproduce this issue with ABRSelctionFactory too on Realme RMX3231 100% time. is there any solution yet for this ?