-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Playing 5.1 PCM audio with tunneling mode. #6031
Labels
Comments
@andrewlewis Can you take a look at this issue? |
It looks like we can do the TODO for Oreo and above ( |
ojw28
added a commit
that referenced
this issue
Jun 18, 2019
Issue: #6031 PiperOrigin-RevId: 253784986
Thanks for the prompt response to this. Will give it a try! |
ojw28
added a commit
that referenced
this issue
Jun 19, 2019
Issue: #6031 PiperOrigin-RevId: 253784986
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
[REQUIRED] Use case description
Some audio streams contain 5.1 channel-masks. When those audio streams are decoded (instead of played as passthrough) and tunneling is enabled, ExoPlayer is unable to play audio because it is using the version 1 of the av-sync header.
Proposed solution
The only thing that is required for that feature to work is to enable the lines corresponding to this comment :
// TODO: Uncomment this when [Internal ref: b/33627517] is clarified or fixed.
in file:
"library/core/src/main/java/com/google/android/exoplayer2/audio/DefaultAudioSink.java"
The reason why enabling that code will fix the issue is below:
The tunneling audio header version 1 has a fixed header-size of 16 bytes. The AudioTrack allows to write data only in multiples of the audio track frame size and because ExoPlayer attempts to fully write the header before writing the payload, it is therefore mandatory that the header size be a multiple of the frame-size. For PCM16 (2 channels) this is not a problem because the frame-size is 4, but for other channel-mask such as 5.1 (frame-size 12) ExoPlayer will be unable to fully write the audio header and therefore unable to play any audio.
Android introduced earlier a header version 2, which contains an 'offset' field which allows the frame-header to have a variable size. ExoPlayer writes the audio header itself (version 1) but Android internally is able to write the header version 2 and also sets the header size to a multiple of the frame size. This change simply delegates the task of writing the audio header to the Android framework.
Alternatives considered
n/a
The text was updated successfully, but these errors were encountered: