openvidu-server: ignore empty string on RecordingProperties "mediaNode" param

pull/621/head
pabloFuente 2021-04-23 10:38:23 +02:00
parent 4891dca38c
commit 635579ad75
2 changed files with 11 additions and 3 deletions

View File

@ -407,6 +407,9 @@ public class RecordingProperties {
return json;
}
/**
* @hidden
*/
public static RecordingProperties fromJson(JsonObject json) {
Boolean hasVideoAux = true;
@ -450,10 +453,15 @@ public class RecordingProperties {
}
}
if (json.has("mediaNode")) {
String mediaNodeId = null;
if (json.get("mediaNode").isJsonObject()) {
builder.mediaNode(json.get("mediaNode").getAsJsonObject().get("id").getAsString());
mediaNodeId = json.get("mediaNode").getAsJsonObject().get("id").getAsString();
} else if (json.get("mediaNode").isJsonPrimitive()) {
builder.mediaNode(json.get("mediaNode").getAsString());
mediaNodeId = json.get("mediaNode").getAsString();
}
if (mediaNodeId != null && !mediaNodeId.isEmpty()) {
builder.mediaNode(mediaNodeId);
}
}
return builder.build();

View File

@ -12,7 +12,7 @@ public final class RecordingUtils {
public final static RecordingProperties RECORDING_PROPERTIES_WITH_MEDIA_NODE(Session session) {
RecordingProperties recordingProperties = session.getSessionProperties().defaultRecordingProperties();
if (recordingProperties.mediaNode() == null || recordingProperties.mediaNode().isEmpty()) {
if (recordingProperties.mediaNode() == null) {
recordingProperties = new RecordingProperties.Builder(recordingProperties)
.mediaNode(session.getMediaNodeId()).build();
}