getAvailableSegment_(segments) {
    goog.asserts.assert(segments.length, 'Should have segments!');

    // If you wait long enough, requesting the first segment can fail
    // because it has fallen off the left edge of DVR, so to be safer,
    // let's request the middle segment.
    let segmentIndex = this.isLive_() ?
        Math.trunc((segments.length - 1) / 2) : 0;
    let segment = segments[segmentIndex];
    while (segment.getStatus() == shaka.media.SegmentReference.Status.MISSING &&
        (segmentIndex + 1) < segments.length) {
      segmentIndex ++;
      segment = segments[segmentIndex];
    }
    return {segment, segmentIndex};
  }
@param {!Array<!shaka.media.SegmentReference>} segments
@return {{segment: !shaka.media.SegmentReference, segmentIndex: number}}
@private