mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: use OfferOptions when generating SDP offer
parent
084cfc49f7
commit
076fb233e2
|
@ -37,6 +37,7 @@ import org.kurento.client.IceCandidate;
|
||||||
import org.kurento.client.ListenerSubscription;
|
import org.kurento.client.ListenerSubscription;
|
||||||
import org.kurento.client.MediaElement;
|
import org.kurento.client.MediaElement;
|
||||||
import org.kurento.client.MediaPipeline;
|
import org.kurento.client.MediaPipeline;
|
||||||
|
import org.kurento.client.OfferOptions;
|
||||||
import org.kurento.client.PlayerEndpoint;
|
import org.kurento.client.PlayerEndpoint;
|
||||||
import org.kurento.client.RtpEndpoint;
|
import org.kurento.client.RtpEndpoint;
|
||||||
import org.kurento.client.SdpEndpoint;
|
import org.kurento.client.SdpEndpoint;
|
||||||
|
@ -519,13 +520,13 @@ public abstract class MediaEndpoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String generateOffer() throws OpenViduException {
|
protected String generateOffer(OfferOptions offerOptions) throws OpenViduException {
|
||||||
if (this.isWeb()) {
|
if (this.isWeb()) {
|
||||||
if (webEndpoint == null) {
|
if (webEndpoint == null) {
|
||||||
throw new OpenViduException(Code.MEDIA_WEBRTC_ENDPOINT_ERROR_CODE,
|
throw new OpenViduException(Code.MEDIA_WEBRTC_ENDPOINT_ERROR_CODE,
|
||||||
"Can't generate offer when WebRtcEndpoint is null (ep: " + endpointName + ")");
|
"Can't generate offer when WebRtcEndpoint is null (ep: " + endpointName + ")");
|
||||||
}
|
}
|
||||||
return webEndpoint.generateOffer();
|
return webEndpoint.generateOffer(offerOptions);
|
||||||
} else if (this.isPlayerEndpoint()) {
|
} else if (this.isPlayerEndpoint()) {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
|
@ -533,7 +534,7 @@ public abstract class MediaEndpoint {
|
||||||
throw new OpenViduException(Code.MEDIA_RTP_ENDPOINT_ERROR_CODE,
|
throw new OpenViduException(Code.MEDIA_RTP_ENDPOINT_ERROR_CODE,
|
||||||
"Can't generate offer when RtpEndpoint is null (ep: " + endpointName + ")");
|
"Can't generate offer when RtpEndpoint is null (ep: " + endpointName + ")");
|
||||||
}
|
}
|
||||||
return endpoint.generateOffer();
|
return endpoint.generateOffer(offerOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ package io.openvidu.server.kurento.endpoint;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import org.kurento.client.MediaPipeline;
|
import org.kurento.client.MediaPipeline;
|
||||||
|
import org.kurento.client.OfferOptions;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
@ -50,7 +51,12 @@ public class SubscriberEndpoint extends MediaEndpoint {
|
||||||
publisher.connect(this.getEndpoint(), true);
|
publisher.connect(this.getEndpoint(), true);
|
||||||
this.createdAt = System.currentTimeMillis();
|
this.createdAt = System.currentTimeMillis();
|
||||||
this.publisherStreamId = publisher.getStreamId();
|
this.publisherStreamId = publisher.getStreamId();
|
||||||
String sdpOffer = generateOffer();
|
|
||||||
|
OfferOptions offerOptions = new OfferOptions();
|
||||||
|
offerOptions.setOfferToReceiveAudio(publisher.getMediaOptions().hasAudio());
|
||||||
|
offerOptions.setOfferToReceiveVideo(publisher.getMediaOptions().hasVideo());
|
||||||
|
String sdpOffer = generateOffer(offerOptions);
|
||||||
|
|
||||||
gatherCandidates();
|
gatherCandidates();
|
||||||
return sdpOffer;
|
return sdpOffer;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue