From 54d207f3ce3933a4b547dbedba9c784e00327232 Mon Sep 17 00:00:00 2001 From: Oliver Woodman Date: Thu, 18 Jun 2015 14:12:33 +0100 Subject: [PATCH] Default caption parsers to non-strict parsing. --- .../android/exoplayer/text/ttml/TtmlParser.java | 6 +++--- .../android/exoplayer/text/webvtt/WebvttParser.java | 12 ++++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlParser.java b/library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlParser.java index 907a1d2e87..d93f99fea0 100644 --- a/library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlParser.java +++ b/library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlParser.java @@ -77,15 +77,15 @@ public class TtmlParser implements SubtitleParser { private final boolean strictParsing; /** - * Equivalent to {@code TtmlParser(true)}. + * Equivalent to {@code TtmlParser(false)}. */ public TtmlParser() { - this(true); + this(false); } /** * @param strictParsing If true, {@link #parse(InputStream, String, long)} will throw a - * {@link ParserException} if the stream contains invalid ttml. If false, the parser will + * {@link ParserException} if the stream contains invalid data. If false, the parser will * make a best effort to ignore minor errors in the stream. Note however that a * {@link ParserException} will still be thrown when this is not possible. */ diff --git a/library/src/main/java/com/google/android/exoplayer/text/webvtt/WebvttParser.java b/library/src/main/java/com/google/android/exoplayer/text/webvtt/WebvttParser.java index 3d683ea0b6..db5a456168 100644 --- a/library/src/main/java/com/google/android/exoplayer/text/webvtt/WebvttParser.java +++ b/library/src/main/java/com/google/android/exoplayer/text/webvtt/WebvttParser.java @@ -68,13 +68,21 @@ public class WebvttParser implements SubtitleParser { private final boolean strictParsing; + /** + * Equivalent to {@code WebvttParser(false)}. + */ public WebvttParser() { - this(true); + this(false); } + /** + * @param strictParsing If true, {@link #parse(InputStream, String, long)} will throw a + * {@link ParserException} if the stream contains invalid data. If false, the parser will + * make a best effort to ignore minor errors in the stream. Note however that a + * {@link ParserException} will still be thrown when this is not possible. + */ public WebvttParser(boolean strictParsing) { this.strictParsing = strictParsing; - textBuilder = new StringBuilder(); }