/** * Determines the recommended streaming parameters based on the maximum bandwidth of the user's * internet connection. This is the recommended method if the broadcast resolution can be * independent of the game window resolution and will produce the best visual quality. The game * must submit buffers at the resolution returned in the VideoParams. * * @param maxKbps Maximum bitrate supported (this should be determined by running the ingest * tester for a given ingest server). * @param frameRate The desired frame rate. For a given bitrate and motion factor, a higher * framerate will mean a lower resolution. * @param bitsPerPixel The bits per pixel used in the final encoded video. A fast motion game * (e.g. first person shooter) required more bits per pixel of encoded video avoid compression * artifacting. Use 0.1 for an average motion game. For games without too many fast changes in * the scene, you could use a value below 0.1 but not much. For fast moving games with lots of * scene changes a value as high as 0.2 would be appropriate. * @param aspectRatio - The aspect ratio of the video which we'll use for calculating width and * height. * @return The filled in VideoParams. */ public VideoParams getRecommendedVideoParams( int maxKbps, int frameRate, float bitsPerPixel, float aspectRatio) { int[] resolution = m_Stream.getMaxResolution(maxKbps, frameRate, bitsPerPixel, aspectRatio); VideoParams videoParams = new VideoParams(); videoParams.maxKbps = maxKbps; videoParams.encodingCpuUsage = EncodingCpuUsage.TTV_ECU_HIGH; videoParams.pixelFormat = determinePixelFormat(); videoParams.targetFps = frameRate; videoParams.outputWidth = resolution[0]; videoParams.outputHeight = resolution[1]; videoParams.disableAdaptiveBitrate = false; videoParams.verticalFlip = false; return videoParams; }