public ErrorCode submitFrame(FrameBuffer bgraFrame) {
    if (this.getIsPaused()) {
      resumeBroadcasting();
    } else if (!this.getIsBroadcasting()) {
      return ErrorCode.TTV_EC_STREAM_NOT_STARTED;
    }

    ErrorCode ret = m_Stream.submitVideoFrame(bgraFrame);

    // if there is a problem when submitting a frame let the client know
    if (ret != ErrorCode.TTV_EC_SUCCESS) {
      String err = ErrorCode.getString(ret);
      if (ErrorCode.succeeded(ret)) {
        reportWarning(String.format("Warning in SubmitTexturePointer: %s\n", err));
      } else {
        reportError(String.format("Error in SubmitTexturePointer: %s\n", err));

        // errors are not recoverable
        stopBroadcasting();
      }

      if (m_Listener != null) {
        m_Listener.onframeSubmissionIssue(ret);
      }
    }

    return ret;
  }