Skip to content

Commit

Permalink
Report the skipped silence more deterministically
Browse files Browse the repository at this point in the history
Issue: #1035
#minor-release
PiperOrigin-RevId: 605361126
  • Loading branch information
tianyif authored and copybara-github committed Feb 8, 2024
1 parent e56e27e commit 9b0cdde
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 2 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
* Improve silence skipping algorithm with smooth volume ramp, retained
minimal silence and more natural silence durations
([#7423](https:/google/ExoPlayer/issues/7423)).
* Report the skipped silence more deterministically
([#1035](https:/androidx/media/issues/1035)).
* Video:
* Text:
* Metadata:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public final class DefaultAudioSink implements AudioSink {
private static final int AUDIO_TRACK_SMALLER_BUFFER_RETRY_SIZE = 1_000_000;

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

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

@RequiresApi(23)
Expand Down

0 comments on commit 9b0cdde

Please sign in to comment.