Treat captions that are wider than expected as middle aligned

Issue: #3534

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=178364353
This commit is contained in:
olly 2017-12-08 04:44:55 -08:00 committed by Oliver Woodman
parent 44a8245a1a
commit fede9c39c6

View File

@ -740,8 +740,10 @@ public final class Cea608Decoder extends CeaDecoder {
// The number of empty columns after the end of the text, in the same range. // The number of empty columns after the end of the text, in the same range.
int endPadding = SCREEN_CHARWIDTH - startPadding - cueString.length(); int endPadding = SCREEN_CHARWIDTH - startPadding - cueString.length();
int startEndPaddingDelta = startPadding - endPadding; int startEndPaddingDelta = startPadding - endPadding;
if (captionMode == CC_MODE_POP_ON && Math.abs(startEndPaddingDelta) < 3) { if (captionMode == CC_MODE_POP_ON && (Math.abs(startEndPaddingDelta) < 3 || endPadding < 0)) {
// Treat approximately centered pop-on captions are middle aligned. // Treat approximately centered pop-on captions as middle aligned. We also treat captions
// that are wider than they should be in this way. See
// https://github.com/google/ExoPlayer/issues/3534.
position = 0.5f; position = 0.5f;
positionAnchor = Cue.ANCHOR_TYPE_MIDDLE; positionAnchor = Cue.ANCHOR_TYPE_MIDDLE;
} else if (captionMode == CC_MODE_POP_ON && startEndPaddingDelta > 0) { } else if (captionMode == CC_MODE_POP_ON && startEndPaddingDelta > 0) {