Skip to content

Commit

Permalink
add option to set degradation paramerter
Browse files Browse the repository at this point in the history
  • Loading branch information
USAMAWIZARD committed Oct 7, 2023
1 parent 4142ca1 commit d759957
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2320,6 +2320,30 @@ private boolean isDataChannelCreator() {
|| streamMode.equals(IWebRTCClient.MODE_TRACK_BASED_CONFERENCE);
}

public void setDegradationPreference(String streamId , RtpParameters.DegradationPreference degradationPreference) {

if (context == null || peers.get(streamId) == null || peers.get(streamId).peerConnection == null) {
Log.d(TAG, "Cannot set Degradation Preference");
return;
}
PeerConnection peerConnection = peers.get(streamId).peerConnection;
if(peerConnection == null)
return;

for (RtpSender sender : peerConnection.getSenders()) {
if (sender.track() != null) {
String trackType = sender.track().kind();
if (trackType.equals(VIDEO_TRACK_TYPE)) {
RtpParameters newParameters = sender.getParameters();
if(newParameters != null) {
newParameters.degradationPreference = degradationPreference;
sender.setParameters(newParameters);
}
}
}
}
}

private File createRtcEventLogOutputFile() {
DateFormat dateFormat = new SimpleDateFormat("yyyyMMdd_hhmm_ss", Locale.getDefault());
Date date = new Date();
Expand Down

0 comments on commit d759957

Please sign in to comment.