openvidu-server: always apply heavy munging

pull/630/head
pabloFuente 2021-05-31 17:40:20 +02:00
parent da527b4816
commit 31002b2ffc
3 changed files with 10 additions and 12 deletions

View File

@ -387,7 +387,7 @@ public class KurentoSessionManager extends SessionManager {
// Modify sdp if forced codec is defined
if (forcedVideoCodec != VideoCodec.NONE && !participant.isIpcam()) {
kurentoOptions.sdpOffer = sdpMunging.forceCodec(kurentoOptions.sdpOffer, participant, true, false,
isTranscodingAllowed, forcedVideoCodec, false);
isTranscodingAllowed, forcedVideoCodec);
CDR.log(new WebrtcDebugEvent(participant, streamId, WebrtcDebugEventIssuer.client,
WebrtcDebugEventOperation.publish, WebrtcDebugEventType.sdpOfferMunged, kurentoOptions.sdpOffer));
}
@ -575,7 +575,7 @@ public class KurentoSessionManager extends SessionManager {
// Modify server's SDPOffer if forced codec is defined
if (forcedVideoCodec != VideoCodec.NONE && !participant.isIpcam()) {
sdpOffer = sdpMunging.forceCodec(sdpOffer, participant, false, false, isTranscodingAllowed,
forcedVideoCodec, true);
forcedVideoCodec);
CDR.log(new WebrtcDebugEvent(participant, subscriberEndpointName, WebrtcDebugEventIssuer.server,
WebrtcDebugEventOperation.subscribe, WebrtcDebugEventType.sdpOfferMunged, sdpOffer));
@ -648,7 +648,7 @@ public class KurentoSessionManager extends SessionManager {
// Modify sdp if forced codec is defined
if (forcedVideoCodec != VideoCodec.NONE && !participant.isIpcam()) {
sdpOffer = sdpMunging.forceCodec(sdpString, participant, false, false, isTranscodingAllowed,
forcedVideoCodec, false);
forcedVideoCodec);
CDR.log(new WebrtcDebugEvent(participant, subscriberEndpointName, WebrtcDebugEventIssuer.client,
WebrtcDebugEventOperation.subscribe, WebrtcDebugEventType.sdpOfferMunged, sdpOffer));
@ -1195,7 +1195,7 @@ public class KurentoSessionManager extends SessionManager {
// Modify sdp if forced codec is defined
if (forcedVideoCodec != VideoCodec.NONE && !participant.isIpcam()) {
return sdpMunging.forceCodec(sdpOffer, participant, isPublisher, true, isTranscodingAllowed,
forcedVideoCodec, false);
forcedVideoCodec);
}
return null;
}

View File

@ -68,7 +68,7 @@ public class SDPMunging {
* ordering of formats. Browsers (tested with Chrome 84) honor this change and
* use the first codec provided in the answer, so this operation actually works.
*/
public String setCodecPreference(VideoCodec codec, String sdp, boolean applyHeavyMunging) throws OpenViduException {
public String setCodecPreference(VideoCodec codec, String sdp) throws OpenViduException {
String codecStr = codec.name();
log.info("[setCodecPreference] codec: {}", codecStr);
@ -156,9 +156,8 @@ public class SDPMunging {
lines[sl] = newLine.toString().trim();
}
if (applyHeavyMunging) {
lines = cleanLinesWithRemovedCodecs(unusedCodecPts, lines);
}
lines = cleanLinesWithRemovedCodecs(unusedCodecPts, lines);
return String.join("\r\n", lines) + "\r\n";
}
@ -166,8 +165,7 @@ public class SDPMunging {
* Return a SDP modified to force a specific codec
*/
public String forceCodec(String sdp, Participant participant, boolean isPublisher, boolean isReconnecting,
boolean isTranscodingAllowed, VideoCodec forcedVideoCodec, boolean applyHeavyMunging)
throws OpenViduException {
boolean isTranscodingAllowed, VideoCodec forcedVideoCodec) throws OpenViduException {
try {
if (supportedVideoCodecs.contains(forcedVideoCodec)) {
String mungedSdpOffer;
@ -178,7 +176,7 @@ public class SDPMunging {
participant.getParticipantPublicId(), participant.getSessionId(), isPublisher, !isPublisher,
isReconnecting, sdp);
mungedSdpOffer = this.setCodecPreference(forcedVideoCodec, sdp, applyHeavyMunging);
mungedSdpOffer = this.setCodecPreference(forcedVideoCodec, sdp);
log.debug(
"PARTICIPANT '{}' in Session '{}'. Is Publisher: '{}'. Is Subscriber: '{}'."

View File

@ -88,7 +88,7 @@ public class SDPMungingTest {
private void initTestsSetCodecPrevalence(VideoCodec codec, String sdpNameFile) throws IOException {
this.oldSdp = getSdpFile(sdpNameFile);
this.newSdp = this.sdpMungin.setCodecPreference(codec, oldSdp, false);
this.newSdp = this.sdpMungin.setCodecPreference(codec, oldSdp);
this.forceCodecPayloads = new ArrayList<>();
// Get all Payload-Type for video Codec