mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
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:
parent
a99295b364
commit
88d012bad0
1 changed files with 4 additions and 2 deletions
|
|
@ -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) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue