mirror of https://github.com/OpenVidu/openvidu.git
Added network cache param to IP cameras
parent
6f976246b4
commit
0fdbcaac90
|
@ -69,6 +69,7 @@ public class CDREventWebrtcConnection extends CDREventEnd implements Comparable<
|
||||||
if (kMediaOptions.rtspUri != null) {
|
if (kMediaOptions.rtspUri != null) {
|
||||||
json.addProperty("rtspUri", kMediaOptions.rtspUri);
|
json.addProperty("rtspUri", kMediaOptions.rtspUri);
|
||||||
json.addProperty("adaptativeBitrate", kMediaOptions.adaptativeBitrate);
|
json.addProperty("adaptativeBitrate", kMediaOptions.adaptativeBitrate);
|
||||||
|
json.addProperty("networkCache", kMediaOptions.network_cache);
|
||||||
json.addProperty("onlyPlayWithSubscribers", kMediaOptions.onlyPlayWithSubscribers);
|
json.addProperty("onlyPlayWithSubscribers", kMediaOptions.onlyPlayWithSubscribers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class KurentoMediaOptions extends MediaOptions {
|
||||||
public String rtspUri;
|
public String rtspUri;
|
||||||
public Boolean adaptativeBitrate;
|
public Boolean adaptativeBitrate;
|
||||||
public Boolean onlyPlayWithSubscribers;
|
public Boolean onlyPlayWithSubscribers;
|
||||||
|
public Integer network_cache;
|
||||||
|
|
||||||
public KurentoMediaOptions(boolean isOffer, String sdpOffer, Boolean hasAudio, Boolean hasVideo,
|
public KurentoMediaOptions(boolean isOffer, String sdpOffer, Boolean hasAudio, Boolean hasVideo,
|
||||||
Boolean audioActive, Boolean videoActive, String typeOfVideo, Integer frameRate, String videoDimensions,
|
Boolean audioActive, Boolean videoActive, String typeOfVideo, Integer frameRate, String videoDimensions,
|
||||||
|
@ -45,7 +46,7 @@ public class KurentoMediaOptions extends MediaOptions {
|
||||||
public KurentoMediaOptions(boolean isOffer, String sdpOffer, Boolean hasAudio, Boolean hasVideo,
|
public KurentoMediaOptions(boolean isOffer, String sdpOffer, Boolean hasAudio, Boolean hasVideo,
|
||||||
Boolean audioActive, Boolean videoActive, String typeOfVideo, Integer frameRate, String videoDimensions,
|
Boolean audioActive, Boolean videoActive, String typeOfVideo, Integer frameRate, String videoDimensions,
|
||||||
KurentoFilter filter, boolean doLoopback, String rtspUri, Boolean adaptativeBitrate,
|
KurentoFilter filter, boolean doLoopback, String rtspUri, Boolean adaptativeBitrate,
|
||||||
Boolean onlyPlayWithSubscribers) {
|
Boolean onlyPlayWithSubscribers, Integer network_cache) {
|
||||||
super(hasAudio, hasVideo, audioActive, videoActive, typeOfVideo, frameRate, videoDimensions, filter);
|
super(hasAudio, hasVideo, audioActive, videoActive, typeOfVideo, frameRate, videoDimensions, filter);
|
||||||
this.isOffer = isOffer;
|
this.isOffer = isOffer;
|
||||||
this.sdpOffer = sdpOffer;
|
this.sdpOffer = sdpOffer;
|
||||||
|
@ -53,6 +54,7 @@ public class KurentoMediaOptions extends MediaOptions {
|
||||||
this.rtspUri = rtspUri;
|
this.rtspUri = rtspUri;
|
||||||
this.adaptativeBitrate = adaptativeBitrate;
|
this.adaptativeBitrate = adaptativeBitrate;
|
||||||
this.onlyPlayWithSubscribers = onlyPlayWithSubscribers;
|
this.onlyPlayWithSubscribers = onlyPlayWithSubscribers;
|
||||||
|
this.network_cache = network_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
public KurentoMediaOptions(Boolean hasAudio, Boolean hasVideo, Boolean audioActive, Boolean videoActive,
|
public KurentoMediaOptions(Boolean hasAudio, Boolean hasVideo, Boolean audioActive, Boolean videoActive,
|
||||||
|
@ -65,6 +67,7 @@ public class KurentoMediaOptions extends MediaOptions {
|
||||||
this.rtspUri = streamProperties.rtspUri;
|
this.rtspUri = streamProperties.rtspUri;
|
||||||
this.adaptativeBitrate = streamProperties.adaptativeBitrate;
|
this.adaptativeBitrate = streamProperties.adaptativeBitrate;
|
||||||
this.onlyPlayWithSubscribers = streamProperties.onlyPlayWithSubscribers;
|
this.onlyPlayWithSubscribers = streamProperties.onlyPlayWithSubscribers;
|
||||||
|
this.network_cache = streamProperties.network_cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -76,6 +79,9 @@ public class KurentoMediaOptions extends MediaOptions {
|
||||||
if (onlyPlayWithSubscribers != null) {
|
if (onlyPlayWithSubscribers != null) {
|
||||||
json.addProperty("onlyPlayWithSubscribers", onlyPlayWithSubscribers);
|
json.addProperty("onlyPlayWithSubscribers", onlyPlayWithSubscribers);
|
||||||
}
|
}
|
||||||
|
if (network_cache != null) {
|
||||||
|
json.addProperty("networkCache", network_cache);
|
||||||
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,6 +364,9 @@ public abstract class MediaEndpoint {
|
||||||
if (!mediaOptions.adaptativeBitrate) {
|
if (!mediaOptions.adaptativeBitrate) {
|
||||||
playerBuilder = playerBuilder.useEncodedMedia();
|
playerBuilder = playerBuilder.useEncodedMedia();
|
||||||
}
|
}
|
||||||
|
if (mediaOptions.network_cache != null) {
|
||||||
|
playerBuilder = playerBuilder.withNetworkCache(mediaOptions.network_cache);
|
||||||
|
}
|
||||||
|
|
||||||
playerBuilder.buildAsync(new Continuation<PlayerEndpoint>() {
|
playerBuilder.buildAsync(new Continuation<PlayerEndpoint>() {
|
||||||
|
|
||||||
|
|
|
@ -755,12 +755,19 @@ public class SessionRestController {
|
||||||
String rtspUri;
|
String rtspUri;
|
||||||
Boolean adaptativeBitrate;
|
Boolean adaptativeBitrate;
|
||||||
Boolean onlyPlayWithSubscribers;
|
Boolean onlyPlayWithSubscribers;
|
||||||
|
String network_cache_str;
|
||||||
|
Integer network_cache;
|
||||||
String data;
|
String data;
|
||||||
try {
|
try {
|
||||||
type = (String) params.get("type");
|
type = (String) params.get("type");
|
||||||
rtspUri = (String) params.get("rtspUri");
|
rtspUri = (String) params.get("rtspUri");
|
||||||
adaptativeBitrate = (Boolean) params.get("adaptativeBitrate");
|
adaptativeBitrate = (Boolean) params.get("adaptativeBitrate");
|
||||||
onlyPlayWithSubscribers = (Boolean) params.get("onlyPlayWithSubscribers");
|
onlyPlayWithSubscribers = (Boolean) params.get("onlyPlayWithSubscribers");
|
||||||
|
network_cache_str = (String) params.get("networkCache");
|
||||||
|
if (network_cache_str != null)
|
||||||
|
network_cache = Integer.parseInt(network_cache_str);
|
||||||
|
else
|
||||||
|
network_cache = null;
|
||||||
data = (String) params.get("data");
|
data = (String) params.get("data");
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
return this.generateErrorResponse("Type error in some parameter",
|
return this.generateErrorResponse("Type error in some parameter",
|
||||||
|
@ -785,7 +792,7 @@ public class SessionRestController {
|
||||||
String videoDimensions = null;
|
String videoDimensions = null;
|
||||||
KurentoMediaOptions mediaOptions = new KurentoMediaOptions(true, null, hasAudio, hasVideo, audioActive,
|
KurentoMediaOptions mediaOptions = new KurentoMediaOptions(true, null, hasAudio, hasVideo, audioActive,
|
||||||
videoActive, typeOfVideo, frameRate, videoDimensions, null, false, rtspUri, adaptativeBitrate,
|
videoActive, typeOfVideo, frameRate, videoDimensions, null, false, rtspUri, adaptativeBitrate,
|
||||||
onlyPlayWithSubscribers);
|
onlyPlayWithSubscribers, network_cache);
|
||||||
|
|
||||||
// While closing a session IP cameras can't be published
|
// While closing a session IP cameras can't be published
|
||||||
if (session.closingLock.readLock().tryLock()) {
|
if (session.closingLock.readLock().tryLock()) {
|
||||||
|
|
Loading…
Reference in New Issue