Fix handling of repeated EOS in SilenceSkippingAudioProcessor.

Issue: androidx/media#712
PiperOrigin-RevId: 589882412
(cherry picked from commit 90a0cbdf3d3c5314915d5fda5eecb93c18bc7bef)
This commit is contained in:
samrobinson 2023-12-11 11:14:22 -08:00 committed by microkatz
parent e509db273d
commit 89baa96e32
2 changed files with 6 additions and 1 deletions

View File

@ -19,6 +19,8 @@
`ROLE_FLAG_ALTERNATE` to prevent them being automatically selected for `ROLE_FLAG_ALTERNATE` to prevent them being automatically selected for
playback because of their higher resolution. playback because of their higher resolution.
* Audio: * Audio:
* Fix handling of EOS for `SilenceSkippingAudioProcessor` when called
multiple times ([#712](https://github.com/androidx/media/issues/712)).
* Video: * Video:
* Add workaround for a device issue on Galaxy Tab S7 FE, Chromecast with * Add workaround for a device issue on Galaxy Tab S7 FE, Chromecast with
Google TV, and Lenovo M10 FHD Plus that causes 60fps AVC streams to be Google TV, and Lenovo M10 FHD Plus that causes 60fps AVC streams to be

View File

@ -189,8 +189,11 @@ public final class SilenceSkippingAudioProcessor extends BaseAudioProcessor {
@Override @Override
protected void onQueueEndOfStream() { protected void onQueueEndOfStream() {
if (maybeSilenceBufferSize > 0) { if (maybeSilenceBufferSize > 0) {
// We haven't received enough silence to transition to the silent state, so output the buffer. // We haven't received enough silence to transition to the silent state, so output the buffer
// and switch back to the noisy state.
output(maybeSilenceBuffer, maybeSilenceBufferSize); output(maybeSilenceBuffer, maybeSilenceBufferSize);
maybeSilenceBufferSize = 0;
state = STATE_NOISY;
} }
if (!hasOutputNoise) { if (!hasOutputNoise) {
skippedFrames += paddingSize / bytesPerFrame; skippedFrames += paddingSize / bytesPerFrame;