Skip to content

Commit

Permalink
perf(WebVTT): Improve parsing time for unstyled payloads (#6066)
Browse files Browse the repository at this point in the history
Related to #6065
  • Loading branch information
avelad authored and joeyparrish committed Feb 17, 2024
1 parent e62103f commit 80b66bd
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/text/vtt_text_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,11 @@ shaka.text.VttTextParser = class {
*/
static parseCueStyles(payload, rootCue, styles) {
const VttTextParser = shaka.text.VttTextParser;
// Optimization for unstyled payloads.
if (!payload.includes('<')) {
rootCue.payload = VttTextParser.htmlUnescape_(payload);
return;
}
if (styles.size === 0) {
VttTextParser.addDefaultTextColor_(styles);
}
Expand Down

0 comments on commit 80b66bd

Please sign in to comment.