mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: add MEDIA_SERVER_PREFERRED as default for ForcedVideoCodec
MEDIA_SERVER_PREFERRED: A recommended choice is done for you, based on the media server that is currently in use. This is the default setting, and is equivalent to these values: - For *mediasoup*, `NONE` is selected. - For *Kurento*, `VP8` is selected.pull/667/head
parent
3c97ceac37
commit
32fd093cf3
|
@ -42,7 +42,7 @@ 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 Boolean allowTranscoding = false;
|
private Boolean allowTranscoding = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,15 +114,20 @@ 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#VP8} for Kurento, and
|
||||||
|
* {@link VideoCodec#NONE} for mediasoup.
|
||||||
*/
|
*/
|
||||||
public SessionProperties.Builder forcedVideoCodec(VideoCodec forcedVideoCodec) {
|
public SessionProperties.Builder forcedVideoCodec(VideoCodec forcedVideoCodec) {
|
||||||
this.forcedVideoCodec = forcedVideoCodec;
|
this.forcedVideoCodec = forcedVideoCodec;
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
|
@ -67,13 +67,19 @@ 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.VP8]] for Kurento, and
|
||||||
|
* [[VideoCodec.NONE]] for mediasoup.
|
||||||
*/
|
*/
|
||||||
forcedVideoCodec?: VideoCodec;
|
forcedVideoCodec?: VideoCodec;
|
||||||
|
|
||||||
|
@ -85,5 +91,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
|
||||||
|
|
|
@ -392,6 +392,22 @@ public class KurentoSessionManager extends SessionManager {
|
||||||
log.warn("AllowTranscoding has no effect if the Media Server is not Kurento");
|
log.warn("AllowTranscoding has no effect if the Media Server is not Kurento");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set appropriate value for the ForcedVideoCodec feature.
|
||||||
|
if (forcedVideoCodec == VideoCodec.MEDIA_SERVER_PREFERRED) {
|
||||||
|
final MediaServer mediaServer = openviduConfig.getMediaServer();
|
||||||
|
switch (mediaServer) {
|
||||||
|
case mediasoup:
|
||||||
|
forcedVideoCodec = VideoCodec.NONE;
|
||||||
|
break;
|
||||||
|
case kurento:
|
||||||
|
default:
|
||||||
|
forcedVideoCodec = VideoCodec.VP8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
log.info("Media Server: {}, selected ForcedVideoCodec value: {}", mediaServer, forcedVideoCodec);
|
||||||
|
}
|
||||||
|
|
||||||
// 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()) {
|
||||||
kurentoOptions.sdpOffer = sdpMunging.forceCodec(kurentoOptions.sdpOffer, participant, true, false,
|
kurentoOptions.sdpOffer = sdpMunging.forceCodec(kurentoOptions.sdpOffer, participant, true, false,
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue