getTimeNeeded_(mediaState, presentationTime) {
    // Get the next timestamp we need. We must use |lastSegmentReference|
    // to determine this and not the actual buffer for two reasons:
    //   1. Actual segments end slightly before their advertised end times, so
    //      the next timestamp we need is actually larger than |bufferEnd|.
    //   2. There may be drift (the timestamps in the segments are ahead/behind
    //      of the timestamps in the manifest), but we need drift-free times
    //      when comparing times against the presentation timeline.
    if (!mediaState.lastSegmentReference) {
      return presentationTime;
    }

    return mediaState.lastSegmentReference.endTime;
  }
Gets the next timestamp needed. Returns the playhead's position if the
buffer is empty; otherwise, returns the time at which the last segment
appended ends.

@param {shaka.media.StreamingEngine.MediaState_} mediaState
@param {number} presentationTime
@return {number} The next timestamp needed.
@private