File tree Expand file tree Collapse file tree
libraries/exoplayer/src/main/java/androidx/media3/exoplayer/audio Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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:
Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments