From ef475eb9c9c8c1224043a61504f296c39db38778 Mon Sep 17 00:00:00 2001 From: cdrolle Date: Thu, 9 Feb 2017 12:31:16 -0800 Subject: [PATCH] Fixed potential bug in which old paint-on captions could be drawn overtop by pop-on captions as they weren't being cleared properly. This fix was taken from YouTube's Cea608Decoder ([] ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=147066662 --- .../google/android/exoplayer2/text/cea/Cea608Decoder.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer2/text/cea/Cea608Decoder.java b/library/src/main/java/com/google/android/exoplayer2/text/cea/Cea608Decoder.java index 261f9d0e3e..fe9a5fbc5c 100644 --- a/library/src/main/java/com/google/android/exoplayer2/text/cea/Cea608Decoder.java +++ b/library/src/main/java/com/google/android/exoplayer2/text/cea/Cea608Decoder.java @@ -503,11 +503,14 @@ public final class Cea608Decoder extends CeaDecoder { return; } + int oldCaptionMode = this.captionMode; this.captionMode = captionMode; + // Clear the working memory. resetCueBuilders(); - if (captionMode == CC_MODE_ROLL_UP || captionMode == CC_MODE_UNKNOWN) { - // When switching to roll-up or unknown, we also need to clear the caption. + if (oldCaptionMode == CC_MODE_PAINT_ON || captionMode == CC_MODE_ROLL_UP + || captionMode == CC_MODE_UNKNOWN) { + // When switching from paint-on or to roll-up or unknown, we also need to clear the caption. cues = null; } }