Closed
Description
This bug was first observed after updating from ExoPlayer 2.11.8
to 2.12.0
and still happens with latest ExoPlayer 2.16.0
.
I haven't been able to reproduce the bug myself yet but I've received many bug reports from my users. The bug happens when Bluetooth headset is connected, start playing will fail with AudioTrack init failed
. Disconnecting the Bluetooth headset, then it will start play without any issue.
com.google.android.exoplayer2.ExoPlaybackException: MediaCodecAudioRenderer error, index=1, format=Format(null, null, null, audio/raw, null, -1, null, [-1, -1, -1.0], [2, 44100]), format_supported=YES
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(SourceFile:43)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:164)
at android.os.HandlerThread.run(HandlerThread.java:65)
Caused by: e.b.b.b.o3.u$b: AudioTrack init failed 0 Config(44100, 12, 1058400)
at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.buildAudioTrack(SourceFile:5)
at com.google.android.exoplayer2.audio.DefaultAudioSink.buildAudioTrack(SourceFile:2)
at com.google.android.exoplayer2.audio.DefaultAudioSink.initializeAudioTrack(SourceFile:2)
at com.google.android.exoplayer2.audio.DefaultAudioSink.handleBuffer(SourceFile:16)
at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.processOutputBuffer(SourceFile:7)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.drainOutputBuffer(SourceFile:32)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(SourceFile:16)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(SourceFile:14)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(SourceFile:25)
My player code is:
val renderersFactory = DefaultRenderersFactory(context)
renderersFactory.setEnableAudioTrackPlaybackParams(true)
val adaptiveTrackSelectionFactory = AdaptiveTrackSelection.Factory()
val trackSelector = DefaultTrackSelector(DefaultTrackSelector.Parameters.DEFAULT_WITHOUT_CONTEXT, adaptiveTrackSelectionFactory)
player = ExoPlayer.Builder(context, renderersFactory)
.setTrackSelector(trackSelector)
.build()
This bug mostly happens on low end devices but it can also happen on high end devices such as Pixel 3.
Any help is appreciated.