org.webrtc.RtpParameters Java Examples

The following examples show how to use org.webrtc.RtpParameters. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PeerConnectionChannel.java    From owt-client-android with Apache License 2.0 6 votes vote down vote up
private void setMaxBitrate(RtpSender sender, Integer bitrate) {
    if (sender == null) {
        return;
    }
    RtpParameters rtpParameters = sender.getParameters();
    if (rtpParameters == null) {
        Log.e(LOG_TAG, "Null rtp paramters");
        return;
    }
    for (RtpParameters.Encoding encoding : rtpParameters.encodings) {
        encoding.maxBitrateBps = bitrate == null ? null : bitrate * 1000;
    }
    if (!sender.setParameters(rtpParameters)) {
        Log.e(LOG_TAG, "Failed to configure max video bitrate");
    }
}
 
Example #2
Source File: PeerConnectionClient.java    From sample-videoRTC with Apache License 2.0 5 votes vote down vote up
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);
    }
  });
}
 
Example #3
Source File: PeerConnectionClient.java    From voip_android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
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);
        }
    });
}
 
Example #4
Source File: PeerConnectionClient.java    From restcomm-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
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);
    }
  });
}
 
Example #5
Source File: RtpTransceiver.java    From webrtc_android with MIT License 4 votes vote down vote up
public RtpTransceiverInit(RtpTransceiverDirection direction, List<String> streamIds,
    List<RtpParameters.Encoding> sendEncodings) {
  this.direction = direction;
  this.streamIds = new ArrayList<String>(streamIds);
  this.sendEncodings = new ArrayList<RtpParameters.Encoding>(sendEncodings);
}
 
Example #6
Source File: RtpTransceiver.java    From webrtc_android with MIT License 4 votes vote down vote up
@CalledByNative("RtpTransceiverInit")
List<RtpParameters.Encoding> getSendEncodings() {
  return new ArrayList<RtpParameters.Encoding>(this.sendEncodings);
}