Skip to content

Commit

Permalink
perf(HLS): do not filter all tags to get the first tag (#6088)
Browse files Browse the repository at this point in the history
Filtering all the tags to get the first one that's required is not
needed

Co-authored-by: Ivan Kohut <ivan.kohut@lamin.ar>
  • Loading branch information
vanyaxk and Ivan Kohut committed Jan 11, 2024
1 parent fd46d19 commit 9802f65
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/hls/hls_utils.js
Expand Up @@ -47,12 +47,12 @@ shaka.hls.Utils = class {
* @return {?shaka.hls.Tag}
*/
static getFirstTagWithName(tags, name) {
const tagsWithName = shaka.hls.Utils.filterTagsByName(tags, name);
if (!tagsWithName.length) {
return null;
for (const tag of tags) {
if (tag.name === name) {
return tag;
}
}

return tagsWithName[0];
return null;
}

/**
Expand Down

0 comments on commit 9802f65

Please sign in to comment.