From 2b8cfcf2ec25a0f47e9f77fb901659dcccc747ce Mon Sep 17 00:00:00 2001 From: Oliver Woodman Date: Wed, 23 Dec 2020 22:51:10 +0000 Subject: [PATCH] Merge pull request #8357 from TiVo:p-fix-cea708anchor PiperOrigin-RevId: 348440799 --- RELEASENOTES.md | 2 ++ .../google/android/exoplayer2/text/cea/Cea708Decoder.java | 8 ++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/RELEASENOTES.md b/RELEASENOTES.md index c2ee9d6562..28d897f904 100644 --- a/RELEASENOTES.md +++ b/RELEASENOTES.md @@ -19,6 +19,8 @@ * Text: * Gracefully handle null-terminated subtitle content in Matroska containers. + * Fix CEA-708 anchor positioning + ([#1807](https://github.com/google/ExoPlayer/issues/1807)). * Media2 extension * Make media2-extension depend on AndroidX media2:media2-session:1.1.0 to fix a deadlock while creating PlaybackStateCompat internally. diff --git a/library/core/src/main/java/com/google/android/exoplayer2/text/cea/Cea708Decoder.java b/library/core/src/main/java/com/google/android/exoplayer2/text/cea/Cea708Decoder.java index 8bd46fabdc..56dd4ebef2 100644 --- a/library/core/src/main/java/com/google/android/exoplayer2/text/cea/Cea708Decoder.java +++ b/library/core/src/main/java/com/google/android/exoplayer2/text/cea/Cea708Decoder.java @@ -1226,18 +1226,18 @@ public final class Cea708Decoder extends CeaDecoder { // | | // 6-----7-----8 @AnchorType int verticalAnchorType; - if (anchorId % 3 == 0) { + if (anchorId / 3 == 0) { verticalAnchorType = Cue.ANCHOR_TYPE_START; - } else if (anchorId % 3 == 1) { + } else if (anchorId / 3 == 1) { verticalAnchorType = Cue.ANCHOR_TYPE_MIDDLE; } else { verticalAnchorType = Cue.ANCHOR_TYPE_END; } // TODO: Add support for right-to-left languages (i.e. where start is on the right). @AnchorType int horizontalAnchorType; - if (anchorId / 3 == 0) { + if (anchorId % 3 == 0) { horizontalAnchorType = Cue.ANCHOR_TYPE_START; - } else if (anchorId / 3 == 1) { + } else if (anchorId % 3 == 1) { horizontalAnchorType = Cue.ANCHOR_TYPE_MIDDLE; } else { horizontalAnchorType = Cue.ANCHOR_TYPE_END;