switch_(variant, clearBuffer = false, safeMargin = 0) {
    shaka.log.debug('switch_');
    goog.asserts.assert(this.config_.abr.enabled,
        'AbrManager should not call switch while disabled!');

    if (!this.manifest_) {
      // It could come from a preload manager operation.
      return;
    }

    if (!this.streamingEngine_) {
      // There's no way to change it.
      return;
    }

    if (variant == this.streamingEngine_.getCurrentVariant()) {
      // This isn't a change.
      return;
    }

    this.switchVariant_(variant, /* fromAdaptation= */ true,
        clearBuffer, safeMargin);
  }
Callback from AbrManager.

@param {shaka.extern.Variant} variant
@param {boolean=} clearBuffer
@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