[go: nahoru, domu]

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

Audio sink error when setPreferredAudioDevice with offload mode enable #611

Open
1 task
zling123 opened this issue Aug 25, 2023 · 3 comments
Open
1 task
Assignees

Comments

@zling123
Copy link

Version

Media3 1.1.1

More version details

No response

Devices that reproduce the issue

Android SDK33

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

  1. Connect the Bluetooth headset to the device.
  2. Enable offload mode in app.
  3. start playback opus media 5 seconds, then pause 1s, then use setPreferredAudioDevice(AudioDeviceInfo.TYPE_BUILTIN_SPEAKER) to switch device, then resume playback 5s, then stop.

Expected result

the media play 5s using bt-headset, pause 1s, then play 5s using speaker, then stop.

Actual result

the media play 5s using bt-headset, pause 1s, then no voice can be heard in both bt-headset and speaker for 6s(1s for pause), then stop.
When disable Offload mode, the result is as expected.
And I confirm OPUS offload playback is supported on my device.
The logcat shows Audio sink error.
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: Audio sink error
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: androidx.media3.exoplayer.audio.AudioSink$WriteException: AudioTrack write failed: -6
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: at androidx.media3.exoplayer.audio.DefaultAudioSink.writeBuffer(DefaultAudioSink.java:1164)
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: at androidx.media3.exoplayer.audio.DefaultAudioSink.processBuffers(DefaultAudioSink.java:1056)
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: at androidx.media3.exoplayer.audio.DefaultAudioSink.handleBuffer(DefaultAudioSink.java:978)
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: at androidx.media3.exoplayer.audio.MediaCodecAudioRenderer.processOutputBuffer(MediaCodecAudioRenderer.java:712)
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.bypassRender(MediaCodecRenderer.java:2246)
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:811)
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1047)
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:522)
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: at android.os.Handler.dispatchMessage(Handler.java:102)
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: at android.os.Looper.loopOnce(Looper.java:205)
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: at android.os.Looper.loop(Looper.java:294)
08-21 18:40:26.352 7502 7547 E MediaCodecAudioRenderer: at android.os.HandlerThread.run(HandlerThread.java:67)

Media

Not applicable

Bug Report

@tonihei
Copy link
Collaborator
tonihei commented Aug 30, 2023

@microkatz Could you take a look?

@zling123
Copy link
Author
zling123 commented Nov 7, 2023

Any update here?

@zling123
Copy link
Author
zling123 commented Nov 9, 2023

I found a similar issue 627. So, I tried the latest version 1.2.0-rc01, but still AudioTrack write failed and no audio can be heard after setPreferredAudioDevice. The issue still exists.
Then I tried another way.
I added the code 3742f6b to the release branch. The log still shows AudioTrack write failed, but audio can be heard after setPreferredAudioDevice. The log shows it is using deep-buffer-playback rather than compress-offload-playback after setPreferredAudioDevice.

@microkatz I hope this can provide you with some useful information.

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

No branches or pull requests

3 participants