mirror of https://github.com/OpenVidu/openvidu.git
Merge pull request #667 from OpenVidu/forcecodec-preferred
ForcedVideoCodec default set to MEDIA_SERVER_PREFERREDpull/685/head
commit
46c7516764
|
@ -38,6 +38,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
import com.google.gson.Gson;
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
|
|
||||||
|
@ -661,16 +662,17 @@ public class Session {
|
||||||
this.sessionId = responseJson.get("id").getAsString();
|
this.sessionId = responseJson.get("id").getAsString();
|
||||||
this.createdAt = responseJson.get("createdAt").getAsLong();
|
this.createdAt = responseJson.get("createdAt").getAsLong();
|
||||||
|
|
||||||
// forcedVideoCodec and allowTranscoding values are configured in OpenVidu
|
// Values that get filled by OpenVidu Server from its global or per-session configuration
|
||||||
// Server via configuration or session
|
|
||||||
VideoCodec forcedVideoCodec = VideoCodec.valueOf(responseJson.get("forcedVideoCodec").getAsString());
|
VideoCodec forcedVideoCodec = VideoCodec.valueOf(responseJson.get("forcedVideoCodec").getAsString());
|
||||||
|
VideoCodec forcedVideoCodecResolved = VideoCodec
|
||||||
|
.valueOf(responseJson.get("forcedVideoCodecResolved").getAsString());
|
||||||
Boolean allowTranscoding = responseJson.get("allowTranscoding").getAsBoolean();
|
Boolean allowTranscoding = responseJson.get("allowTranscoding").getAsBoolean();
|
||||||
|
|
||||||
SessionProperties responseProperties = new SessionProperties.Builder()
|
SessionProperties responseProperties = new SessionProperties.Builder().mediaMode(properties.mediaMode())
|
||||||
.customSessionId(properties.customSessionId()).mediaMode(properties.mediaMode())
|
|
||||||
.recordingMode(properties.recordingMode())
|
.recordingMode(properties.recordingMode())
|
||||||
.defaultRecordingProperties(properties.defaultRecordingProperties())
|
.defaultRecordingProperties(properties.defaultRecordingProperties())
|
||||||
.mediaNode(properties.mediaNode()).forcedVideoCodec(forcedVideoCodec)
|
.customSessionId(properties.customSessionId()).mediaNode(properties.mediaNode())
|
||||||
|
.forcedVideoCodec(forcedVideoCodec).forcedVideoCodecResolved(forcedVideoCodecResolved)
|
||||||
.allowTranscoding(allowTranscoding).build();
|
.allowTranscoding(allowTranscoding).build();
|
||||||
|
|
||||||
this.properties = responseProperties;
|
this.properties = responseProperties;
|
||||||
|
@ -718,6 +720,9 @@ public class Session {
|
||||||
if (json.has("forcedVideoCodec")) {
|
if (json.has("forcedVideoCodec")) {
|
||||||
builder.forcedVideoCodec(VideoCodec.valueOf(json.get("forcedVideoCodec").getAsString()));
|
builder.forcedVideoCodec(VideoCodec.valueOf(json.get("forcedVideoCodec").getAsString()));
|
||||||
}
|
}
|
||||||
|
if (json.has("forcedVideoCodecResolved")) {
|
||||||
|
builder.forcedVideoCodecResolved(VideoCodec.valueOf(json.get("forcedVideoCodecResolved").getAsString()));
|
||||||
|
}
|
||||||
if (json.has("allowTranscoding")) {
|
if (json.has("allowTranscoding")) {
|
||||||
builder.allowTranscoding(json.get("allowTranscoding").getAsBoolean());
|
builder.allowTranscoding(json.get("allowTranscoding").getAsBoolean());
|
||||||
}
|
}
|
||||||
|
@ -756,19 +761,15 @@ public class Session {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("sessionId", this.sessionId);
|
json.addProperty("sessionId", this.sessionId);
|
||||||
json.addProperty("createdAt", this.createdAt);
|
json.addProperty("createdAt", this.createdAt);
|
||||||
json.addProperty("customSessionId", this.properties.customSessionId());
|
|
||||||
json.addProperty("recording", this.recording);
|
json.addProperty("recording", this.recording);
|
||||||
json.addProperty("mediaMode", this.properties.mediaMode().name());
|
|
||||||
json.addProperty("recordingMode", this.properties.recordingMode().name());
|
// Add keys from SessionProperties
|
||||||
if (this.properties.defaultRecordingProperties() != null) {
|
JsonObject sessionPropertiesJson = this.properties.toJson();
|
||||||
json.add("defaultRecordingProperties", this.properties.defaultRecordingProperties().toJson());
|
for (Map.Entry<String, JsonElement> entry : sessionPropertiesJson.entrySet()) {
|
||||||
}
|
json.add(entry.getKey(), entry.getValue().deepCopy());
|
||||||
if (this.properties.forcedVideoCodec() != null) {
|
|
||||||
json.addProperty("forcedVideoCodec", this.properties.forcedVideoCodec().name());
|
|
||||||
}
|
|
||||||
if (this.properties.isTranscodingAllowed() != null) {
|
|
||||||
json.addProperty("allowTranscoding", this.properties.isTranscodingAllowed());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add "connections" object
|
||||||
JsonObject connections = new JsonObject();
|
JsonObject connections = new JsonObject();
|
||||||
connections.addProperty("numberOfElements", this.getConnections().size());
|
connections.addProperty("numberOfElements", this.getConnections().size());
|
||||||
JsonArray jsonArrayConnections = new JsonArray();
|
JsonArray jsonArrayConnections = new JsonArray();
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class SessionProperties {
|
||||||
private String customSessionId;
|
private String customSessionId;
|
||||||
private String mediaNode;
|
private String mediaNode;
|
||||||
private VideoCodec forcedVideoCodec;
|
private VideoCodec forcedVideoCodec;
|
||||||
|
private VideoCodec forcedVideoCodecResolved;
|
||||||
private Boolean allowTranscoding;
|
private Boolean allowTranscoding;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -42,7 +43,8 @@ public class SessionProperties {
|
||||||
private RecordingProperties defaultRecordingProperties = new RecordingProperties.Builder().build();
|
private RecordingProperties defaultRecordingProperties = new RecordingProperties.Builder().build();
|
||||||
private String customSessionId = "";
|
private String customSessionId = "";
|
||||||
private String mediaNode;
|
private String mediaNode;
|
||||||
private VideoCodec forcedVideoCodec = VideoCodec.VP8;
|
private VideoCodec forcedVideoCodec = VideoCodec.MEDIA_SERVER_PREFERRED;
|
||||||
|
private VideoCodec forcedVideoCodecResolved = VideoCodec.NONE;
|
||||||
private Boolean allowTranscoding = false;
|
private Boolean allowTranscoding = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -51,7 +53,8 @@ public class SessionProperties {
|
||||||
*/
|
*/
|
||||||
public SessionProperties build() {
|
public SessionProperties build() {
|
||||||
return new SessionProperties(this.mediaMode, this.recordingMode, this.defaultRecordingProperties,
|
return new SessionProperties(this.mediaMode, this.recordingMode, this.defaultRecordingProperties,
|
||||||
this.customSessionId, this.mediaNode, this.forcedVideoCodec, this.allowTranscoding);
|
this.customSessionId, this.mediaNode, this.forcedVideoCodec, this.forcedVideoCodecResolved,
|
||||||
|
this.allowTranscoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,21 +117,37 @@ public class SessionProperties {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this method to define which video codec do you want to be forcibly used
|
* Define which video codec will be forcibly used for this session.
|
||||||
* for this session. This allows browsers/clients to use the same codec avoiding
|
* This forces all browsers/clients to use the same codec, which would
|
||||||
* transcoding in the media server. If the browser/client is not compatible with
|
* avoid transcoding in the media server (Kurento only). If
|
||||||
* the specified codec and {@link #allowTranscoding(Boolean)} is
|
* <code>forcedVideoCodec</code> is set to NONE, no codec will be forced.
|
||||||
* <code>false</code> and exception will occur. If forcedVideoCodec is set to
|
*
|
||||||
* NONE, no codec will be forced.<br>
|
* If the browser/client is not compatible with the specified codec, and
|
||||||
|
* {@link #allowTranscoding(Boolean)} is <code>false</code>, an
|
||||||
|
* exception will occur.
|
||||||
|
*
|
||||||
* If defined here, this parameter has prevalence over
|
* If defined here, this parameter has prevalence over
|
||||||
* OPENVIDU_STREAMS_FORCED_VIDEO_CODEC. OPENVIDU_STREAMS_FORCED_VIDEO_CODEC
|
* OPENVIDU_STREAMS_FORCED_VIDEO_CODEC.
|
||||||
* default is {@link VideoCodec#VP8}
|
*
|
||||||
|
* Default is {@link VideoCodec#MEDIA_SERVER_PREFERRED}.
|
||||||
*/
|
*/
|
||||||
public SessionProperties.Builder forcedVideoCodec(VideoCodec forcedVideoCodec) {
|
public SessionProperties.Builder forcedVideoCodec(VideoCodec forcedVideoCodec) {
|
||||||
this.forcedVideoCodec = forcedVideoCodec;
|
this.forcedVideoCodec = forcedVideoCodec;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actual video codec that will be forcibly used for this session.
|
||||||
|
* This is the same as <code>forcedVideoCodec</code>, except when its
|
||||||
|
* value is {@link VideoCodec#MEDIA_SERVER_PREFERRED}: in that case,
|
||||||
|
* OpenVidu Server will fill this property with a resolved value,
|
||||||
|
* depending on what is the configured media server.
|
||||||
|
*/
|
||||||
|
public SessionProperties.Builder forcedVideoCodecResolved(VideoCodec forcedVideoCodec) {
|
||||||
|
this.forcedVideoCodecResolved = forcedVideoCodec;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Call this method to define if you want to allow transcoding in the media
|
* Call this method to define if you want to allow transcoding in the media
|
||||||
* server or not when {@link #forcedVideoCodec(VideoCodec)} is not compatible
|
* server or not when {@link #forcedVideoCodec(VideoCodec)} is not compatible
|
||||||
|
@ -154,13 +173,14 @@ public class SessionProperties {
|
||||||
|
|
||||||
private SessionProperties(MediaMode mediaMode, RecordingMode recordingMode,
|
private SessionProperties(MediaMode mediaMode, RecordingMode recordingMode,
|
||||||
RecordingProperties defaultRecordingProperties, String customSessionId, String mediaNode,
|
RecordingProperties defaultRecordingProperties, String customSessionId, String mediaNode,
|
||||||
VideoCodec forcedVideoCodec, Boolean allowTranscoding) {
|
VideoCodec forcedVideoCodec, VideoCodec forcedVideoCodecResolved, Boolean allowTranscoding) {
|
||||||
this.mediaMode = mediaMode;
|
this.mediaMode = mediaMode;
|
||||||
this.recordingMode = recordingMode;
|
this.recordingMode = recordingMode;
|
||||||
this.defaultRecordingProperties = defaultRecordingProperties;
|
this.defaultRecordingProperties = defaultRecordingProperties;
|
||||||
this.customSessionId = customSessionId;
|
this.customSessionId = customSessionId;
|
||||||
this.mediaNode = mediaNode;
|
this.mediaNode = mediaNode;
|
||||||
this.forcedVideoCodec = forcedVideoCodec;
|
this.forcedVideoCodec = forcedVideoCodec;
|
||||||
|
this.forcedVideoCodecResolved = forcedVideoCodecResolved;
|
||||||
this.allowTranscoding = allowTranscoding;
|
this.allowTranscoding = allowTranscoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,12 +237,24 @@ public class SessionProperties {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines which video codec is being forced to be used in the browser/client
|
* Defines which video codec is being forced to be used in the browser/client.
|
||||||
|
* This is the raw value that was configured. It might get resolved into a
|
||||||
|
* different one for actual usage in the server.
|
||||||
*/
|
*/
|
||||||
public VideoCodec forcedVideoCodec() {
|
public VideoCodec forcedVideoCodec() {
|
||||||
return this.forcedVideoCodec;
|
return this.forcedVideoCodec;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines which video codec is being forced to be used in the browser/client.
|
||||||
|
* This is the resolved value, for actual usage in the server.
|
||||||
|
*
|
||||||
|
* @hidden
|
||||||
|
*/
|
||||||
|
public VideoCodec forcedVideoCodecResolved() {
|
||||||
|
return this.forcedVideoCodecResolved;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Defines if transcoding is allowed or not when {@link #forcedVideoCodec} is
|
* Defines if transcoding is allowed or not when {@link #forcedVideoCodec} is
|
||||||
* not a compatible codec with the browser/client.
|
* not a compatible codec with the browser/client.
|
||||||
|
@ -231,22 +263,25 @@ public class SessionProperties {
|
||||||
return this.allowTranscoding;
|
return this.allowTranscoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected JsonObject toJson() {
|
public JsonObject toJson() {
|
||||||
JsonObject json = new JsonObject();
|
JsonObject json = new JsonObject();
|
||||||
json.addProperty("mediaMode", mediaMode().name());
|
json.addProperty("mediaMode", this.mediaMode.name());
|
||||||
json.addProperty("recordingMode", recordingMode().name());
|
json.addProperty("recordingMode", this.recordingMode.name());
|
||||||
json.addProperty("customSessionId", customSessionId());
|
json.add("defaultRecordingProperties", this.defaultRecordingProperties.toJson());
|
||||||
json.add("defaultRecordingProperties", defaultRecordingProperties.toJson());
|
json.addProperty("customSessionId", this.customSessionId);
|
||||||
if (mediaNode() != null) {
|
if (this.mediaNode != null && !this.mediaNode.isEmpty()) {
|
||||||
JsonObject mediaNodeJson = new JsonObject();
|
JsonObject mediaNodeJson = new JsonObject();
|
||||||
mediaNodeJson.addProperty("id", mediaNode());
|
mediaNodeJson.addProperty("id", this.mediaNode);
|
||||||
json.add("mediaNode", mediaNodeJson);
|
json.add("mediaNode", mediaNodeJson);
|
||||||
}
|
}
|
||||||
if (forcedVideoCodec() != null) {
|
if (this.forcedVideoCodec != null) {
|
||||||
json.addProperty("forcedVideoCodec", forcedVideoCodec().name());
|
json.addProperty("forcedVideoCodec", this.forcedVideoCodec.name());
|
||||||
}
|
}
|
||||||
if (isTranscodingAllowed() != null) {
|
if (this.forcedVideoCodecResolved != null) {
|
||||||
json.addProperty("allowTranscoding", isTranscodingAllowed());
|
json.addProperty("forcedVideoCodecResolved", this.forcedVideoCodecResolved.name());
|
||||||
|
}
|
||||||
|
if (this.allowTranscoding != null) {
|
||||||
|
json.addProperty("allowTranscoding", this.allowTranscoding);
|
||||||
}
|
}
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,5 +22,5 @@ package io.openvidu.java.client;
|
||||||
* {@link io.openvidu.java.client.SessionProperties.Builder#forcedVideoCodec(VideoCodec)}
|
* {@link io.openvidu.java.client.SessionProperties.Builder#forcedVideoCodec(VideoCodec)}
|
||||||
*/
|
*/
|
||||||
public enum VideoCodec {
|
public enum VideoCodec {
|
||||||
VP8, VP9, H264, NONE
|
MEDIA_SERVER_PREFERRED, NONE, VP8, VP9, H264
|
||||||
}
|
}
|
|
@ -490,6 +490,7 @@ export class Session {
|
||||||
this.properties.defaultRecordingProperties = res.data.defaultRecordingProperties;
|
this.properties.defaultRecordingProperties = res.data.defaultRecordingProperties;
|
||||||
this.properties.mediaNode = res.data.mediaNode;
|
this.properties.mediaNode = res.data.mediaNode;
|
||||||
this.properties.forcedVideoCodec = res.data.forcedVideoCodec;
|
this.properties.forcedVideoCodec = res.data.forcedVideoCodec;
|
||||||
|
this.properties.forcedVideoCodecResolved = res.data.forcedVideoCodecResolved;
|
||||||
this.properties.allowTranscoding = res.data.allowTranscoding;
|
this.properties.allowTranscoding = res.data.allowTranscoding;
|
||||||
this.sanitizeDefaultSessionProperties(this.properties);
|
this.sanitizeDefaultSessionProperties(this.properties);
|
||||||
resolve(this.sessionId);
|
resolve(this.sessionId);
|
||||||
|
@ -533,6 +534,7 @@ export class Session {
|
||||||
recordingMode: json.recordingMode,
|
recordingMode: json.recordingMode,
|
||||||
defaultRecordingProperties: json.defaultRecordingProperties,
|
defaultRecordingProperties: json.defaultRecordingProperties,
|
||||||
forcedVideoCodec: json.forcedVideoCodec,
|
forcedVideoCodec: json.forcedVideoCodec,
|
||||||
|
forcedVideoCodecResolved: json.forcedVideoCodecResolved,
|
||||||
allowTranscoding: json.allowTranscoding
|
allowTranscoding: json.allowTranscoding
|
||||||
};
|
};
|
||||||
this.sanitizeDefaultSessionProperties(this.properties);
|
this.sanitizeDefaultSessionProperties(this.properties);
|
||||||
|
@ -548,6 +550,9 @@ export class Session {
|
||||||
if (json.forcedVideoCodec == null) {
|
if (json.forcedVideoCodec == null) {
|
||||||
delete this.properties.forcedVideoCodec;
|
delete this.properties.forcedVideoCodec;
|
||||||
}
|
}
|
||||||
|
if (json.forcedVideoCodecResolved == null) {
|
||||||
|
delete this.properties.forcedVideoCodecResolved;
|
||||||
|
}
|
||||||
if (json.allowTranscoding == null) {
|
if (json.allowTranscoding == null) {
|
||||||
delete this.properties.allowTranscoding;
|
delete this.properties.allowTranscoding;
|
||||||
}
|
}
|
||||||
|
@ -655,9 +660,12 @@ export class Session {
|
||||||
props.mediaMode = (props.mediaMode != null) ? props.mediaMode : MediaMode.ROUTED;
|
props.mediaMode = (props.mediaMode != null) ? props.mediaMode : MediaMode.ROUTED;
|
||||||
props.recordingMode = (props.recordingMode != null) ? props.recordingMode : RecordingMode.MANUAL;
|
props.recordingMode = (props.recordingMode != null) ? props.recordingMode : RecordingMode.MANUAL;
|
||||||
props.customSessionId = (props.customSessionId != null) ? props.customSessionId : '';
|
props.customSessionId = (props.customSessionId != null) ? props.customSessionId : '';
|
||||||
props.mediaNode = (props.mediaNode != null) ? props.mediaNode : undefined;
|
|
||||||
props.forcedVideoCodec = props.forcedVideoCodec;
|
// Remove null values: either set, or undefined
|
||||||
props.allowTranscoding = props.allowTranscoding;
|
props.mediaNode = props.mediaNode ?? undefined;
|
||||||
|
props.forcedVideoCodec = props.forcedVideoCodec ?? undefined;
|
||||||
|
props.forcedVideoCodecResolved = props.forcedVideoCodecResolved ?? undefined;
|
||||||
|
props.allowTranscoding = props.allowTranscoding ?? undefined;
|
||||||
|
|
||||||
if (!props.defaultRecordingProperties) {
|
if (!props.defaultRecordingProperties) {
|
||||||
props.defaultRecordingProperties = {};
|
props.defaultRecordingProperties = {};
|
||||||
|
|
|
@ -67,16 +67,32 @@ export interface SessionProperties {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It defines which video codec do you want to be forcibly used for this session.
|
* Define which video codec will be forcibly used for this session.
|
||||||
* This allows browsers/clients to use the same codec avoiding transcoding in the media server.
|
* This forces all browsers/clients to use the same codec, which would
|
||||||
* If the browser/client is not compatible with the specified codec and [[allowTranscoding]] is <code>false</code>
|
* avoid transcoding in the media server (Kurento only). If
|
||||||
* and exception will occur. If forcedVideoCodec is set to [[VideoCodec.NONE]], no codec will be forced.
|
* <code>forcedVideoCodec</code> is set to NONE, no codec will be forced.
|
||||||
*
|
*
|
||||||
* If defined here, this parameter has prevalence over OPENVIDU_STREAMS_FORCED_VIDEO_CODEC.
|
* If the browser/client is not compatible with the specified codec, and
|
||||||
* OPENVIDU_STREAMS_FORCED_VIDEO_CODEC default is [[VideoCodec.VP8]]
|
* [[allowTranscoding]] is <code>false</code>, an exception will occur.
|
||||||
|
*
|
||||||
|
* If defined here, this parameter has prevalence over
|
||||||
|
* OPENVIDU_STREAMS_FORCED_VIDEO_CODEC.
|
||||||
|
*
|
||||||
|
* Default is [[VideoCodec.MEDIA_SERVER_PREFERRED]].
|
||||||
*/
|
*/
|
||||||
forcedVideoCodec?: VideoCodec;
|
forcedVideoCodec?: VideoCodec;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actual video codec that will be forcibly used for this session.
|
||||||
|
* This is the same as <code>forcedVideoCodec</code>, except when its value
|
||||||
|
* is [[VideoCodec.MEDIA_SERVER_PREFERRED]]: in that case, OpenVidu Server
|
||||||
|
* will fill this property with a resolved value, depending on what is the
|
||||||
|
* configured media server.
|
||||||
|
*
|
||||||
|
* @hidden
|
||||||
|
*/
|
||||||
|
forcedVideoCodecResolved?: VideoCodec;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It defines if you want to allow transcoding in the media server or not
|
* It defines if you want to allow transcoding in the media server or not
|
||||||
* when [[forcedVideoCodec]] is not compatible with the browser/client.
|
* when [[forcedVideoCodec]] is not compatible with the browser/client.
|
||||||
|
@ -85,5 +101,4 @@ export interface SessionProperties {
|
||||||
* OPENVIDU_STREAMS_ALLOW_TRANSCODING default is 'false'
|
* OPENVIDU_STREAMS_ALLOW_TRANSCODING default is 'false'
|
||||||
*/
|
*/
|
||||||
allowTranscoding?: boolean;
|
allowTranscoding?: boolean;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,9 @@
|
||||||
* See [[SessionProperties.forcedVideoCodec]]
|
* See [[SessionProperties.forcedVideoCodec]]
|
||||||
*/
|
*/
|
||||||
export enum VideoCodec {
|
export enum VideoCodec {
|
||||||
|
MEDIA_SERVER_PREFERRED = 'MEDIA_SERVER_PREFERRED',
|
||||||
|
NONE = 'NONE',
|
||||||
VP8 = 'VP8',
|
VP8 = 'VP8',
|
||||||
VP9 = 'VP9',
|
VP9 = 'VP9',
|
||||||
H264 = 'H264',
|
H264 = 'H264',
|
||||||
NONE = 'NONE'
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -128,9 +128,9 @@ OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300
|
||||||
|
|
||||||
# All sessions of OpenVidu will try to force this codec. If OPENVIDU_STREAMS_ALLOW_TRANSCODING=true
|
# All sessions of OpenVidu will try to force this codec. If OPENVIDU_STREAMS_ALLOW_TRANSCODING=true
|
||||||
# when a codec can not be forced, transcoding will be allowed
|
# when a codec can not be forced, transcoding will be allowed
|
||||||
# Values: VP8, VP9, H264, NONE
|
# Values: MEDIA_SERVER_PREFERRED, NONE, VP8, VP9, H264
|
||||||
# Default value is VP8
|
# Default value is MEDIA_SERVER_PREFERRED
|
||||||
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=VP8
|
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=MEDIA_SERVER_PREFERRED
|
||||||
|
|
||||||
# Allow transcoding if codec specified in OPENVIDU_STREAMS_FORCED_VIDEO_CODEC can not be applied
|
# Allow transcoding if codec specified in OPENVIDU_STREAMS_FORCED_VIDEO_CODEC can not be applied
|
||||||
# Values: true | false
|
# Values: true | false
|
||||||
|
|
|
@ -259,9 +259,9 @@ OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300
|
||||||
|
|
||||||
# All sessions of OpenVidu will try to force this codec. If OPENVIDU_STREAMS_ALLOW_TRANSCODING=true
|
# All sessions of OpenVidu will try to force this codec. If OPENVIDU_STREAMS_ALLOW_TRANSCODING=true
|
||||||
# when a codec can not be forced, transcoding will be allowed
|
# when a codec can not be forced, transcoding will be allowed
|
||||||
# Values: VP8, VP9, H264, NONE
|
# Values: MEDIA_SERVER_PREFERRED, NONE, VP8, VP9, H264
|
||||||
# Default value is VP8
|
# Default value is MEDIA_SERVER_PREFERRED
|
||||||
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=VP8
|
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=MEDIA_SERVER_PREFERRED
|
||||||
|
|
||||||
# Allow transcoding if codec specified in OPENVIDU_STREAMS_FORCED_VIDEO_CODEC can not be applied
|
# Allow transcoding if codec specified in OPENVIDU_STREAMS_FORCED_VIDEO_CODEC can not be applied
|
||||||
# Values: true | false
|
# Values: true | false
|
||||||
|
|
|
@ -246,9 +246,9 @@ OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300
|
||||||
|
|
||||||
# All sessions of OpenVidu will try to force this codec. If OPENVIDU_STREAMS_ALLOW_TRANSCODING=true
|
# All sessions of OpenVidu will try to force this codec. If OPENVIDU_STREAMS_ALLOW_TRANSCODING=true
|
||||||
# when a codec can not be forced, transcoding will be allowed
|
# when a codec can not be forced, transcoding will be allowed
|
||||||
# Values: VP8, VP9, H264, NONE
|
# Values: MEDIA_SERVER_PREFERRED, NONE, VP8, VP9, H264
|
||||||
# Default value is VP8
|
# Default value is MEDIA_SERVER_PREFERRED
|
||||||
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=VP8
|
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=MEDIA_SERVER_PREFERRED
|
||||||
|
|
||||||
# Allow transcoding if codec specified in OPENVIDU_STREAMS_FORCED_VIDEO_CODEC can not be applied
|
# Allow transcoding if codec specified in OPENVIDU_STREAMS_FORCED_VIDEO_CODEC can not be applied
|
||||||
# Values: true | false
|
# Values: true | false
|
||||||
|
|
|
@ -19,6 +19,7 @@ package io.openvidu.server.core;
|
||||||
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
@ -32,6 +33,7 @@ import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
import io.openvidu.client.OpenViduException;
|
import io.openvidu.client.OpenViduException;
|
||||||
|
@ -234,22 +236,21 @@ public class Session implements SessionInterface {
|
||||||
json.addProperty("object", "session");
|
json.addProperty("object", "session");
|
||||||
json.addProperty("sessionId", this.sessionId); // TODO: deprecated. Better use only "id"
|
json.addProperty("sessionId", this.sessionId); // TODO: deprecated. Better use only "id"
|
||||||
json.addProperty("createdAt", this.startTime);
|
json.addProperty("createdAt", this.startTime);
|
||||||
json.addProperty("mediaMode", this.sessionProperties.mediaMode().name());
|
json.addProperty("recording", this.recordingManager.sessionIsBeingRecorded(this.sessionId));
|
||||||
json.addProperty("recordingMode", this.sessionProperties.recordingMode().name());
|
|
||||||
json.add("defaultRecordingProperties", this.sessionProperties.defaultRecordingProperties().toJson());
|
// Add keys from SessionProperties
|
||||||
if (this.sessionProperties.customSessionId() != null) {
|
JsonObject sessionPropertiesJson = sessionProperties.toJson();
|
||||||
json.addProperty("customSessionId", this.sessionProperties.customSessionId());
|
for (Map.Entry<String, JsonElement> entry : sessionPropertiesJson.entrySet()) {
|
||||||
|
json.add(entry.getKey(), entry.getValue().deepCopy());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add "connections" object
|
||||||
JsonObject connections = new JsonObject();
|
JsonObject connections = new JsonObject();
|
||||||
JsonArray participants = this.getSnapshotOfConnectionsAsJsonArray(withPendingConnections, withWebrtcStats);
|
JsonArray participants = this.getSnapshotOfConnectionsAsJsonArray(withPendingConnections, withWebrtcStats);
|
||||||
connections.addProperty("numberOfElements", participants.size());
|
connections.addProperty("numberOfElements", participants.size());
|
||||||
connections.add("content", participants);
|
connections.add("content", participants);
|
||||||
json.add("connections", connections);
|
json.add("connections", connections);
|
||||||
json.addProperty("recording", this.recordingManager.sessionIsBeingRecorded(this.sessionId));
|
|
||||||
if (this.sessionProperties.forcedVideoCodec() != null) {
|
|
||||||
json.addProperty("forcedVideoCodec", this.sessionProperties.forcedVideoCodec().name());
|
|
||||||
}
|
|
||||||
json.addProperty("allowTranscoding", this.sessionProperties.isTranscodingAllowed());
|
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -380,7 +380,7 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
KurentoParticipant kParticipant = (KurentoParticipant) participant;
|
KurentoParticipant kParticipant = (KurentoParticipant) participant;
|
||||||
KurentoSession kSession = kParticipant.getSession();
|
KurentoSession kSession = kParticipant.getSession();
|
||||||
boolean isTranscodingAllowed = kSession.getSessionProperties().isTranscodingAllowed();
|
boolean isTranscodingAllowed = kSession.getSessionProperties().isTranscodingAllowed();
|
||||||
VideoCodec forcedVideoCodec = kSession.getSessionProperties().forcedVideoCodec();
|
VideoCodec forcedVideoCodec = kSession.getSessionProperties().forcedVideoCodecResolved();
|
||||||
|
|
||||||
final String streamId = kParticipant.generateStreamId(kurentoOptions);
|
final String streamId = kParticipant.generateStreamId(kurentoOptions);
|
||||||
|
|
||||||
|
@ -597,7 +597,7 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
WebrtcDebugEventType.sdpOffer, sdpOffer));
|
WebrtcDebugEventType.sdpOffer, sdpOffer));
|
||||||
|
|
||||||
boolean isTranscodingAllowed = session.getSessionProperties().isTranscodingAllowed();
|
boolean isTranscodingAllowed = session.getSessionProperties().isTranscodingAllowed();
|
||||||
VideoCodec forcedVideoCodec = session.getSessionProperties().forcedVideoCodec();
|
VideoCodec forcedVideoCodec = session.getSessionProperties().forcedVideoCodecResolved();
|
||||||
|
|
||||||
// Modify server's SDPOffer if forced codec is defined
|
// Modify server's SDPOffer if forced codec is defined
|
||||||
if (forcedVideoCodec != VideoCodec.NONE && !participant.isIpcam()) {
|
if (forcedVideoCodec != VideoCodec.NONE && !participant.isIpcam()) {
|
||||||
|
@ -663,7 +663,7 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
// Client initiated negotiation. sdpString is the SDP Offer of the client
|
// Client initiated negotiation. sdpString is the SDP Offer of the client
|
||||||
|
|
||||||
boolean isTranscodingAllowed = session.getSessionProperties().isTranscodingAllowed();
|
boolean isTranscodingAllowed = session.getSessionProperties().isTranscodingAllowed();
|
||||||
VideoCodec forcedVideoCodec = session.getSessionProperties().forcedVideoCodec();
|
VideoCodec forcedVideoCodec = session.getSessionProperties().forcedVideoCodecResolved();
|
||||||
String sdpOffer = sdpString;
|
String sdpOffer = sdpString;
|
||||||
|
|
||||||
// Modify sdp if forced codec is defined
|
// Modify sdp if forced codec is defined
|
||||||
|
@ -1220,7 +1220,7 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
|
|
||||||
private String mungeSdpOffer(Session kSession, Participant participant, String sdpOffer, boolean isPublisher) {
|
private String mungeSdpOffer(Session kSession, Participant participant, String sdpOffer, boolean isPublisher) {
|
||||||
boolean isTranscodingAllowed = kSession.getSessionProperties().isTranscodingAllowed();
|
boolean isTranscodingAllowed = kSession.getSessionProperties().isTranscodingAllowed();
|
||||||
VideoCodec forcedVideoCodec = kSession.getSessionProperties().forcedVideoCodec();
|
VideoCodec forcedVideoCodec = kSession.getSessionProperties().forcedVideoCodecResolved();
|
||||||
// Modify sdp if forced codec is defined
|
// Modify sdp if forced codec is defined
|
||||||
if (forcedVideoCodec != VideoCodec.NONE && !participant.isIpcam()) {
|
if (forcedVideoCodec != VideoCodec.NONE && !participant.isIpcam()) {
|
||||||
return sdpMunging.forceCodec(sdpOffer, participant, isPublisher, true, isTranscodingAllowed,
|
return sdpMunging.forceCodec(sdpOffer, participant, isPublisher, true, isTranscodingAllowed,
|
||||||
|
|
|
@ -726,20 +726,31 @@ public class SessionRestController {
|
||||||
|
|
||||||
if (params != null) {
|
if (params != null) {
|
||||||
|
|
||||||
|
// Obtain primitive values from the params map
|
||||||
String mediaModeString;
|
String mediaModeString;
|
||||||
String recordingModeString;
|
String recordingModeString;
|
||||||
String forcedVideoCodec;
|
String forcedVideoCodecStr;
|
||||||
Boolean allowTranscoding;
|
Boolean allowTranscoding;
|
||||||
try {
|
try {
|
||||||
mediaModeString = (String) params.get("mediaMode");
|
mediaModeString = (String) params.get("mediaMode");
|
||||||
recordingModeString = (String) params.get("recordingMode");
|
recordingModeString = (String) params.get("recordingMode");
|
||||||
customSessionId = (String) params.get("customSessionId");
|
customSessionId = (String) params.get("customSessionId");
|
||||||
forcedVideoCodec = (String) params.get("forcedVideoCodec");
|
forcedVideoCodecStr = (String) params.get("forcedVideoCodec");
|
||||||
allowTranscoding = (Boolean) params.get("allowTranscoding");
|
allowTranscoding = (Boolean) params.get("allowTranscoding");
|
||||||
} catch (ClassCastException e) {
|
} catch (ClassCastException e) {
|
||||||
throw new Exception("Type error in some parameter: " + e.getMessage());
|
throw new Exception("Type error in some parameter: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Parse obtained values into actual types
|
||||||
|
VideoCodec forcedVideoCodec = null;
|
||||||
|
try {
|
||||||
|
forcedVideoCodec = VideoCodec.valueOf(forcedVideoCodecStr);
|
||||||
|
} catch (NullPointerException e) {
|
||||||
|
// Not an error: "forcedVideoCodec" was not provided in params.
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
throw new Exception("Invalid value for parameter 'forcedVideoCodec': " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Safe parameter retrieval. Default values if not defined
|
// Safe parameter retrieval. Default values if not defined
|
||||||
if (recordingModeString != null) {
|
if (recordingModeString != null) {
|
||||||
|
@ -761,11 +772,25 @@ public class SessionRestController {
|
||||||
}
|
}
|
||||||
builder = builder.customSessionId(customSessionId);
|
builder = builder.customSessionId(customSessionId);
|
||||||
}
|
}
|
||||||
if (forcedVideoCodec != null) {
|
|
||||||
builder = builder.forcedVideoCodec(VideoCodec.valueOf(forcedVideoCodec));
|
if (forcedVideoCodec == null) {
|
||||||
} else {
|
forcedVideoCodec = openviduConfig.getOpenviduForcedCodec();
|
||||||
builder = builder.forcedVideoCodec(openviduConfig.getOpenviduForcedCodec());
|
|
||||||
}
|
}
|
||||||
|
builder = builder.forcedVideoCodec(forcedVideoCodec);
|
||||||
|
if (forcedVideoCodec == VideoCodec.MEDIA_SERVER_PREFERRED) {
|
||||||
|
switch (openviduConfig.getMediaServer()) {
|
||||||
|
case mediasoup:
|
||||||
|
builder = builder.forcedVideoCodecResolved(VideoCodec.NONE);
|
||||||
|
break;
|
||||||
|
case kurento:
|
||||||
|
default:
|
||||||
|
builder = builder.forcedVideoCodecResolved(VideoCodec.VP8);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
builder = builder.forcedVideoCodecResolved(forcedVideoCodec);
|
||||||
|
}
|
||||||
|
|
||||||
if (allowTranscoding != null) {
|
if (allowTranscoding != null) {
|
||||||
builder = builder.allowTranscoding(allowTranscoding);
|
builder = builder.allowTranscoding(allowTranscoding);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -187,7 +187,7 @@ public class SDPMunging {
|
||||||
return mungedSdpOffer;
|
return mungedSdpOffer;
|
||||||
} else {
|
} else {
|
||||||
throw new OpenViduException(Code.FORCED_CODEC_NOT_FOUND_IN_SDPOFFER,
|
throw new OpenViduException(Code.FORCED_CODEC_NOT_FOUND_IN_SDPOFFER,
|
||||||
"Codec not supported by Media Server");
|
"Codec not supported by Media Server: " + forcedVideoCodec);
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (OpenViduException e) {
|
} catch (OpenViduException e) {
|
||||||
|
|
|
@ -157,7 +157,7 @@
|
||||||
"name": "OPENVIDU_STREAMS_FORCED_VIDEO_CODEC",
|
"name": "OPENVIDU_STREAMS_FORCED_VIDEO_CODEC",
|
||||||
"type": "java.lang.String",
|
"type": "java.lang.String",
|
||||||
"description": "Defines which video codec is being forced to be used in the browser/client",
|
"description": "Defines which video codec is being forced to be used in the browser/client",
|
||||||
"defaultValue": "VP8"
|
"defaultValue": "MEDIA_SERVER_PREFERRED"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "OPENVIDU_STREAMS_ALLOW_TRANSCODING",
|
"name": "OPENVIDU_STREAMS_ALLOW_TRANSCODING",
|
||||||
|
|
|
@ -43,7 +43,7 @@ OPENVIDU_STREAMS_VIDEO_MIN_RECV_BANDWIDTH=300
|
||||||
OPENVIDU_STREAMS_VIDEO_MAX_SEND_BANDWIDTH=1000
|
OPENVIDU_STREAMS_VIDEO_MAX_SEND_BANDWIDTH=1000
|
||||||
OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300
|
OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300
|
||||||
OPENVIDU_STREAMS_VIDEO_SIMULCAST=true
|
OPENVIDU_STREAMS_VIDEO_SIMULCAST=true
|
||||||
OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=VP8
|
OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=MEDIA_SERVER_PREFERRED
|
||||||
OPENVIDU_STREAMS_ALLOW_TRANSCODING=false
|
OPENVIDU_STREAMS_ALLOW_TRANSCODING=false
|
||||||
|
|
||||||
OPENVIDU_SESSIONS_GARBAGE_INTERVAL=900
|
OPENVIDU_SESSIONS_GARBAGE_INTERVAL=900
|
||||||
|
|
|
@ -36,7 +36,7 @@ OPENVIDU_STREAMS_VIDEO_MAX_RECV_BANDWIDTH=1000
|
||||||
OPENVIDU_STREAMS_VIDEO_MIN_RECV_BANDWIDTH=300
|
OPENVIDU_STREAMS_VIDEO_MIN_RECV_BANDWIDTH=300
|
||||||
OPENVIDU_STREAMS_VIDEO_MAX_SEND_BANDWIDTH=1000
|
OPENVIDU_STREAMS_VIDEO_MAX_SEND_BANDWIDTH=1000
|
||||||
OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300
|
OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300
|
||||||
OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=VP8
|
OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=MEDIA_SERVER_PREFERRED
|
||||||
OPENVIDU_STREAMS_ALLOW_TRANSCODING=false
|
OPENVIDU_STREAMS_ALLOW_TRANSCODING=false
|
||||||
|
|
||||||
OPENVIDU_SESSIONS_GARBAGE_INTERVAL=900
|
OPENVIDU_SESSIONS_GARBAGE_INTERVAL=900
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class OpenViduTestE2e {
|
||||||
final protected static String MEDIASOUP_IMAGE = "openvidu/mediasoup-controller";
|
final protected static String MEDIASOUP_IMAGE = "openvidu/mediasoup-controller";
|
||||||
protected static String MEDIA_SERVER_IMAGE = KURENTO_IMAGE + ":6.16.0";
|
protected static String MEDIA_SERVER_IMAGE = KURENTO_IMAGE + ":6.16.0";
|
||||||
|
|
||||||
final protected String DEFAULT_JSON_SESSION = "{'id':'STR','object':'session','sessionId':'STR','createdAt':0,'mediaMode':'STR','recordingMode':'STR','defaultRecordingProperties':{'hasVideo':true,'frameRate':25,'hasAudio':true,'shmSize':536870912,'name':'','outputMode':'COMPOSED','resolution':'1280x720','recordingLayout':'BEST_FIT'},'customSessionId':'STR','connections':{'numberOfElements':0,'content':[]},'recording':false,'forcedVideoCodec':'STR','allowTranscoding':false}";
|
final protected String DEFAULT_JSON_SESSION = "{'id':'STR','object':'session','sessionId':'STR','createdAt':0,'mediaMode':'STR','recordingMode':'STR','defaultRecordingProperties':{'hasVideo':true,'frameRate':25,'hasAudio':true,'shmSize':536870912,'name':'','outputMode':'COMPOSED','resolution':'1280x720','recordingLayout':'BEST_FIT'},'customSessionId':'STR','connections':{'numberOfElements':0,'content':[]},'recording':false,'forcedVideoCodec':'STR','forcedVideoCodecResolved':'STR','allowTranscoding':false}";
|
||||||
final protected String DEFAULT_JSON_PENDING_CONNECTION = "{'id':'STR','object':'connection','type':'WEBRTC','status':'pending','connectionId':'STR','sessionId':'STR','createdAt':0,'activeAt':null,'location':null,'ip':null,'platform':null,'token':'STR','serverData':'STR','record':true,'role':'STR','kurentoOptions':null,'rtspUri':null,'adaptativeBitrate':null,'onlyPlayWithSubscribers':null,'networkCache':null,'clientData':null,'publishers':null,'subscribers':null}";
|
final protected String DEFAULT_JSON_PENDING_CONNECTION = "{'id':'STR','object':'connection','type':'WEBRTC','status':'pending','connectionId':'STR','sessionId':'STR','createdAt':0,'activeAt':null,'location':null,'ip':null,'platform':null,'token':'STR','serverData':'STR','record':true,'role':'STR','kurentoOptions':null,'rtspUri':null,'adaptativeBitrate':null,'onlyPlayWithSubscribers':null,'networkCache':null,'clientData':null,'publishers':null,'subscribers':null}";
|
||||||
final protected String DEFAULT_JSON_ACTIVE_CONNECTION = "{'id':'STR','object':'connection','type':'WEBRTC','status':'active','connectionId':'STR','sessionId':'STR','createdAt':0,'activeAt':0,'location':'STR','ip':'STR','platform':'STR','token':'STR','serverData':'STR','record':true,'role':'STR','kurentoOptions':null,'rtspUri':null,'adaptativeBitrate':null,'onlyPlayWithSubscribers':null,'networkCache':null,'clientData':'STR','publishers':[],'subscribers':[]}";
|
final protected String DEFAULT_JSON_ACTIVE_CONNECTION = "{'id':'STR','object':'connection','type':'WEBRTC','status':'active','connectionId':'STR','sessionId':'STR','createdAt':0,'activeAt':0,'location':'STR','ip':'STR','platform':'STR','token':'STR','serverData':'STR','record':true,'role':'STR','kurentoOptions':null,'rtspUri':null,'adaptativeBitrate':null,'onlyPlayWithSubscribers':null,'networkCache':null,'clientData':'STR','publishers':[],'subscribers':[]}";
|
||||||
final protected String DEFAULT_JSON_IPCAM_CONNECTION = "{'id':'STR','object':'connection','type':'IPCAM','status':'active','connectionId':'STR','sessionId':'STR','createdAt':0,'activeAt':0,'location':'STR','ip':'STR','platform':'IPCAM','token':null,'serverData':'STR','record':true,'role':null,'kurentoOptions':null,'rtspUri':'STR','adaptativeBitrate':true,'onlyPlayWithSubscribers':true,'networkCache':2000,'clientData':null,'publishers':[],'subscribers':[]}";
|
final protected String DEFAULT_JSON_IPCAM_CONNECTION = "{'id':'STR','object':'connection','type':'IPCAM','status':'active','connectionId':'STR','sessionId':'STR','createdAt':0,'activeAt':0,'location':'STR','ip':'STR','platform':'IPCAM','token':null,'serverData':'STR','record':true,'role':null,'kurentoOptions':null,'rtspUri':'STR','adaptativeBitrate':true,'onlyPlayWithSubscribers':true,'networkCache':2000,'clientData':null,'publishers':[],'subscribers':[]}";
|
||||||
|
|
|
@ -3213,7 +3213,7 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
+ "'videoDimensions':'STR','filter':{}}}],'subscribers':[{'createdAt':0,'streamId':'STR','publisher':'STR'}]},{'connectionId':'STR','createdAt':0,'location':'STR','ip':'STR',"
|
+ "'videoDimensions':'STR','filter':{}}}],'subscribers':[{'createdAt':0,'streamId':'STR','publisher':'STR'}]},{'connectionId':'STR','createdAt':0,'location':'STR','ip':'STR',"
|
||||||
+ "'platform':'STR','token':'STR','role':'STR','serverData':'STR','clientData':'STR','publishers':[{'createdAt':0,'streamId':'STR','mediaOptions':{'hasAudio':false,"
|
+ "'platform':'STR','token':'STR','role':'STR','serverData':'STR','clientData':'STR','publishers':[{'createdAt':0,'streamId':'STR','mediaOptions':{'hasAudio':false,"
|
||||||
+ "'audioActive':false,'hasVideo':false,'videoActive':false,'typeOfVideo':'STR','frameRate':0,'videoDimensions':'STR','filter':{}}}],'subscribers':[{'createdAt':0,'streamId':'STR','publisher':'STR'}]}]},"
|
+ "'audioActive':false,'hasVideo':false,'videoActive':false,'typeOfVideo':'STR','frameRate':0,'videoDimensions':'STR','filter':{}}}],'subscribers':[{'createdAt':0,'streamId':'STR','publisher':'STR'}]}]},"
|
||||||
+ "'recording':false,'forcedVideoCodec':'STR','allowTranscoding':false}");
|
+ "'recording':false,'forcedVideoCodec':'STR','forcedVideoCodecResolved':'STR','allowTranscoding':false}");
|
||||||
String streamId = res.get("connections").getAsJsonObject().get("content").getAsJsonArray().get(0)
|
String streamId = res.get("connections").getAsJsonObject().get("content").getAsJsonArray().get(0)
|
||||||
.getAsJsonObject().get("publishers").getAsJsonArray().get(0).getAsJsonObject().get("streamId")
|
.getAsJsonObject().get("publishers").getAsJsonArray().get(0).getAsJsonObject().get("streamId")
|
||||||
.getAsString();
|
.getAsString();
|
||||||
|
@ -4673,6 +4673,20 @@ public class OpenViduTestAppE2eTest extends AbstractOpenViduTestappE2eTest {
|
||||||
|
|
||||||
// Check browser codecs
|
// Check browser codecs
|
||||||
VideoCodec codecToCheck = (codec != null) ? codec : defaultForcedVideoCodec;
|
VideoCodec codecToCheck = (codec != null) ? codec : defaultForcedVideoCodec;
|
||||||
|
|
||||||
|
// Validate the codec to check for special cases:
|
||||||
|
// * MEDIA_SERVER_PREFERRED means to use the codec that is preferred by the media server.
|
||||||
|
// * NONE means to use the codec that is preferred by the web browser.
|
||||||
|
// Because this test is always run only for Kurento and Chrome, we know what to select here.
|
||||||
|
if (codecToCheck == VideoCodec.MEDIA_SERVER_PREFERRED) {
|
||||||
|
// Kurento preferred video codec is VP8.
|
||||||
|
codecToCheck = VideoCodec.VP8;
|
||||||
|
}
|
||||||
|
else if (codecToCheck == VideoCodec.NONE) {
|
||||||
|
// Chrome preferred video codec is VP8.
|
||||||
|
codecToCheck = VideoCodec.VP8;
|
||||||
|
}
|
||||||
|
|
||||||
List<WebElement> statsButtons = user.getDriver().findElements(By.className("stats-button"));
|
List<WebElement> statsButtons = user.getDriver().findElements(By.className("stats-button"));
|
||||||
for (WebElement statButton : statsButtons) {
|
for (WebElement statButton : statsButtons) {
|
||||||
statButton.click();
|
statButton.click();
|
||||||
|
|
Loading…
Reference in New Issue