diff options
author | George Politis <gp@jitsi.org> | 2015-06-03 17:54:29 +0200 |
---|---|---|
committer | George Politis <gp@jitsi.org> | 2015-06-03 17:54:29 +0200 |
commit | 417c5007be7d779d06a314d77587a02a340b3f7d (patch) | |
tree | f0cfd52dc057d3d24399dcb6ef9e410b51215d58 /src/net/java/sip/communicator/impl | |
parent | 87abb017f56b525b31e69dc3f81cbd264ad2f9df (diff) | |
download | jitsi-417c5007be7d779d06a314d77587a02a340b3f7d.zip jitsi-417c5007be7d779d06a314d77587a02a340b3f7d.tar.gz jitsi-417c5007be7d779d06a314d77587a02a340b3f7d.tar.bz2 |
Extends the COLIBRI channel IQ with a simulcast-mode attribute.
Diffstat (limited to 'src/net/java/sip/communicator/impl')
4 files changed, 101 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriBuilder.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriBuilder.java index b578137..ec17456 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriBuilder.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriBuilder.java @@ -101,6 +101,13 @@ public class ColibriBuilder private Boolean adaptiveSimulcast; /** + * Channel 'simulcast-mode' option that will be added when channels are + * created. + * Set to <tt>null</tt> in order to omit. + */ + private SimulcastMode simulcastMode; + + /** * Creates new instance of {@link ColibriBuilder} for given * <tt>conferenceState</tt>. * @@ -193,6 +200,7 @@ public class ColibriBuilder remoteRtpChannelRequest.setLastN(channelLastN); remoteRtpChannelRequest.setAdaptiveLastN(adaptiveLastN); remoteRtpChannelRequest.setAdaptiveSimulcast(adaptiveSimulcast); + remoteRtpChannelRequest.setSimulcastMode(simulcastMode); } // Copy transport @@ -700,6 +708,18 @@ public class ColibriBuilder } /** + * Sets channel 'simulcast-mode' option that will be added to the + * request when channels are created. + * @param simulcastMode a <tt>SimulcastMode</tt> value to specify + * 'simulcast-mode' option or <tt>null</tt> in order to omit in + * requests. + */ + public void setSimulcastMode(SimulcastMode simulcastMode) + { + this.simulcastMode = simulcastMode; + } + + /** * Adds next payload type information update request to * {@link RequestType#RTP_DESCRIPTION_UPDATE} query currently being built. * diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriConferenceIQ.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriConferenceIQ.java index 18699d9..ca6e769 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriConferenceIQ.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriConferenceIQ.java @@ -480,6 +480,13 @@ public class ColibriConferenceIQ = "adaptive-simulcast"; /** + * The XML name of the <tt>simulcast-mode</tt> attribute of a video + * <tt>channel</tt>. + */ + public static final String SIMULCAST_MODE_ATTR_NAME + = "simulcast-mode"; + + /** * The XML name of the <tt>receive-simulcast-layer</tt> attribute of a * video <tt>Channel</tt> which specifies the target quality of the * simulcast substreams to be sent from Jitsi Videobridge to the @@ -556,6 +563,11 @@ public class ColibriConferenceIQ private Boolean adaptiveSimulcast; /** + * The 'simulcast-mode' flag. + */ + private SimulcastMode simulcastMode; + + /** * The <tt>payload-type</tt> elements defined by XEP-0167: Jingle RTP * Sessions associated with this <tt>channel</tt>. */ @@ -827,6 +839,15 @@ public class ColibriConferenceIQ } /** + * Gets the value of the 'simulcast-mode' flag. + * @return the value of the 'simulcast-mode' flag. + */ + public SimulcastMode getSimulcastMode() + { + return simulcastMode; + } + + /** * Gets a list of <tt>payload-type</tt> elements defined by XEP-0167: * Jingle RTP Sessions added to this <tt>channel</tt>. * @@ -1003,6 +1024,15 @@ public class ColibriConferenceIQ .append(lastN).append('\''); } + // simulcastMode + SimulcastMode simulcastMode = getSimulcastMode(); + + if (simulcastMode != null) + { + xml.append(' ').append(SIMULCAST_MODE_ATTR_NAME).append("=") + .append(simulcastMode).append('\''); + } + // rtcpPort int rtcpPort = getRTCPPort(); @@ -1227,6 +1257,15 @@ public class ColibriConferenceIQ } /** + * Sets the value of the 'simulcast-mode' flag. + * @param simulcastMode the value to set. + */ + public void setSimulcastMode(SimulcastMode simulcastMode) + { + this.simulcastMode = simulcastMode; + } + + /** * Sets the target quality of the simulcast substreams to be sent from * Jitsi Videobridge to the endpoint associated with this video * <tt>Channel</tt>. diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java index 6756de9..e336b9b 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/ColibriIQProvider.java @@ -447,6 +447,17 @@ public class ColibriIQProvider channel.setAdaptiveLastN( Boolean.parseBoolean(adaptiveLastN)); + // simulcastMode + String simulcastMode + = parser.getAttributeValue( + "", + ColibriConferenceIQ.Channel + .SIMULCAST_MODE_ATTR_NAME); + + if (!StringUtils.isNullOrEmpty(simulcastMode)) + channel.setSimulcastMode( + SimulcastMode.fromString(simulcastMode)); + // receiving simulcast layer String receivingSimulcastLayer = parser.getAttributeValue( diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/SimulcastMode.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/SimulcastMode.java new file mode 100644 index 0000000..9ae55ca --- /dev/null +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/SimulcastMode.java @@ -0,0 +1,31 @@ +package net.java.sip.communicator.impl.protocol.jabber.extensions.colibri; + +/** + * Created by gp on 6/3/15. + */ +public enum SimulcastMode +{ + REWRITING("REWRITING"), + SWITCHING("SWITCHING"); + + private String text; + + SimulcastMode(String text) { + this.text = text; + } + + public String getText() { + return this.text; + } + + public static SimulcastMode fromString(String text) { + if (text != null) { + for (SimulcastMode b : SimulcastMode.values()) { + if (text.equalsIgnoreCase(b.text)) { + return b; + } + } + } + return null; + } +} |