updateBufferState_() {
    const isBuffering = this.isBuffering();
    shaka.log.v2('Player changing buffering state to', isBuffering);

    // Make sure we have all the components we need before we consider ourselves
    // as being loaded.
    // TODO: Make the check for "loaded" simpler.
    const loaded = this.stats_ && this.bufferObserver_ && this.playhead_;

    if (loaded) {
      if (this.config_.streaming.rebufferingGoal == 0) {
        // Disable buffer control with playback rate
        this.playRateController_.setBuffering(/* isBuffering= */ false);
      } else {
        this.playRateController_.setBuffering(isBuffering);
      }
      if (this.cmcdManager_) {
        this.cmcdManager_.setBuffering(isBuffering);
      }
      this.updateStateHistory_();

      const dynamicTargetLatency =
          this.config_.streaming.liveSync.dynamicTargetLatency.enabled;
      const maxAttempts =
          this.config_.streaming.liveSync.dynamicTargetLatency.maxAttempts;


      if (dynamicTargetLatency && isBuffering &&
        this.rebufferingCount_ < maxAttempts) {
        const maxLatency =
            this.config_.streaming.liveSync.dynamicTargetLatency.maxLatency;

        const targetLatencyTolerance =
          this.config_.streaming.liveSync.targetLatencyTolerance;
        const rebufferIncrement =
          this.config_.streaming.liveSync.dynamicTargetLatency
              .rebufferIncrement;
        if (this.currentTargetLatency_) {
          this.currentTargetLatency_ = Math.min(
              this.currentTargetLatency_ +
            ++this.rebufferingCount_ * rebufferIncrement,
              maxLatency - targetLatencyTolerance);
        }
      }
    }

    // Surface the buffering event so that the app knows if/when we are
    // buffering.
    const eventName = shaka.util.FakeEvent.EventName.Buffering;
    const data = (new Map()).set('buffering', isBuffering);
    this.dispatchEvent(shaka.Player.makeEvent_(eventName, data));
  }
Update the buffering state to be either "we are buffering" or "we are not
buffering", firing events to the app as needed.

@private