Skip to content

Commit

Permalink
perf: Optimize init segment reference comparison for common case (#6014)
Browse files Browse the repository at this point in the history
Backported to v4.3.x
  • Loading branch information
tykus160 authored and joeyparrish committed Feb 20, 2024
1 parent c5bcffb commit fb1d167
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/media/segment_reference.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ shaka.media.InitSegmentReference = class {
*/
static equal(reference1, reference2) {
const ArrayUtils = shaka.util.ArrayUtils;
if (!reference1 || !reference2) {
if (reference1 === reference2) {
return true;
} else if (!reference1 || !reference2) {
return reference1 == reference2;
} else {
return reference1.getStartByte() == reference2.getStartByte() &&
Expand Down

0 comments on commit fb1d167

Please sign in to comment.