mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: offerToReceiveAudio and offerToReceiveVideo on generateOffer
parent
1a8733b2ea
commit
d7f0d4bdf8
|
@ -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;
|
||||||
|
@ -516,13 +517,13 @@ public abstract class MediaEndpoint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String generateOffer() throws OpenViduException {
|
protected String generateOffer(OfferOptions options) 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(options);
|
||||||
} else if (this.isPlayerEndpoint()) {
|
} else if (this.isPlayerEndpoint()) {
|
||||||
return "";
|
return "";
|
||||||
} else {
|
} else {
|
||||||
|
@ -530,7 +531,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(options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
@ -49,7 +50,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