org.webrtc.RtpSender Java Examples

The following examples show how to use org.webrtc.RtpSender. 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
protected void addStream(final MediaStream mediaStream) {
    DCHECK(mediaStream);
    DCHECK(pcExecutor);
    pcExecutor.execute(() -> {
        if (disposed()) {
            return;
        }
        ArrayList<String> streamIds = new ArrayList<>();
        streamIds.add(mediaStream.getId());
        for (AudioTrack audioTrack : mediaStream.audioTracks) {
            RtpSender audioSender = peerConnection.addTrack(audioTrack, streamIds);
            audioRtpSenders.put(mediaStream.getId(), audioSender);
        }
        for (VideoTrack videoTrack : mediaStream.videoTracks) {
            RtpSender videoSender = peerConnection.addTrack(videoTrack, streamIds);
            videoRtpSenders.put(mediaStream.getId(), videoSender);
        }
    });
}
 
Example #2
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 #3
Source File: PeerConnectionClient.java    From sample-videoRTC with Apache License 2.0 5 votes vote down vote up
private void findVideoSender() {
  for (RtpSender sender : peerConnection.getSenders()) {
    if (sender.track() != null) {
      String trackType = sender.track().kind();
      if (trackType.equals(VIDEO_TRACK_TYPE)) {
        Log.d(TAG, "Found video sender.");
        localVideoSender = sender;
      }
    }
  }
}
 
Example #4
Source File: PeerConnectionClient.java    From janus-gateway-android with MIT License 5 votes vote down vote up
private void findVideoSender(final BigInteger handleId) {
  PeerConnection peerConnection = peerConnectionMap.get(handleId).peerConnection;
  for (RtpSender sender : peerConnection.getSenders()) {
    if (sender.track() != null) {
      String trackType = sender.track().kind();
      if (trackType.equals(VIDEO_TRACK_TYPE)) {
        Log.d(TAG, "Found video sender.");
        localVideoSender = sender;
      }
    }
  }
}
 
Example #5
Source File: PeerConnectionClient.java    From voip_android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void findVideoSender() {
    for (RtpSender sender : peerConnection.getSenders()) {
        if (sender.track() != null) {
            String trackType = sender.track().kind();
            if (trackType.equals(VIDEO_TRACK_TYPE)) {
                Log.d(TAG, "Found video sender.");
                localVideoSender = sender;
            }
        }
    }
}
 
Example #6
Source File: PeerConnectionClient.java    From restcomm-android-sdk with GNU Affero General Public License v3.0 5 votes vote down vote up
private void findVideoSender() {
  for (RtpSender sender : peerConnection.getSenders()) {
    if (sender.track() != null) {
      String trackType = sender.track().kind();
      if (trackType.equals(VIDEO_TRACK_TYPE)) {
        Log.d(TAG, "Found video sender.");
        localVideoSender = sender;
      }
    }
  }
}