mirror of
https://github.com/samsonjs/media.git
synced 2026-04-01 10:35:48 +00:00
Previously we would get a new AudioTrack and flush all audio processors if any AudioProcessor needed to be flushed on reconfiguration. This was problematic for the case of TrimmingAudioProcessor because it could become active or inactive due to transitioning to a period with gapless metadata or without it (we don't keep it active all the time because it is wasteful to populate its end buffer for content that is not gapless). This change handles the case where we don't need an AudioTrack but AudioProcessors do need to be flushed. In this case we drain all the audio processors when next handling data then switch to the new configuration. This avoids truncation when period transitions change whether TrimmingAudioProcessor is active but don't require a new AudioTrack, and is also a step towards draining the AudioTrack when transitioning between periods if we do need a new AudioTrack. To do this, it needs to be possible to drain any pending output data from an AudioProcessor after it's configured to a new format, so this change makes sure AudioProcessors allow calling playToEndOfStream and getOutput after reconfiguration and before flush. PiperOrigin-RevId: 234033552 |
||
|---|---|---|
| .. | ||
| src/main | ||
| build.gradle | ||
| README.md | ||
ExoPlayer GVR extension
The GVR extension wraps the Google VR SDK for Android. It provides a GvrAudioProcessor, which uses GvrAudioSurround to provide binaural rendering of surround sound and ambisonic soundfields.
Getting the extension
The easiest way to use the extension is to add it as a gradle dependency:
implementation 'com.google.android.exoplayer:extension-gvr:2.X.X'
where 2.X.X is the version, which must match the version of the ExoPlayer
library being used.
Alternatively, you can clone the ExoPlayer repository and depend on the module locally. Instructions for doing this can be found in ExoPlayer's top level README.
Using the extension
- If using
DefaultRenderersFactory, overrideDefaultRenderersFactory.buildAudioProcessorsto return aGvrAudioProcessor. - If constructing renderers directly, pass a
GvrAudioProcessortoMediaCodecAudioRenderer's constructor.
Links
- Javadoc: Classes matching
com.google.android.exoplayer2.ext.gvr.*belong to this module.