Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AAC initialization error due MPEG-TS parsing issue #7095

Open
stari4ek opened this issue Mar 17, 2020 · 4 comments
Open

AAC initialization error due MPEG-TS parsing issue #7095

stari4ek opened this issue Mar 17, 2020 · 4 comments
Assignees
Labels

Comments

@stari4ek
Copy link

[REQUIRED] Issue description

I'm getting IllegalStateException when OMX.google.aac.decoder or ffmpeg decoder is initializing for specific MPEG-TS.

period=0]com.google.android.exoplayer2.ExoPlaybackException: com.google.android.exoplayer2.ext.ffmpeg.FfmpegDecoderException: Initialization failed.
        at com.google.android.exoplayer2.BaseRenderer.createRendererException(BaseRenderer.java:333)
        at com.google.android.exoplayer2.audio.SimpleDecoderAudioRenderer.maybeInitDecoder(SimpleDecoderAudioRenderer.java:601)
        at com.google.android.exoplayer2.audio.SimpleDecoderAudioRenderer.onInputFormatChanged(SimpleDecoderAudioRenderer.java:642)
        at com.google.android.exoplayer2.audio.SimpleDecoderAudioRenderer.render(SimpleDecoderAudioRenderer.java:236)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:789)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:384)
        at android.os.Handler.dispatchMessage(Handler.java:101)
        at android.os.Looper.loop(Looper.java:164)
        at android.os.HandlerThread.run(HandlerThread.java:65)
     Caused by: com.google.android.exoplayer2.ext.ffmpeg.FfmpegDecoderException: Initialization failed.
        at com.google.android.exoplayer2.ext.ffmpeg.FfmpegDecoder.<init>(FfmpegDecoder.java:78)
        at com.google.android.exoplayer2.ext.ffmpeg.FfmpegAudioRenderer.createDecoder(FfmpegAudioRenderer.java:117)
        at com.google.android.exoplayer2.ext.ffmpeg.FfmpegAudioRenderer.createDecoder(FfmpegAudioRenderer.java:35)
        at com.google.android.exoplayer2.audio.SimpleDecoderAudioRenderer.maybeInitDecoder(SimpleDecoderAudioRenderer.java:594)
    	... 7 common frames omitted
D/EventLogger: downstreamFormat [eventTime=2.24, mediaPos=0.00, window=0, period=0, id=354/4165, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, channels=0, sample_rate=48000]
I/OMXClient: Treble IOmx obtained
V/AVUtils: AVUtils::getComponentRole
I/AmAVUtils: AmAVUtils::isAudioExtendFormat input = audio/mp4a-latm
I/ACodec: codec does not support config priority (err -2147483648)
I/ACodec: codec does not support config operating rate (err -2147483648)
D/EventLogger: decoderInitialized [eventTime=2.28, mediaPos=0.00, window=0, period=0, audio, OMX.google.aac.decoder]
D/EventLogger: decoderInputFormat [eventTime=2.28, mediaPos=0.00, window=0, period=0, audio, id=354/4165, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, channels=0, sample_rate=48000]
E/ACodec: [OMX.google.aac.decoder] ERROR(0x80001001)
E/ACodec: signalError(omxError 0x80001001, internalError -2147483648)
E/MediaCodec: Codec reported err 0x80001001, actionCode 0, while in state 6
E/ExoPlayerImplInternal: Renderer error: index=1, type=audio, format=Format(354/4165, null, null, audio/mp4a-latm, mp4a.40.2, -1, null, [-1, -1, -1.0], [0, 48000]), rendererSupport=YES
    com.google.android.exoplayer2.ExoPlaybackException: java.lang.IllegalStateException
        at com.google.android.exoplayer2.BaseRenderer.createRendererException(BaseRenderer.java:333)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:826)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:789)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:384)
        at android.os.Handler.dispatchMessage(Handler.java:101)
        at android.os.Looper.loop(Looper.java:164)
        at android.os.HandlerThread.run(HandlerThread.java:65)
     Caused by: java.lang.IllegalStateException
        at android.media.MediaCodec.native_dequeueInputBuffer(Native Method)
        at android.media.MediaCodec.dequeueInputBuffer(MediaCodec.java:2559)
        at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.dequeueInputBufferIndex(SynchronousMediaCodecAdapter.java:41)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1191)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:813)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:789) 
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:384) 
        at android.os.Handler.dispatchMessage(Handler.java:101) 
        at android.os.Looper.loop(Looper.java:164) 
        at android.os.HandlerThread.run(HandlerThread.java:65) 

Most probably track info is incorrectly parsed from MPEG-TS. Format looks incorrect (channels number?):

id=354/4165, mimeType=audio/mp4a-latm, codecs=mp4a.40.2, channels=0, sample_rate=48000

From MediaInfo:

Audio
ID                                       : 4165 (0x1045)
Menu ID                                  : 354 (0x162)
Format                                   : AAC LC
Format/Info                              : Advanced Audio Codec Low Complexity
Format version                           : Version 2
Muxing mode                              : ADTS
Codec ID                                 : 15-2
Duration                                 : 33 s 664 ms
Bit rate mode                            : Variable
Channel(s)                               : 2 channels
Channel layout                           : L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 46.875 FPS (1024 SPF)
Compression mode                         : Lossy
Delay relative to video                  : -80 ms

Same stream and local file plays well in VLC and mplayer (using ffmpeg):

Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
AUDIO: 48000 Hz, 2 ch, floatle, 0.0 kbit/0.00% (ratio: 0->384000)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))

[REQUIRED] Reproduction steps

Play provided video in demo player

[REQUIRED] Link to test content

[REQUIRED] A full bug report captured from the device

This is not device-specific, but here it is:

[REQUIRED] Version of ExoPlayer being used

  • 67b29bb
    Init 7341500 [ExoPlayerLib/2.11.3] [once, MIBOX3, Xiaomi, 26]

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

Init 7341500 [ExoPlayerLib/2.11.3] [once, MIBOX3, Xiaomi, 26]

@marcbaechinger
Copy link
Contributor

Thanks for reporting!
I can repro this. It needs some further investigation.

@isabsent
Copy link

isabsent commented Jun 9, 2020

I have the same problem on Xiaomi Redmi 7 and Xiaomi Mi 9 SE trying to playback .mp4 file from phone file system with my own ExoView app:.

2020-06-09 19:53:13.238 858-23993/? E/SoftMP3: mp3 decoder returned error 1
2020-06-09 19:53:13.238 23307-23992/com.github.isabsent E/ACodec: [OMX.google.mp3.decoder] ERROR(0x80001001)
2020-06-09 19:53:13.238 23307-23992/com.github.isabsent E/ACodec: signalError(omxError 0x80001001, internalError -2147483648)
2020-06-09 19:53:13.238 23307-23992/com.github.isabsent E/MediaCodec: Codec reported err 0x80001001, actionCode 0, while in state 6
2020-06-09 19:53:13.246 23307-23979/com.github.isabsent E/ExoPlayerImplInternal: Renderer error: index=1, type=audio, format=Format(2, null, null, audio/mpeg, null, -1, und, [-1, -1, -1.0], [2, 48000]), 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:735)
        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:201)
        at android.os.HandlerThread.run(HandlerThread.java:65)
     Caused by: java.lang.IllegalStateException
        at android.media.MediaCodec.native_queueInputBuffer(Native Method)
        at android.media.MediaCodec.queueInputBuffer(MediaCodec.java:2359)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.feedInputBuffer(MediaCodecRenderer.java:1195)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:722)
        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:201) 
        at android.os.HandlerThread.run(HandlerThread.java:65) 
2020-06-09 19:53:13.247 573-650/? W/SurfaceFlinger: Attempting to set client state on removed layer: android/com.android.internal.app.ResolverActivity#0
2020-06-09 19:53:13.247 573-650/? W/SurfaceFlinger: Attempting to destroy on removed layer: android/com.android.internal.app.ResolverActivity#0
2020-06-09 19:53:13.250 23323-23323/? D/EventBus: [23323, u0] send(AppTransitionFinishedEvent)
2020-06-09 19:53:13.250 23323-23323/? D/EventBus: [23323, u0]  -> ForcedResizableInfoActivityController [0x64d6c07, P1] onBusEvent(AppTransitionFinishedEvent)
2020-06-09 19:53:13.250 23323-23323/? D/EventBus: [23323, u0] onBusEvent(AppTransitionFinishedEvent) duration: 28 microseconds, avg: 1760
2020-06-09 19:53:13.257 23307-23983/com.github.isabsent W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2020-06-09 19:53:13.258 23307-23983/com.github.isabsent W/MapperHal: buffer descriptor with invalid usage bits 0x2000
2020-06-09 19:53:13.260 858-23826/? E/OMXNodeInstance: getConfig(0xf1d9e884:qcom.decoder.mpeg4, ??(0x7f000062)) ERROR: UnsupportedSetting(0x80001019)
2020-06-09 19:53:13.261 23307-23979/com.github.isabsent 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:777)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onDisabled(MediaCodecRenderer.java:636)
        at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.onDisabled(MediaCodecAudioRenderer.java:717)
        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:201)
        at android.os.HandlerThread.run(HandlerThread.java:65)
2020-06-09 19:53:13.263 573-2190/? W/SurfaceFlinger: Attempting to set client state on removed layer: Dim Layer for - Task=12656#0
2020-06-09 19:53:13.263 573-2190/? W/SurfaceFlinger: Attempting to destroy on removed layer: Dim Layer for - Task=12656#0
2020-06-09 19:53:13.275 23307-23983/com.github.isabsent D/SurfaceUtils: set up nativeWindow 0x7bfc00e010 for 176x144, color 0x7fa30c06, rotation 0, usage 0x20002900
2020-06-09 19:53:13.292 23307-23982/com.github.isabsent D/SurfaceUtils: disconnecting from surface 0x7bfc00e010, reason disconnectFromSurface
2020-06-09 19:53:13.294 858-1081/? I/OMX-VDEC-1080P: omx_vdec::component_deinit() complete
2020-06-09 19:53:13.297 858-1081/? I/OMX-VDEC-1080P: Exit OMX vdec Destructor: fd=8
2020-06-09 19:53:13.297 858-1081/? I/OMX-VDEC-1080P: Video slvp perflock released
2020-06-09 19:53:13.314 23307-23979/com.github.isabsent E/ExoPlayerImplInternal: Reset failed.
      java.lang.IllegalStateException
        at android.media.MediaCodec.native_stop(Native Method)
        at android.media.MediaCodec.stop(MediaCodec.java:2084)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.releaseCodec(MediaCodecRenderer.java:671)
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onReset(MediaCodecRenderer.java:643)
        at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.onReset(MediaCodecAudioRenderer.java:727)
        at com.google.android.exoplayer2.BaseRenderer.reset(BaseRenderer.java:175)
        at com.google.android.exoplayer2.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:900)
        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:201)
        at android.os.HandlerThread.run(HandlerThread.java:65)

When I playback the same file from the same place with the same ExoView application on other device Alcatel 1S 5028Y (Android 10) there is no problem.

ExoPlayer version is 2.11.4. I can give you any additional info if you are interested.

@dfdgsdfg
Copy link

Any updates?

@GustavoMoreiraPT
Copy link

GustavoMoreiraPT commented Feb 12, 2021

I am also facing the same issue when trying to use MediaCodec to decode audio and stream it through the SynthesisCallback from android.

E/ACodec: [OMX.google.mp3.decoder] ERROR(0x80001001) signalError(omxError 0x80001001, internalError -2147483648) E/MediaCodec: Codec reported err 0x80001001, actionCode 0, while in state 6

The code I have currently implemented works the majority of the times, except for the first time I try to play audio after starting my app.
After failing once or twice every time I press the "play" button audio streams smoothly.
Can it be an initialization error?
I also have noticed that this error happens in different stages of the decoding, which makes me wonder if I am failing to read the documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants