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
2 people authored and avelad committed Jan 16, 2024
1 parent 4ab9dc8 commit 4704577
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 4704577

Please sign in to comment.