Skip to content

Commit

Permalink
Report the skipped silence more deterministically
Browse files Browse the repository at this point in the history
Issue: androidx/media#1035
#minor-release
PiperOrigin-RevId: 605361126
  • Loading branch information
tianyif authored and copybara-github committed Feb 8, 2024
1 parent f931469 commit c159711
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,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 @@ -2333,10 +2333,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 c159711

Please sign in to comment.