mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Clarify purpose of omitting zero duration clipped audio samples
When applying edit lists, we need to output the last partial samples to have all the necessary data needed for rendering. The only case where we can omit the sample is for zero duration audio data that has no additional information. The current comment and variable name doesn't make this very clear and this change improves the naming and the comment. PiperOrigin-RevId: 608579746
This commit is contained in:
parent
8dd6590fe9
commit
711d24a12f
@ -677,8 +677,11 @@ import java.util.Objects;
|
||||
track, offsets, sizes, maximumSize, timestamps, flags, durationUs);
|
||||
}
|
||||
|
||||
// Omit any sample at the end point of an edit for audio tracks.
|
||||
boolean omitClippedSample = track.type == C.TRACK_TYPE_AUDIO;
|
||||
// When applying edit lists, we need to include any partial clipped samples at the end to ensure
|
||||
// the final output is rendered correctly (see https://github.com/google/ExoPlayer/issues/2408).
|
||||
// For audio only, we can omit any sample that starts at exactly the end point of an edit as
|
||||
// there is no partial audio in this case.
|
||||
boolean omitZeroDurationClippedSample = track.type == C.TRACK_TYPE_AUDIO;
|
||||
|
||||
// Count the number of samples after applying edits.
|
||||
int editedSampleCount = 0;
|
||||
@ -707,7 +710,7 @@ import java.util.Objects;
|
||||
Util.binarySearchCeil(
|
||||
timestamps,
|
||||
editMediaTime + editDuration,
|
||||
/* inclusive= */ omitClippedSample,
|
||||
/* inclusive= */ omitZeroDurationClippedSample,
|
||||
/* stayInBounds= */ false);
|
||||
while (startIndices[i] < endIndices[i]
|
||||
&& (flags[startIndices[i]] & C.BUFFER_FLAG_KEY_FRAME) == 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user