diff --git a/libraries/extractor/src/main/java/androidx/media3/extractor/text/subrip/SubripParser.java b/libraries/extractor/src/main/java/androidx/media3/extractor/text/subrip/SubripParser.java index da98660d3c7..d7d114e6918 100644 --- a/libraries/extractor/src/main/java/androidx/media3/extractor/text/subrip/SubripParser.java +++ b/libraries/extractor/src/main/java/androidx/media3/extractor/text/subrip/SubripParser.java @@ -287,6 +287,12 @@ private static long parseTimecode(Matcher matcher, int groupOffset) { timestampMs += Long.parseLong(Assertions.checkNotNull(matcher.group(groupOffset + 3))) * 1000; @Nullable String millis = matcher.group(groupOffset + 4); if (millis != null) { + if (millis.length() > 3) { + try { + millis = millis.substring(0, 3); + } + catch(IndexOutOfBoundsException e) {} + } timestampMs += Long.parseLong(millis); } return timestampMs * 1000;