mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Report the skipped silence more deterministically
Issue: androidx/media#1035 #minor-release PiperOrigin-RevId: 605361126
This commit is contained in:
parent
e56e27e725
commit
9b0cdde7d2
2 changed files with 4 additions and 4 deletions
|
|
@ -22,6 +22,8 @@
|
||||||
* Improve silence skipping algorithm with smooth volume ramp, retained
|
* Improve silence skipping algorithm with smooth volume ramp, retained
|
||||||
minimal silence and more natural silence durations
|
minimal silence and more natural silence durations
|
||||||
([#7423](https://github.com/google/ExoPlayer/issues/7423)).
|
([#7423](https://github.com/google/ExoPlayer/issues/7423)).
|
||||||
|
* Report the skipped silence more deterministically
|
||||||
|
([#1035](https://github.com/androidx/media/issues/1035)).
|
||||||
* Video:
|
* Video:
|
||||||
* Text:
|
* Text:
|
||||||
* Metadata:
|
* Metadata:
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ public final class DefaultAudioSink implements AudioSink {
|
||||||
private static final int AUDIO_TRACK_SMALLER_BUFFER_RETRY_SIZE = 1_000_000;
|
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. */
|
/** 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
|
* The delay of reporting the skipped silence, during which the default audio sink checks if there
|
||||||
|
|
@ -2340,11 +2340,9 @@ public final class DefaultAudioSink implements AudioSink {
|
||||||
if (accumulatedSkippedSilenceDurationUs >= MINIMUM_REPORT_SKIPPED_SILENCE_DURATION_US) {
|
if (accumulatedSkippedSilenceDurationUs >= MINIMUM_REPORT_SKIPPED_SILENCE_DURATION_US) {
|
||||||
// If the existing silence is already long enough, report the silence
|
// If the existing silence is already long enough, report the silence
|
||||||
listener.onSilenceSkipped();
|
listener.onSilenceSkipped();
|
||||||
}
|
|
||||||
// Reset the accumulated silence anyway as the later silences are far from the current one
|
|
||||||
// and should be treated separately.
|
|
||||||
accumulatedSkippedSilenceDurationUs = 0;
|
accumulatedSkippedSilenceDurationUs = 0;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RequiresApi(23)
|
@RequiresApi(23)
|
||||||
private static final class Api23 {
|
private static final class Api23 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue