purgeQualityChangePositions_(contentTypeState) {
    const bufferedInfo = this.getBufferedInfo_();
    const bufferedRanges = bufferedInfo[contentTypeState.contentType];

    if (bufferedRanges && bufferedRanges.length > 0) {
      const bufferStart = bufferedRanges[0].start;
      const bufferEnd = bufferedRanges[bufferedRanges.length - 1].end;
      const oldChangePositions = contentTypeState.qualityChangePositions;
      contentTypeState.qualityChangePositions =
        oldChangePositions.filter(
            (qualityChange, index) => {
              // Remove all but last quality change before bufferStart.
              if ((qualityChange.position <= bufferStart) &&
                (index + 1 < oldChangePositions.length) &&
                (oldChangePositions[index + 1].position <= bufferStart)) {
                return false;
              }
              // Remove all quality changes after bufferEnd.
              if (qualityChange.position >= bufferEnd) {
                return false;
              }
              return true;
            });
    } else {
      // Nothing is buffered; so remove all quality changes.
      contentTypeState.qualityChangePositions = [];
    }
  }
Removes the QualityChangePosition(s) that are not relevant to the buffered
content of the specified contentType. Note that this function is
invoked just before adding the quality change info associated with
the next media segment to be appended.

@param {!shaka.media.QualityObserver.ContentTypeState} contentTypeState
@private