/**
   * Cleans up and shuts down the SDK and the controller. This will force broadcasting to terminate
   * and the user to be logged out.
   */
  public boolean shutdownTwitch() {
    if (!m_SdkInitialized) {
      return true;
    } else if (getIsIngestTesting()) {
      return false;
    }

    m_ShuttingDown = true;

    logout();

    m_Stream.setStreamCallbacks(null);
    m_Stream.setStatCallbacks(null);

    ErrorCode err = m_Stream.shutdown();
    checkError(err);

    m_SdkInitialized = false;
    m_ShuttingDown = false;
    setBroadcastState(BroadcastState.Uninitialized);

    return true;
  }