-
Notifications
You must be signed in to change notification settings - Fork 6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Drain audio processors on reconfiguration
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
- Loading branch information
1 parent
83545fb
commit 31911ca
Showing
6 changed files
with
99 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters