mergeAndEvict(references, windowStart) {
    // Filter out the references that are no longer available to avoid
    // repeatedly evicting them and messing up eviction count.
    references = references.filter((r) => {
      return r.endTime > windowStart &&
          (this.references.length == 0 ||
           r.endTime > this.references[0].startTime);
    });

    const oldFirstRef = this.references[0];
    this.merge(references);
    const newFirstRef = this.references[0];

    if (oldFirstRef) {
      // We don't compare the actual ref, since the object could legitimately be
      // replaced with an equivalent.  Even the URIs could change due to
      // load-balancing actions taken by the server.  However, if the time
      // changes, its not an equivalent reference.
      goog.asserts.assert(oldFirstRef.startTime == newFirstRef.startTime,
          'SegmentIndex.merge should not change the first reference time!');
    }

    this.evict(windowStart);
  }
Merges the given SegmentReferences and evicts the ones that end before the
given time.  Supports extending the original references only.
Will not replace old references or interleave new ones.
Used, for example, by the DASH and HLS parser, where manifests may not list
all available references, so we must keep available references in memory to
fill the availability window.

@param {!Array<!shaka.media.SegmentReference>} references The list of
  SegmentReferences, which must be sorted first by their start times
  (ascending) and second by their end times (ascending).
@param {number} windowStart The start of the availability window to filter
  out the references that are no longer available.
@export