public void setVideoMaxBitrate(final Integer maxBitrateKbps) { executor.execute(new Runnable() { @Override public void run() { if (peerConnection == null || localVideoSender == null || isError) { return; } Log.d(TAG, "Requested max video bitrate: " + maxBitrateKbps); if (localVideoSender == null) { Log.w(TAG, "Sender is not ready."); return; } RtpParameters parameters = localVideoSender.getParameters(); if (parameters.encodings.size() == 0) { Log.w(TAG, "RtpParameters are not ready."); return; } for (RtpParameters.Encoding encoding : parameters.encodings) { // Null value means no limit. encoding.maxBitrateBps = maxBitrateKbps == null ? null : maxBitrateKbps * BPS_IN_KBPS; } if (!localVideoSender.setParameters(parameters)) { Log.e(TAG, "RtpSender.setParameters failed."); } Log.d(TAG, "Configured max video bitrate to: " + maxBitrateKbps); } }); }