mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: do not allow client forceUnpublish over IPCAM streams
parent
e6dcb7941e
commit
2741605b78
|
@ -163,6 +163,11 @@ public class Participant {
|
||||||
return fullMetadata;
|
return fullMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void deleteIpcamProperties() {
|
||||||
|
this.clientMetadata = "";
|
||||||
|
this.token.setToken(null);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
|
@ -225,7 +230,9 @@ public class Participant {
|
||||||
json.addProperty("createdAt", this.createdAt);
|
json.addProperty("createdAt", this.createdAt);
|
||||||
json.addProperty("location", this.location != null ? this.location.toString() : "unknown");
|
json.addProperty("location", this.location != null ? this.location.toString() : "unknown");
|
||||||
json.addProperty("platform", this.platform);
|
json.addProperty("platform", this.platform);
|
||||||
json.addProperty("token", this.token.getToken());
|
if (this.token.getToken() != null) {
|
||||||
|
json.addProperty("token", this.token.getToken());
|
||||||
|
}
|
||||||
json.addProperty("role", this.token.getRole().name());
|
json.addProperty("role", this.token.getRole().name());
|
||||||
json.addProperty("serverData", this.serverMetadata);
|
json.addProperty("serverData", this.serverMetadata);
|
||||||
json.addProperty("clientData", this.clientMetadata);
|
json.addProperty("clientData", this.clientMetadata);
|
||||||
|
|
|
@ -624,6 +624,10 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
if (participantPrivateId != null) {
|
if (participantPrivateId != null) {
|
||||||
Participant participant = this.getParticipant(participantPrivateId);
|
Participant participant = this.getParticipant(participantPrivateId);
|
||||||
if (participant != null) {
|
if (participant != null) {
|
||||||
|
if (participant.isIpcam()) {
|
||||||
|
throw new OpenViduException(Code.USER_GENERIC_ERROR_CODE, "Stream '" + streamId
|
||||||
|
+ " belonging to an IPCAM participant cannot be unpublished. IPCAM streams can only be unpublished by forcing the disconnection of the IPCAM connection");
|
||||||
|
}
|
||||||
this.unpublishVideo(participant, moderator, transactionId, reason);
|
this.unpublishVideo(participant, moderator, transactionId, reason);
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -921,6 +925,8 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
|
|
||||||
// Publish the IpCam stream into the session
|
// Publish the IpCam stream into the session
|
||||||
KurentoParticipant kParticipant = (KurentoParticipant) this.getParticipant(rtspConnectionId);
|
KurentoParticipant kParticipant = (KurentoParticipant) this.getParticipant(rtspConnectionId);
|
||||||
|
kParticipant.deleteIpcamProperties();
|
||||||
|
|
||||||
this.publishVideo(kParticipant, mediaOptions, null);
|
this.publishVideo(kParticipant, mediaOptions, null);
|
||||||
return kParticipant;
|
return kParticipant;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue