aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpaweldomas <pawel.domas@jitsi.org>2015-07-14 15:37:06 +0200
committerpaweldomas <pawel.domas@jitsi.org>2015-07-14 15:37:06 +0200
commit1fdab4331d907debb3aa45b48299cb00560ce91c (patch)
tree14c6f0c8b85672e5a90297ad94ced1ea013b2082
parentf631cefd26b958e0037ece2e60bcf830bfe80693 (diff)
downloadjitsi-1fdab4331d907debb3aa45b48299cb00560ce91c.zip
jitsi-1fdab4331d907debb3aa45b48299cb00560ce91c.tar.gz
jitsi-1fdab4331d907debb3aa45b48299cb00560ce91c.tar.bz2
Adds SSRCInfoPacketExtension used to signal SSRC owner in jitsi-meet.
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/SourcePacketExtension.java23
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/JingleIQProvider.java7
-rw-r--r--src/net/java/sip/communicator/impl/protocol/jabber/extensions/jitsimeet/SSRCInfoPacketExtension.java106
3 files changed, 130 insertions, 6 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/SourcePacketExtension.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/SourcePacketExtension.java
index 87bd597..1cb655d 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/SourcePacketExtension.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/colibri/SourcePacketExtension.java
@@ -10,6 +10,9 @@ import java.util.*;
import net.java.sip.communicator.impl.protocol.jabber.extensions.*;
import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.*;
+import net.java.sip.communicator.util.*;
+
+import org.jivesoftware.smack.packet.*;
/**
* Implements <tt>AbstractPacketExtension</tt> for the <tt>source</tt> element
@@ -22,6 +25,9 @@ import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.*;
public class SourcePacketExtension
extends AbstractPacketExtension
{
+ private final static Logger logger
+ = Logger.getLogger(SourcePacketExtension.class);
+
/**
* The XML name of the <tt>setup</tt> element defined by Source-Specific
* Media Attributes in Jingle.
@@ -118,13 +124,18 @@ public class SourcePacketExtension
= AbstractPacketExtension.clone(this);
// COPY SSRC PARAMS
- for (ParameterPacketExtension ppe : getParameters())
+ for (PacketExtension ppe : getChildExtensions())
{
- ParameterPacketExtension ppeCopy
- = new ParameterPacketExtension(
- ppe.getName(), ppe.getValue());
-
- copy.addParameter(ppeCopy);
+ if (ppe instanceof AbstractPacketExtension)
+ {
+ copy.addChildExtension(
+ AbstractPacketExtension.clone(
+ (AbstractPacketExtension) ppe));
+ }
+ else
+ {
+ logger.error("Failed to clone " + ppe);
+ }
}
return copy;
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/JingleIQProvider.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/JingleIQProvider.java
index b362fd1..3e570fb 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/JingleIQProvider.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/JingleIQProvider.java
@@ -191,6 +191,13 @@ public class JingleIQProvider implements IQProvider
IceUdpTransportPacketExtension.NAMESPACE,
new DefaultPacketExtensionProvider<RtcpmuxPacketExtension>(
RtcpmuxPacketExtension.class));
+
+ //ssrcInfo
+ providerManager.addExtensionProvider(
+ SSRCInfoPacketExtension.ELEMENT_NAME,
+ SSRCInfoPacketExtension.NAMESPACE,
+ new DefaultPacketExtensionProvider<SSRCInfoPacketExtension>(
+ SSRCInfoPacketExtension.class));
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/jitsimeet/SSRCInfoPacketExtension.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/jitsimeet/SSRCInfoPacketExtension.java
new file mode 100644
index 0000000..239c708
--- /dev/null
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/jitsimeet/SSRCInfoPacketExtension.java
@@ -0,0 +1,106 @@
+/*
+ * Jitsi, the OpenSource Java VoIP and Instant Messaging client.
+ *
+ * Distributable under LGPL license.
+ * See terms of license at gnu.org.
+ */
+package net.java.sip.communicator.impl.protocol.jabber.extensions.jitsimeet;
+
+import net.java.sip.communicator.impl.protocol.jabber.extensions.*;
+import net.java.sip.communicator.impl.protocol.jabber.extensions.colibri.*;
+
+import java.lang.*;
+
+/**
+ * Packet extension is used to signal owner of media SSRC in jitsi-meet. Owner
+ * attribute stores MUC JID of the user to whom it belongs. This extension is
+ * inserted as a child of {@link SourcePacketExtension} in 'session-initiate',
+ * 'source-add' and 'source-remove' Jingle IQs sent by the focus(Jicofo).
+ *
+ * @author Pawel Domas
+ */
+public class SSRCInfoPacketExtension
+ extends AbstractPacketExtension
+{
+ /**
+ * XML namespace of this packets extension.
+ */
+ public static final java.lang.String NAMESPACE = "http://jitsi.org/jitmeet";
+
+ /**
+ * XML element name of this packets extension.
+ */
+ public static final String ELEMENT_NAME = "ssrc-info";
+
+ /**
+ * Attribute stores owner JID of parent {@link SourcePacketExtension}.
+ */
+ public static final String OWNER_ATTR_NAME = "owner";
+
+ /**
+ * Attribute stores the type of video SSRC. Can be
+ * {@link #CAMERA_VIDEO_TYPE} or {@link #SCREEN_VIDEO_TYPE}.
+ */
+ public static final String VIDEO_TYPE_ATTR_NAME = "video-type";
+
+ /**
+ * Camera video type constant. Inidcates that the user is sending his camera
+ * video.
+ */
+ public static final String CAMERA_VIDEO_TYPE = "camera";
+
+ /**
+ * Screen video type constant. Indicates that the user is sharing his
+ * screen.
+ */
+ public static final String SCREEN_VIDEO_TYPE = "screen";
+
+ /**
+ * Creates new instance of <tt>SSRCInfoPacketExtension</tt>.
+ */
+ public SSRCInfoPacketExtension()
+ {
+ super(NAMESPACE, ELEMENT_NAME);
+ }
+
+ /**
+ * Returns the value of {@link #OWNER_ATTR_NAME}.
+ *
+ * @return MUC JID of SSRC owner stored by this instance or <tt>null</tt>
+ * if empty.
+ */
+ public String getOwner()
+ {
+ return getAttributeAsString(OWNER_ATTR_NAME);
+ }
+
+ /**
+ * Sets the value of {@link #OWNER_ATTR_NAME}.
+ *
+ * @param owner MUC JID of SSRC owner to be stored in this packet extension.
+ */
+ public void setOwner(String owner)
+ {
+ setAttribute(OWNER_ATTR_NAME, owner);
+ }
+
+ /**
+ * Returns the value of {@link #VIDEO_TYPE_ATTR_NAME}.
+ * @return {@link #CAMERA_VIDEO_TYPE}, {@link #SCREEN_VIDEO_TYPE} or
+ * <tt>null</tt> if not specified or if media SSRC is not a video.
+ */
+ public String getVideoType()
+ {
+ return getAttributeAsString(VIDEO_TYPE_ATTR_NAME);
+ }
+
+ /**
+ * Sets the type of video SSRC.
+ * @param videoType {@link #CAMERA_VIDEO_TYPE}, {@link #SCREEN_VIDEO_TYPE}
+ * or <tt>null</tt> if not specified or if media SSRC is not a video.
+ */
+ public void setVideoType(String videoType)
+ {
+ setAttribute(VIDEO_TYPE_ATTR_NAME, videoType);
+ }
+}