async chooseInitialVariantAndPrefetchInner_() {
    goog.asserts.assert(
        this.manifest_, 'The manifest should already be parsed.');

    // This step does not have any associated events, as it is only part of the
    // "load" state in the old state graph.

    if (!this.currentAdaptationSetCriteria_) {
      // Copy preferred languages from the config again, in case the config was
      // changed between construction and playback.
      this.currentAdaptationSetCriteria_ =
          this.config_.adaptationSetCriteriaFactory();
      this.currentAdaptationSetCriteria_.configure({
        language: this.config_.preferredAudioLanguage,
        role: this.config_.preferredVariantRole,
        channelCount: this.config_.preferredAudioChannelCount,
        hdrLevel: this.config_.preferredVideoHdrLevel,
        spatialAudio: this.config_.preferSpatialAudio,
        videoLayout: this.config_.preferredVideoLayout,
        audioLabel: this.config_.preferredAudioLabel,
        videoLabel: this.config_.preferredVideoLabel,
        codecSwitchingStrategy:
            this.config_.mediaSource.codecSwitchingStrategy,
        audioCodec: '',
        activeAudioCodec: '',
        activeAudioChannelCount: 0,
        preferredAudioCodecs: this.config_.preferredAudioCodecs,
        preferredAudioChannelCount: this.config_.preferredAudioChannelCount,
      });
    }

    // Make the ABR manager.
    if (this.allowMakeAbrManager_) {
      const abrFactory = this.config_.abrFactory;
      this.abrManagerFactory_ = abrFactory;
      this.abrManager_ = abrFactory();
      this.abrManager_.configure(this.config_.abr);
    }

    if (this.allowPrefetch_) {
      const isLive = this.manifest_.presentationTimeline.isLive();
      // Prefetch segments for the predicted first variant.
      // We start these here, but don't wait for them; it's okay to start the
      // full load process while the segments are being prefetched.
      const playableVariants = shaka.util.StreamUtils.getPlayableVariants(
          this.manifest_.variants);
      const adaptationSet = this.currentAdaptationSetCriteria_.create(
          playableVariants);
      // Guess what the first variant will be, based on a SimpleAbrManager.
      this.abrManager_.configure(this.config_.abr);
      this.abrManager_.setVariants(Array.from(adaptationSet.values()));
      const variant = this.abrManager_.chooseVariant();
      if (variant) {
        const promises = [];
        this.prefetchedVariant_ = variant;
        if (variant.video) {
          promises.push(this.prefetchStream_(variant.video, isLive));
        }
        if (variant.audio) {
          promises.push(this.prefetchStream_(variant.audio, isLive));
        }
        const textStream = this.chooseTextStream_();
        if (textStream && shaka.util.StreamUtils.shouldInitiallyShowText(
            variant.audio, textStream, this.config_)) {
          promises.push(this.prefetchStream_(textStream, isLive));
          this.prefetchedTextStream_ = textStream;
        }

        await Promise.all(promises);
      }
    }
  }
Performs a final filtering of the manifest, and chooses the initial
variant. Also prefetches segments.

@return {!Promise}
@private