adb bugreport sent via email)2020-12-05 00:38:59.567 3568-3635/? W/APM_AudioPolicyManager: getOutputForDevices() could not find output for stream 3, sampling rate 48000, format 0x9000000, channels 0x3, flags 0x1
2020-12-05 00:38:59.568 3568-3635/? E/AudioFlinger: createTrack() getOutputForAttr() return error -38 or invalid output handle
2020-12-05 00:38:59.568 2888-2954/com.example.android.persistence E/IAudioFlinger: createTrack returned error -38
2020-12-05 00:38:59.568 2888-2954/com.example.android.persistence E/AudioTrack: createTrack_l(868): AudioFlinger could not create track, status: -38 output 326484847
2020-12-05 00:38:59.569 2888-2954/com.example.android.persistence E/AudioTrack-JNI: Error -38 initializing AudioTrack
2020-12-05 00:38:59.569 2888-2954/com.example.android.persistence D/AudioTrack: gather(): no metrics gathered, track status=-38
2020-12-05 00:38:59.570 2888-2954/com.example.android.persistence E/android.media.AudioTrack: Error code -20 when initializing AudioTrack.
2020-12-05 00:38:59.581 3532-3597/? D/audio_hw_primary: out_pause(0xeb2d9a80)
2020-12-05 00:38:59.581 3532-3597/? E/audio_hw_primary: out->pcm and adev->pcm are assumed same handle
2020-12-05 00:38:59.581 3532-16733/? D/audio_hw_primary: out_flush(0xeb2d9a80)
2020-12-05 00:38:59.582 3532-16733/? I/audio_hw_primary: do_output_standby_direct,out 0xeb2d9a80
2020-12-05 00:38:59.582 3532-16733/? I/audio_spdif_out: aml_audio_set_spdif_format tinymix AML_MIXER_ID_SPDIF_FORMAT 0
2020-12-05 00:38:59.582 3532-16733/? I/audio_hwsync: aml_audio_hwsync_init done
2020-12-05 00:38:59.586 3532-16733/? I/audio_hw_primary: ++adev_release_audio_patch: handle(105)
2020-12-05 00:38:59.586 3532-16733/? I/audio_hw_primary: patch set found id 105, patchset 0xeb2c6400
2020-12-05 00:38:59.586 3532-16733/? I/audio_hw_primary: source 0 type=2 sink type =1 amk patch src=11
2020-12-05 00:38:59.586 3532-16733/? D/audio_hw_primary: unregister_audio_patch: enter
2020-12-05 00:38:59.586 3532-16733/? D/audio_hw_primary: unregister_audio_patch: exit
2020-12-05 00:38:59.586 3532-16733/? I/audio_hw_primary: --adev_release_audio_patch: after releasing patch, patch sets will be:
2020-12-05 00:38:59.592 3532-16733/? I/audio_hw_primary: out_standby_direct(0xeb2d9a80),out 0xeb2d9a80
2020-12-05 00:38:59.593 3532-16733/? I/audio_spdif_out: aml_audio_set_spdif_format tinymix AML_MIXER_ID_SPDIF_FORMAT 0
2020-12-05 00:38:59.593 3532-16733/? I/audio_hw_primary: enable rawtopcm_flag !!!
2020-12-05 00:38:59.596 2888-2954/com.example.android.persistence E/ExoPlayerImplInternal: Playback error
com.google.android.exoplayer2.ExoPlaybackException: MediaCodecAudioRenderer error, index=1, format=Format(61201/515, null, null, audio/ac3, null, -1, de, [-1, -1, -1.0], [2, 48000]), 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:214)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: com.google.android.exoplayer2.audio.AudioSink$InitializationException: AudioTrack init failed: 0, Config(48000, 12, 40000)
at com.google.android.exoplayer2.audio.DefaultAudioSink$Configuration.buildAudioTrack(DefaultAudioSink.java:1933)
at com.google.android.exoplayer2.audio.DefaultAudioSink.buildAudioTrack(DefaultAudioSink.java:845)
at com.google.android.exoplayer2.audio.DefaultAudioSink.initializeAudioTrack(DefaultAudioSink.java:639)
at com.google.android.exoplayer2.audio.DefaultAudioSink.handleBuffer(DefaultAudioSink.java:731)
at com.google.android.exoplayer2.audio.MediaCodecAudioRenderer.processOutputBuffer(MediaCodecAudioRenderer.java:623)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.bypassRender(MediaCodecRenderer.java:2143)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:852)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:892)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:467)
at android.os.Handler.dispatchMessage(Handler.java:103)聽
at android.os.Looper.loop(Looper.java:214)聽
at android.os.HandlerThread.run(HandlerThread.java:67)聽
2020-12-05 00:38:59.596 3532-16733/? D/audio_hw_primary: out_set_parameters(kvpairs(closing=true), out_device=0x400)
2020-12-05 00:38:59.596 3532-16733/? E/audio_hw_primary: Amlogic_HAL - out_set_parameters: parameter is NULL, change ret value to 0 in order to pass VTS test.
Device: Google Chromecast with GoogleTV
I gathered the following audio-only sample (copyright issues), it switches from AC3 with 5.1 to stereo and back to 5.1
This is enough to freeze the player and prompt the above error when a receiver with passthrough is the audio output.
Json for demo player:
{
"name": "Audio passthrough tests",
"samples": [
{
"name": "AC3 5.1 to 2.0 to 5.1",
"uri": "https://martb.eu/exoplayer/ac3-5.1-to-ac3.stereo-to-ac3-5.1.ts"
}
]
},
(almost )100% reproducable with a DENON AVR X2100W and X1200W sometimes the switching magically works, but most of the time it doesnt.
VLC behavior:
Just to rule out a device issue, i played the file with VLC and enabled passthrough, it correctly played the file.
But it seems like theres custom code in there to allow it: libvlc decoder: restarting module due to input format change
Kind regards and thanks for your time,
MartB
@MartB this is different than #8178 . The AudioFlinger error -38 used to happen for us during switching Audio track to AC-3 from non-AC-3 tracks. Sometimes commercials are in stereo and content is in 5.1 channel AC-3. In such case transitioning from content to commercial used to hit this error too.
We found the retry logic from 7dfdde9 , discussed in #7042 is very helpful. The AudioInit failure recovers with retries for us. We have tried this fix on AmLogic devices as well.
@sneelavara Nice, thanks for your quick reply.
I must have totally missed this commit / issue while searching.
Good to know its a known issue, you describe the exact thing thats happening in my sample file.
You can close this at will if you want im not sure if any information i provided is useful for further investigation.
@MartB I have a Denon receiver with an Android TV and assortment of other Android streamers, I can do a quick try with your stream, we have the fix @sneelavara mentioned back ported to release 2.11.
The fix deals with other unreported discontinuities just fine (we have a stream that goes AC3 to PCM and back). In our case it is HLS, so the change is technically illegal unless it is reported with an EXT-X-DISCONTINUITY tag
@stevemayhew i switched to dev-v2 with https://github.com/google/ExoPlayer/commit/7dfdde9246b28ad977ebe712e485033ee688652d and the streams work fine now.
Not sure if its a "proper" fix but for now its enough.
Thanks for the offer though!
Okay sadly the new dev-v2 branch only works with compileSDK Version set to 30, which kinda crashes my app with a SIGSEGV randomly on api level 29 devices.
That did not happen on the old exoplayer, so im not quite sure whats going on here.
Is there any chance that someone backported this to 2.12?
@MartB we did port 7dfdde9 to 2.11. Not explored 2.12 yet since we are still on 2.11. But the change 7dfdde9 appears simple and can be easily ported.
Just to rule out a device issue, i played the file with VLC and enabled passthrough, it correctly played the file.
I believe that vlc does not use audio passthrough, it decodes the ac3 and plays pcm. ExoPlayer on the other hand prefers passthrough as it is more power efficient and more format are usually supported.
I'm guessing the issue is that as audio tracks are released asynchronously by the framework, AC3 5.1 resources are not yet released when requesting an AC3 stereo audio track. 7dfdde9 should indeed solve the issue as
@MartB we did port 7dfdde9 to 2.11. Not explored 2.12 yet since we are still on 2.11. But the change 7dfdde9 appears simple and can be easily ported.
Unfortunately 7dfdde9 is not present in 2.12. 2.13 will contain it. Nevertheless as @sneelavara pointed out, it should be fairly easy to port.
@krocard i set vlc to passthrough in the settings.
I dont know what it does internally but my receiver recognized the format correctly.
Yeah the commit is working fine for me.
I don't know what it does internally but my receiver recognized the format correctly.
Interesting, vlc may still decode it locally, or may not create a new audioTrack and assume the decoder can handle the format change or take more time to create the new audioTrack or also have retry mechanism. I don't think it is worth investigating though if the retry solves your issue.
Yeah the commit is working fine for me.
Great, thanks for the confirming.