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 String customSessionId = "";
|
||||
private String mediaNode;
|
||||
private VideoCodec forcedVideoCodec = VideoCodec.VP8;
|
||||
private VideoCodec forcedVideoCodec = VideoCodec.MEDIA_SERVER_PREFERRED;
|
||||
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
|
||||
* for this session. This allows browsers/clients to use the same codec avoiding
|
||||
* transcoding in the media server. If the browser/client is not compatible with
|
||||
* the specified codec and {@link #allowTranscoding(Boolean)} is
|
||||
* <code>false</code> and exception will occur. If forcedVideoCodec is set to
|
||||
* NONE, no codec will be forced.<br>
|
||||
* Define which video codec will be forcibly used for this session.
|
||||
* This forces all browsers/clients to use the same codec, which would
|
||||
* avoid transcoding in the media server (Kurento only). If
|
||||
* <code>forcedVideoCodec</code> is set to NONE, no codec will be forced.
|
||||
*
|
||||
* 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
|
||||
* OPENVIDU_STREAMS_FORCED_VIDEO_CODEC. OPENVIDU_STREAMS_FORCED_VIDEO_CODEC
|
||||
* default is {@link VideoCodec#VP8}
|
||||
* OPENVIDU_STREAMS_FORCED_VIDEO_CODEC.
|
||||
*
|
||||
* Default is {@link VideoCodec#VP8} for Kurento, and
|
||||
* {@link VideoCodec#NONE} for mediasoup.
|
||||
*/
|
||||
public SessionProperties.Builder forcedVideoCodec(VideoCodec forcedVideoCodec) {
|
||||
this.forcedVideoCodec = forcedVideoCodec;
|
||||
|
|
|
@ -22,5 +22,5 @@ package io.openvidu.java.client;
|
|||
* {@link io.openvidu.java.client.SessionProperties.Builder#forcedVideoCodec(VideoCodec)}
|
||||
*/
|
||||
public enum VideoCodec {
|
||||
VP8, VP9, H264, NONE
|
||||
}
|
||||
MEDIA_SERVER_PREFERRED, NONE, VP8, VP9, H264
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ export interface SessionProperties {
|
|||
customSessionId?: string;
|
||||
|
||||
/**
|
||||
* **This feature is part of OpenVidu Pro tier** <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" style="display: inline-block; background-color: rgb(0, 136, 170); color: white; font-weight: bold; padding: 0px 5px; margin-right: 5px; border-radius: 3px; font-size: 13px; line-height:21px; font-family: Montserrat, sans-serif">PRO</a>
|
||||
* **This feature is part of OpenVidu Pro tier** <a href="https://docs.openvidu.io/en/stable/openvidu-pro/" target="_blank" style="display: inline-block; background-color: rgb(0, 136, 170); color: white; font-weight: bold; padding: 0px 5px; margin-right: 5px; border-radius: 3px; font-size: 13px; line-height:21px; font-family: Montserrat, sans-serif">PRO</a>
|
||||
*
|
||||
* The Media Node where to host the session. The default option if this property is not defined is the less loaded
|
||||
* Media Node at the moment the first user joins the session. This object defines the following properties as Media Node selector:
|
||||
|
@ -67,13 +67,19 @@ export interface SessionProperties {
|
|||
}
|
||||
|
||||
/**
|
||||
* It defines which video codec do you want to be forcibly used for this session.
|
||||
* This allows browsers/clients to use the same codec avoiding transcoding in the media server.
|
||||
* If the browser/client is not compatible with the specified codec and [[allowTranscoding]] is <code>false</code>
|
||||
* and exception will occur. If forcedVideoCodec is set to [[VideoCodec.NONE]], no codec will be forced.
|
||||
* Define which video codec will be forcibly used for this session.
|
||||
* This forces all browsers/clients to use the same codec, which would
|
||||
* avoid transcoding in the media server (Kurento only). If
|
||||
* <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.
|
||||
* OPENVIDU_STREAMS_FORCED_VIDEO_CODEC default is [[VideoCodec.VP8]]
|
||||
* If the browser/client is not compatible with the specified codec, and
|
||||
* [[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;
|
||||
|
||||
|
@ -85,5 +91,4 @@ export interface SessionProperties {
|
|||
* OPENVIDU_STREAMS_ALLOW_TRANSCODING default is 'false'
|
||||
*/
|
||||
allowTranscoding?: boolean;
|
||||
|
||||
}
|
||||
|
|
|
@ -2,10 +2,9 @@
|
|||
* See [[SessionProperties.forcedVideoCodec]]
|
||||
*/
|
||||
export enum VideoCodec {
|
||||
|
||||
MEDIA_SERVER_PREFERRED = 'MEDIA_SERVER_PREFERRED',
|
||||
NONE = 'NONE',
|
||||
VP8 = 'VP8',
|
||||
VP9 = 'VP9',
|
||||
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
|
||||
# when a codec can not be forced, transcoding will be allowed
|
||||
# Values: VP8, VP9, H264, NONE
|
||||
# Default value is VP8
|
||||
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=VP8
|
||||
# Values: MEDIA_SERVER_PREFERRED, NONE, VP8, VP9, H264
|
||||
# Default value is MEDIA_SERVER_PREFERRED
|
||||
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=MEDIA_SERVER_PREFERRED
|
||||
|
||||
# Allow transcoding if codec specified in OPENVIDU_STREAMS_FORCED_VIDEO_CODEC can not be applied
|
||||
# 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
|
||||
# when a codec can not be forced, transcoding will be allowed
|
||||
# Values: VP8, VP9, H264, NONE
|
||||
# Default value is VP8
|
||||
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=VP8
|
||||
# Values: MEDIA_SERVER_PREFERRED, NONE, VP8, VP9, H264
|
||||
# Default value is MEDIA_SERVER_PREFERRED
|
||||
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=MEDIA_SERVER_PREFERRED
|
||||
|
||||
# Allow transcoding if codec specified in OPENVIDU_STREAMS_FORCED_VIDEO_CODEC can not be applied
|
||||
# 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
|
||||
# when a codec can not be forced, transcoding will be allowed
|
||||
# Values: VP8, VP9, H264, NONE
|
||||
# Default value is VP8
|
||||
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=VP8
|
||||
# Values: MEDIA_SERVER_PREFERRED, NONE, VP8, VP9, H264
|
||||
# Default value is MEDIA_SERVER_PREFERRED
|
||||
# OPENVIDU_STREAMS_FORCED_VIDEO_CODEC=MEDIA_SERVER_PREFERRED
|
||||
|
||||
# Allow transcoding if codec specified in OPENVIDU_STREAMS_FORCED_VIDEO_CODEC can not be applied
|
||||
# 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");
|
||||
}
|
||||
|
||||
// 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
|
||||
if (forcedVideoCodec != VideoCodec.NONE && !participant.isIpcam()) {
|
||||
kurentoOptions.sdpOffer = sdpMunging.forceCodec(kurentoOptions.sdpOffer, participant, true, false,
|
||||
|
|
|
@ -157,7 +157,7 @@
|
|||
"name": "OPENVIDU_STREAMS_FORCED_VIDEO_CODEC",
|
||||
"type": "java.lang.String",
|
||||
"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",
|
||||
|
|
|
@ -43,7 +43,7 @@ OPENVIDU_STREAMS_VIDEO_MIN_RECV_BANDWIDTH=300
|
|||
OPENVIDU_STREAMS_VIDEO_MAX_SEND_BANDWIDTH=1000
|
||||
OPENVIDU_STREAMS_VIDEO_MIN_SEND_BANDWIDTH=300
|
||||
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_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_MAX_SEND_BANDWIDTH=1000
|
||||
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_SESSIONS_GARBAGE_INTERVAL=900
|
||||
|
|
Loading…
Reference in New Issue