chooseVariantAndSwitch_(clearBuffer = true, safeMargin = 0, force = false,
      fromAdaptation = true) {
    goog.asserts.assert(this.config_, 'Must not be destroyed');

    // Because we're running this after a config change (manual language
    // change) or a key status event, it is always okay to clear the buffer
    // here.
    const chosenVariant = this.chooseVariant_();
    if (chosenVariant) {
      this.switchVariant_(chosenVariant, fromAdaptation,
          clearBuffer, safeMargin, force);
    }
  }
Chooses a new Variant.  If the new variant differs from the old one, it
adds the new one to the switch history and switches to it.

Called after a config change, a key status event, or an explicit language
change.

@param {boolean=} clearBuffer Optional clear buffer or not when
 switch to new variant
 Defaults to true if not provided
@param {number=} safeMargin Optional amount of buffer (in seconds) to
  retain when clearing the buffer.
  Defaults to 0 if not provided. Ignored if clearBuffer is false.
@private