Commit 8b2af124 by Rik Heijdens

Discard spans after seeking

Discard any spans that should not be applied because they don't belong
to what's in the current CC buffer.
parent 43e6e161
......@@ -656,9 +656,13 @@ public final class Eia608Decoder implements SubtitleDecoder {
}
for (Integer startIndex : captionStyles.keySet()) {
// There may be cases, e.g. when seeking where the startIndex becomes greater
// than what is actually in the string builder, in that case, just discard the span.
if (startIndex < captionStringBuilder.length()) {
CharacterStyle captionStyle = captionStyles.get(startIndex);
captionStringBuilder.setSpan(captionStyle, startIndex,
captionStringBuilder.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
captionStyles.remove(startIndex);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment