Skip to content

Commit 38d5635

Browse files
tianyifSheenaChhabra
authored andcommitted
Report the skipped silence more deterministically
Issue: #1035 #minor-release PiperOrigin-RevId: 605361126 (cherry picked from commit 9b0cdde)
1 parent e492e37 commit 38d5635

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

RELEASENOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
* Improve silence skipping algorithm with smooth volume ramp, retained
2020
minimal silence and more natural silence durations
2121
([#7423](https://github.com/google/ExoPlayer/issues/7423)).
22+
* Report the skipped silence more deterministically
23+
([#1035](https://github.com/androidx/media/issues/1035)).
2224
* Video:
2325
* Text:
2426
* Metadata:

libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio/DefaultAudioSink.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public final class DefaultAudioSink implements AudioSink {
9999
private static final int AUDIO_TRACK_SMALLER_BUFFER_RETRY_SIZE = 1_000_000;
100100

101101
/** The minimum duration of the skipped silence to be reported as discontinuity. */
102-
private static final int MINIMUM_REPORT_SKIPPED_SILENCE_DURATION_US = 1_000_000;
102+
private static final int MINIMUM_REPORT_SKIPPED_SILENCE_DURATION_US = 300_000;
103103

104104
/**
105105
* The delay of reporting the skipped silence, during which the default audio sink checks if there
@@ -2340,10 +2340,8 @@ private void maybeReportSkippedSilence() {
23402340
if (accumulatedSkippedSilenceDurationUs >= MINIMUM_REPORT_SKIPPED_SILENCE_DURATION_US) {
23412341
// If the existing silence is already long enough, report the silence
23422342
listener.onSilenceSkipped();
2343+
accumulatedSkippedSilenceDurationUs = 0;
23432344
}
2344-
// Reset the accumulated silence anyway as the later silences are far from the current one
2345-
// and should be treated separately.
2346-
accumulatedSkippedSilenceDurationUs = 0;
23472345
}
23482346

23492347
@RequiresApi(23)

0 commit comments

Comments
 (0)