openvidu-server: networkCache minor refactoring

pull/546/head
pabloFuente 2020-09-18 15:00:59 +02:00
parent d0ed5e5345
commit 23e965f9f4
2 changed files with 4 additions and 9 deletions

View File

@ -763,7 +763,6 @@ public class SessionRestController {
String rtspUri; String rtspUri;
Boolean adaptativeBitrate; Boolean adaptativeBitrate;
Boolean onlyPlayWithSubscribers; Boolean onlyPlayWithSubscribers;
String networkCacheStr;
Integer networkCache; Integer networkCache;
String data; String data;
try { try {
@ -771,11 +770,7 @@ public class SessionRestController {
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");
networkCacheStr = (String) params.get("networkCache"); networkCache = (Integer) params.get("networkCache");
if (networkCacheStr != null)
networkCache = Integer.parseInt(networkCacheStr);
else
networkCache = 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",

View File

@ -3088,7 +3088,7 @@ public class OpenViduTestAppE2eTest {
HttpStatus.SC_BAD_REQUEST); HttpStatus.SC_BAD_REQUEST);
// Publish IP camera. Dummy URL because no user will subscribe to it [200] // Publish IP camera. Dummy URL because no user will subscribe to it [200]
String ipCamBody = "{'type':'IPCAM','rtspUri':'rtsp://dummyurl.com','adaptativeBitrate':true,'onlyPlayWithSubscribers':true,'data':'MY_IP_CAMERA'}"; String ipCamBody = "{'type':'IPCAM','rtspUri':'rtsp://dummyurl.com','adaptativeBitrate':true,'onlyPlayWithSubscribers':true,'networkCache':1000,'data':'MY_IP_CAMERA'}";
JsonObject response = restClient.rest(HttpMethod.POST, "/api/sessions/IP_CAM_SESSION/connection", ipCamBody, JsonObject response = restClient.rest(HttpMethod.POST, "/api/sessions/IP_CAM_SESSION/connection", ipCamBody,
HttpStatus.SC_OK, true, HttpStatus.SC_OK, true,
"{'connectionId':'STR','createdAt':0,'location':'STR','platform':'STR','role':'STR','serverData':'STR','clientData':'STR','publishers':[],'subscribers':[]}"); "{'connectionId':'STR','createdAt':0,'location':'STR','platform':'STR','role':'STR','serverData':'STR','clientData':'STR','publishers':[],'subscribers':[]}");
@ -3108,7 +3108,7 @@ public class OpenViduTestAppE2eTest {
Assert.assertEquals("Wrong rtspUri property", "rtsp://dummyurl.com", Assert.assertEquals("Wrong rtspUri property", "rtsp://dummyurl.com",
ipCamPublisher.get("rtspUri").getAsString()); ipCamPublisher.get("rtspUri").getAsString());
JsonObject mediaOptions = ipCamPublisher.get("mediaOptions").getAsJsonObject(); JsonObject mediaOptions = ipCamPublisher.get("mediaOptions").getAsJsonObject();
Assert.assertEquals("Wrong number of properties in MediaOptions", 10, mediaOptions.size()); Assert.assertEquals("Wrong number of properties in MediaOptions", 11, mediaOptions.size());
Assert.assertTrue("Wrong adaptativeBitrate property", mediaOptions.get("adaptativeBitrate").getAsBoolean()); Assert.assertTrue("Wrong adaptativeBitrate property", mediaOptions.get("adaptativeBitrate").getAsBoolean());
Assert.assertTrue("Wrong onlyPlayWithSubscribers property", Assert.assertTrue("Wrong onlyPlayWithSubscribers property",
mediaOptions.get("onlyPlayWithSubscribers").getAsBoolean()); mediaOptions.get("onlyPlayWithSubscribers").getAsBoolean());
@ -3185,7 +3185,7 @@ public class OpenViduTestAppE2eTest {
recPath = recPath.endsWith("/") ? recPath : (recPath + "/"); recPath = recPath.endsWith("/") ? recPath : (recPath + "/");
String fullRecordingPath = "file://" + recPath + "TestSession/audioVideo.mp4"; String fullRecordingPath = "file://" + recPath + "TestSession/audioVideo.mp4";
ipCamBody = "{'type':'IPCAM','rtspUri':'" + fullRecordingPath ipCamBody = "{'type':'IPCAM','rtspUri':'" + fullRecordingPath
+ "','adaptativeBitrate':true,'onlyPlayWithSubscribers':true,'data':'MY_IP_CAMERA'}"; + "','adaptativeBitrate':true,'onlyPlayWithSubscribers':true,'networkCache':1000,'data':'MY_IP_CAMERA'}";
restClient.rest(HttpMethod.POST, "/api/sessions/TestSession/connection", ipCamBody, HttpStatus.SC_OK, true, restClient.rest(HttpMethod.POST, "/api/sessions/TestSession/connection", ipCamBody, HttpStatus.SC_OK, true,
"{'connectionId':'STR','createdAt':0,'location':'STR','platform':'STR','role':'STR','serverData':'STR','clientData':'STR','publishers':[],'subscribers':[]}"); "{'connectionId':'STR','createdAt':0,'location':'STR','platform':'STR','role':'STR','serverData':'STR','clientData':'STR','publishers':[],'subscribers':[]}");