Пример #1
0
  /**
   * Returns a fully populated VideoParams struct based on the given width, height and frame rate.
   * This function is not the advised way to setup VideoParams because it has no information about
   * the user's maximum bitrate. Use the other version of GetRecommendedVideoParams instead if
   * possible.
   *
   * @param width The broadcast width
   * @param height The broadcast height
   * @param frameRate The broadcast frames per second
   * @return The VideoParams
   */
  public VideoParams getRecommendedVideoParams(int width, int height, int frameRate) {
    VideoParams videoParams = new VideoParams();

    videoParams.outputWidth = width;
    videoParams.outputHeight = height;
    videoParams.targetFps = frameRate;
    videoParams.pixelFormat = determinePixelFormat();
    videoParams.encodingCpuUsage = EncodingCpuUsage.TTV_ECU_HIGH;
    videoParams.disableAdaptiveBitrate = false;
    videoParams.verticalFlip = false;

    // Compute the rest of the fields based on the given parameters
    ErrorCode ret = m_Stream.getDefaultParams(videoParams);
    if (ErrorCode.failed(ret)) {
      String err = ErrorCode.getString(ret);
      reportError(String.format("Error in GetDefaultParams: %s", err));
      return null;
    }

    return videoParams;
  }