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.69k stars 6.01k forks source link

MediaCodecAudioRenderer error when playing flac from demo app #8261

Open theli opened 3 years ago

theli commented 3 years ago

Issue description

Errors when playing flac files from the demo app on Nokia 8 device with Android 9, model TA-1004. The build-in flac sample provided in the demo can’t be played at all and returns an error

com.google.android.exoplayer2.ExoPlaybackException: MediaCodecAudioRenderer error, index=3, format=Format(null, null, null, audio/flac, null, -1, null, [-1, -1, -1.0], [2, 44100]), format_supported=YES
        at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:542)
        at android.os.Handler.dispatchMessage(Handler.java:103)
        at android.os.Looper.loop(Looper.java:198)
        at android.os.HandlerThread.run(HandlerThread.java:65)
     Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecDecoderException: Decoder failed: OMX.qti.audio.decoder.flac
        at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.createDecoderException(MediaCodecRenderer.java:984)

I have added by own flac files to the demo app and was able to play them however there are permanent errors in the console and the progress of the track moves faster than it should, probably because the frames are skipped. Both errors happen with checkbox “Prefer Extension Decoders” On and Off. 2020-11-22 09:34:20.413 11101-29120/com.google.android.exoplayer2.demo E/AudioTrack: Discontinuity detected [expected 1950476, got 2229115]

Reproduction steps

In the Exoplayer demo app choose Misc section, then Google Play (FLAC) to reproduce MediaCodecAudioRenderer error. To reproduce “Discontinuity Detected” error try to play any file from the FLAC section with my flac content.

Link to test content

json file emailed.

A full bug report captured from the device

full bug report emailed.

Version of ExoPlayer being used

2.12.1

Device(s) and version(s) of Android being used

Nokia 8 with Android 9. The simulator and few other devices we tested demo app did not have such errors.

Attached are both logs for the error with google flac sample and for “Discontinuity detected” errors. error_MediaCodecAudioRenderer.log error_discontinuity.log

Arunkarthicknallasami commented 3 years ago

I too have same issue, any update?

AquilesCanta commented 3 years ago

Please provide a bugreport captured shortly after playing the problematic media in the problematic device using the demo app, as requested in the issue template.

theli commented 3 years ago

Bug report provided via email. If there is any additional information needed, please let me know.

AquilesCanta commented 3 years ago

Hi, the provided bugreport doesn't include the stacktrace that you provided in the original post. Please provide a bugreport (captured by running adb bugreport on the command line) captured shortly after experiencing the described issue in the ExoPlayer demo app. In order to ensure that the bugreport is useful, please use the demo app and check that the bugreport contains the ExoPlaybackException described above.

theli commented 3 years ago

I did as suggested but I am not seeing this error in adb report. I can get it from logcat. When I play a file in demo app I get Playback Failed message and exception in logcat however it does not crash.

rahadian347 commented 3 years ago

is there any solution for this bug ? i got it in my android device with custom ROM Havoc OS

lwld commented 3 years ago

We also noticed an issue with flac on some customer devices with decoder OMX.qti.audio.decoder.flac. Probably the same problem, otherwise let me know to create a new ticket.

We managed to reproduce it on a Sony Xperia XZ1. ExoPlayer cosistently fails with a com.google.android.exoplayer2.ExoPlaybackException, caused by com.google.android.exoplayer2.mediacodec.MediaCodecDecoderException when playing flac. It also occurs on some other brands/devices, including other older devices of the Xperia XZ series. If helpful, I can search for a few other devices with the problem in our Crashlytics reports.

We also reproduced it with the ExoPlayer demo app playing Misc -> Google Play (FLAC) and created a bug report.

Attaching a logcat extract and adb bugreport. If you need any more info, let me know.

exoplayer_demo_flac_logs.txt bugreport-G8342-47.2.A.11.228-2021-05-28-18-48-28.zip

ojw28 commented 3 years ago

It looks like we're already aware that this particular decoder doesn't work well on older devices:

https://github.com/google/ExoPlayer/blob/r2.14.0/library/core/src/main/java/com/google/android/exoplayer2/mediacodec/MediaCodecUtil.java#L583

If you're seeing errors where this decoder is being used on older devices, that implies the device doesn't have another FLAC decoder that can be used instead. Given this, I'm not sure we can do anything in ExoPlayer to help with the situation, other than recommend that you use the FLAC extension, which would allow you to avoid using the problematic decoder.

changxiangzhong commented 2 years ago

I've encountered this issue today as well, and the ExoPlayer did not choose OMX.qti.audio.decoder.flac, it chose OMX.google.flac.decoder, but the result was not good either. Our SOC is BRCM72180. So yes, it seems like software flac decoder/extension is the way to go.

Here are the ExoPlayer logs ```2022-04-27 16:52:15.816 30691-30750/com.xxx W/MediaCodecRenderer: Preferred decoder instantiation failed. Sleeping for 50ms then retrying. 2022-04-27 16:52:15.869 30691-30770/com.xxx I/OMXClient: IOmx service obtained 2022-04-27 16:52:15.874 30691-30770/com.xxx I/ACodec: codec does not support config priority (err -2147483648) 2022-04-27 16:52:15.874 30691-30770/com.xxx I/ACodec: codec does not support config operating rate (err -2147483648) 2022-04-27 16:52:15.887 30691-30770/com.xxx E/MediaCodec: queueCSDInputBuffer failed w/ error -22 2022-04-27 16:52:15.893 30691-30750/com.xxx E/ExoPlayerImplInternal: Playback error com.google.android.exoplayer2.ExoPlaybackException: Unexpected runtime error at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:625) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:214) at android.os.HandlerThread.run(HandlerThread.java:67) Caused by: java.lang.IllegalArgumentException at android.media.MediaCodec.native_dequeueOutputBuffer(Native Method) at android.media.MediaCodec.dequeueOutputBuffer(MediaCodec.java:2790) at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.dequeueOutputBufferIndex(SynchronousMediaCodecAdapter.java:106) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1806) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:792) at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:998) at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:499) at android.os.Handler.dispatchMessage(Handler.java:103)  at android.os.Looper.loop(Looper.java:214)  at android.os.HandlerThread.run(HandlerThread.java:67)  2022-04-27 16:52:15.896 30691-30750/com.xxx E/ExoPlayerImplInternal: Disable failed. java.lang.IllegalArgumentException at android.media.MediaCodec.native_flush(Native Method) at android.media.MediaCodec.flush(MediaCodec.java:2195) at com.google.android.exoplayer2.mediacodec.SynchronousMediaCodecAdapter.flush(SynchronousMediaCodecAdapter.java:166) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.flushCodec(MediaCodecRenderer.java:864) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.flushOrReleaseCodec(MediaCodecRenderer.java:857) at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onDisabled(MediaCodecRenderer.java:710) at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.onDisabled(MediaCodecAudioRenderer.java:603) at com.google.android.exoplayer2.BaseRenderer.disable(BaseRenderer.java:186) at com.google.android.exoplayer2.ExoPlayerImplInternal.disableRenderer(ExoPlayerImplInternal.java:1671) at com.google.android.exoplayer2.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:1411) at com.google.android.exoplayer2.ExoPlayerImplInternal.stopInternal(ExoPlayerImplInternal.java:1374) at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:627) at android.os.Handler.dispatchMessage(Handler.java:103) at android.os.Looper.loop(Looper.java:214) at android.os.HandlerThread.run(HandlerThread.java:67) ```
Here are the logcat logs, which indicates OMX.google.flac.decoder is selected. ``` 04-27 15:46:23.300 25355 25748 I OMXClient: IOmx service obtained 04-27 15:46:23.300 3709 22193 I OMXMaster: makeComponentInstance(OMX.google.flac.decoder) in android.hardwar process 04-27 15:46:23.307 3515 3515 I hfrvideo: Found 7/9 key processes 04-27 15:46:23.308 3515 3515 I bcm-hidl-dh: do_hfrvideo(0) returns 0 04-27 15:46:23.308 3515 3515 I bcm-hidl-dh: do_rac(0) returns -1 04-27 15:46:23.331 3709 22193 E OMXNodeInstance: setConfig(0xec91c0a0:google.flac.decoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001) 04-27 15:46:23.331 25355 25748 I ACodec : codec does not support config priority (err -2147483648) 04-27 15:46:23.331 3709 22193 E OMXNodeInstance: setConfig(0xec91c0a0:google.flac.decoder, ConfigOperatingRate(0x6f800003)) ERROR: Undefined(0x80001001) 04-27 15:46:23.331 25355 25748 I ACodec : codec does not support config operating rate (err -2147483648) 04-27 15:46:23.332 3709 22193 E OMXNodeInstance: getConfig(0xec91c0a0:google.flac.decoder, ConfigAndroidVendorExtension(0x6f100004)) ERROR: Undefined(0x80001001) 04-27 15:46:23.370 25355 25748 E MediaCodec: queueCSDInputBuffer failed w/ error -22 04-27 15:46:23.389 25355 25738 W MediaCodecRenderer: Preferred decoder instantiation failed. Sleeping for 50ms then retrying. 04-27 15:46:23.443 25355 25751 I OMXClient: IOmx service obtained 04-27 15:46:23.444 3709 9062 I OMXMaster: makeComponentInstance(OMX.google.flac.decoder) in android.hardwar process 04-27 15:46:23.453 3709 9062 E OMXNodeInstance: setConfig(0xec91c040:google.flac.decoder, ConfigPriority(0x6f800002)) ERROR: Undefined(0x80001001) 04-27 15:46:23.453 25355 25751 I ACodec : codec does not support config priority (err -2147483648) 04-27 15:46:23.453 3709 9062 E OMXNodeInstance: setConfig(0xec91c040:google.flac.decoder, ConfigOperatingRate(0x6f800003)) ERROR: Undefined(0x80001001) 04-27 15:46:23.453 25355 25751 I ACodec : codec does not support config operating rate (err -2147483648) 04-27 15:46:23.454 3709 9062 E OMXNodeInstance: getConfig(0xec91c040:google.flac.decoder, ConfigAndroidVendorExtension(0x6f100004)) ERROR: Undefined(0x80001001) 04-27 15:46:23.484 25355 25751 E MediaCodec: queueCSDInputBuffer failed w/ error -22 ```
Here are the video file info ``` Stream #0:0: Video: h264 (High), yuv420p(tv, bt709/unknown/unknown, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 1k tbn, 50 tbc (default) Metadata: BPS : 12060797 DURATION : 00:56:57.040000000 NUMBER_OF_FRAMES: 85426 NUMBER_OF_BYTES : 5151528450 _STATISTICS_WRITING_APP: mkvmerge v57.0.0 ('Till The End') 64-bit _STATISTICS_WRITING_DATE_UTC: 2021-07-20 18:11:09 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:1(eng): Audio: flac, 48000 Hz, stereo, s16 (default) Metadata: BPS : 476255 DURATION : 00:56:58.800000000 NUMBER_OF_FRAMES: 40065 NUMBER_OF_BYTES : 203527692 _STATISTICS_WRITING_APP: mkvmerge v57.0.0 ('Till The End') 64-bit _STATISTICS_WRITING_DATE_UTC: 2021-07-20 18:11:09 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES Stream #0:2(eng): Subtitle: hdmv_pgs_subtitle, 1920x1080 Metadata: title : SDH BPS : 48376 DURATION : 00:56:12.440000000 NUMBER_OF_FRAMES: 1982 NUMBER_OF_BYTES : 20393204 _STATISTICS_WRITING_APP: mkvmerge v57.0.0 ('Till The End') 64-bit _STATISTICS_WRITING_DATE_UTC: 2021-07-20 18:11:09 _STATISTICS_TAGS: BPS DURATION NUMBER_OF_FRAMES NUMBER_OF_BYTES ```
jambestwick commented 2 years ago

07-09 09:50:35.299 452 520 I OMXClient: IOmx service obtained 07-09 09:50:35.299 458 458 I OMXMaster: makeComponentInstance(OMX.google.amrnb.decoder) in omx@1.0-service process 07-09 09:50:35.303 713 713 I Zygote : seccomp disabled by setenforce 0 07-09 09:50:35.306 548 565 W ActivityManager: Slow operation: 133ms so far, now at startProcess: returned from zygote! 07-09 09:50:35.306 548 565 W ActivityManager: Slow operation: 133ms so far, now at startProcess: done updating battery stats 07-09 09:50:35.306 548 565 W ActivityManager: Slow operation: 133ms so far, now at startProcess: building log message 07-09 09:50:35.306 548 565 I ActivityManager: Start proc 713:WebViewLoader-armeabi-v7a/1037 [android.webkit.WebViewLibraryLoader$RelroFileCreator] for 07-09 09:50:35.306 548 565 W ActivityManager: Slow operation: 133ms so far, now at startProcess: starting to update pids map 07-09 09:50:35.306 548 565 W ActivityManager: Slow operation: 133ms so far, now at startProcess: done updating pids map 07-09 09:50:35.306 548 565 W ActivityManager: Slow operation: 133ms so far, now at startProcess: asking zygote to start proc 07-09 09:50:35.311 548 548 I GnssLocationProvider: WakeLock acquired by sendMessage(INITIALIZE_HANDLER, 0, null) 07-09 09:50:35.312 452 520 I OMXClient: IOmx service obtained 07-09 09:50:35.313 548 562 D GnssLocationProvider: Link to death notification successful 07-09 09:50:35.313 458 458 I OMXMaster: makeComponentInstance(OMX.google.amrwb.decoder) in omx@1.0-service process 07-09 09:50:35.314 279 279 W u-blox : getExtensionAGnss getExtensionAGnss function called. 07-09 09:50:35.315 279 279 W u-blox : getExtensionGnssNi getExtensionGnssNi function called. 07-09 09:50:35.315 548 548 W LocationManagerService: no network location provider found 07-09 09:50:35.315 279 279 W u-blox : getExtensionGnssGeofencing getExtensionGnssGeofencing function called. 07-09 09:50:35.317 548 562 D GnssLocationProvider: gnssSetCapabilitesCb: 209u 07-09 09:50:35.317 548 562 D GnssLocationProvider: gnssSetSystemInfoCb: yearOfHw=2015 07-09 09:50:35.318 279 279 V u-blox : ublox::CGnssXtraExtension::setCallback: GnssXtraExtension initialized successfully! 07-09 09:50:35.318 548 562 I GnssLocationProvider: Unable to Initialize AGnss interface 07-09 09:50:35.318 548 562 I GnssLocationProvider: Unable to initialize GNSS Geofencing interface 07-09 09:50:35.318 548 562 I GnssLocationProvider: Unable to initialize GNSS NI interface 07-09 09:50:35.319 548 548 E LocationManagerService: no geocoder provider found 07-09 09:50:35.319 279 301 V u-blox : handleCmdInput: (2731545840): Cmd received (2) 07-09 09:50:35.320 279 301 V u-blox : CAndroidDatabase::decPublish: count now 0 07-09 09:50:35.320 279 301 V u-blox : engineStop: (Begin) Client count 0 07-09 09:50:35.320 279 301 V u-blox : ublox::CGnssDriver::setStatus: Driver status change: 0 => 4 07-09 09:50:35.320 279 301 V u-blox : engineStop: (End) Client count 0 07-09 09:50:35.321 548 548 D LocationManagerService: Unable to bind FLP Geofence proxy. 07-09 09:50:35.321 548 548 E ActivityRecognitionHardware: activity_recognition HAL is deprecated. is_supported is effectively a no-op 07-09 09:50:35.321 548 548 D LocationManagerService: Hardware Activity-Recognition not supported. 07-09 09:50:35.322 548 548 E ActivityRecognitionProxy: ServiceWatcher could not start. 07-09 09:50:35.322 548 548 D LocationManagerService: Unable to bind ActivityRecognitionProxy. 07-09 09:50:35.322 548 548 I GnssLocationProvider: WakeLock acquired by sendMessage(ENABLE, 1, null) 07-09 09:50:35.323 548 562 E GnssLocationProvider: no AGPS interface in set_agps_server 07-09 09:50:35.325 279 279 E u-blox : setSuplVersion: SUPL is not supported. 07-09 09:50:35.325 548 565 W ActivityManager: Slow operation: 152ms so far, now at startProcess: returned from zygote! 07-09 09:50:35.325 666 666 I LatinIME: Hardware accelerated drawing: true 07-09 09:50:35.325 548 565 W ActivityManager: Slow operation: 152ms so far, now at startProcess: done updating battery stats 07-09 09:50:35.325 548 565 W ActivityManager: Slow operation: 152ms so far, now at startProcess: building log message 07-09 09:50:35.325 548 565 I ActivityManager: Start proc 726:WebViewLoader-arm64-v8a/1037 [android.webkit.WebViewLibraryLoader$RelroFileCreator] for 07-09 09:50:35.326 548 565 W ActivityManager: Slow operation: 152ms so far, now at startProcess: starting to update pids map 07-09 09:50:35.326 452 520 I OMXClient: IOmx service obtained 07-09 09:50:35.326 548 565 W ActivityManager: Slow operation: 152ms so far, now at startProcess: done updating pids map