Fix handling of repeated EOS in SilenceSkippingAudioProcessor.

Issue: androidx/media#712
PiperOrigin-RevId: 589882412
This commit is contained in:
samrobinson 2023-12-11 11:14:22 -08:00 committed by Copybara-Service
parent d356d88c4f
commit 90a0cbdf3d
2 changed files with 6 additions and 1 deletions

View file

@ -54,6 +54,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;