getAdjustedTime = async (stream, time) => {
      if (!stream) {
        return null;
      }

      if (!stream.segmentIndex) {
        await stream.createSegmentIndex();
      }
      const iter = stream.segmentIndex.getIteratorForTime(time);
      const ref = iter ? iter.next().value : null;
      if (!ref) {
        return null;
      }

      const refTime = ref.startTime;
      goog.asserts.assert(refTime <= time,
          'Segment should start before target time!');
      return refTime;
    }
@param {?shaka.extern.Stream} stream
@param {number} time
@return {!Promise<?number>}