Only override gapless data if set in ClippingMediaPeriod

This avoids reading a format that is not equal because of switching between
NO_VALUE and 0.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=184298076
This commit is contained in:
andrewlewis 2018-02-02 10:09:24 -08:00 committed by Andrew Lewis
parent 0b2497799f
commit 75574928e5

View File

@ -292,11 +292,13 @@ public final class ClippingMediaPeriod implements MediaPeriod, MediaPeriod.Callb
}
int result = childStream.readData(formatHolder, buffer, requireFormat);
if (result == C.RESULT_FORMAT_READ) {
// Clear gapless playback metadata if the start/end points don't match the media.
Format format = formatHolder.format;
int encoderDelay = startUs != 0 ? 0 : format.encoderDelay;
int encoderPadding = endUs != C.TIME_END_OF_SOURCE ? 0 : format.encoderPadding;
formatHolder.format = format.copyWithGaplessInfo(encoderDelay, encoderPadding);
if (format.encoderDelay != Format.NO_VALUE || format.encoderPadding != Format.NO_VALUE) {
// Clear gapless playback metadata if the start/end points don't match the media.
int encoderDelay = startUs != 0 ? 0 : format.encoderDelay;
int encoderPadding = endUs != C.TIME_END_OF_SOURCE ? 0 : format.encoderPadding;
formatHolder.format = format.copyWithGaplessInfo(encoderDelay, encoderPadding);
}
return C.RESULT_FORMAT_READ;
}
if (endUs != C.TIME_END_OF_SOURCE