Adds SSRCInfoPacketExtension used to signal SSRC owner in jitsi-meet.

maven 5456
paweldomas 11 years ago
parent f631cefd26
commit 1fdab4331d

@ -10,6 +10,9 @@
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 @@
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 SourcePacketExtension copy()
= 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;

@ -191,6 +191,13 @@ public JingleIQProvider()
IceUdpTransportPacketExtension.NAMESPACE,
new DefaultPacketExtensionProvider<RtcpmuxPacketExtension>(
RtcpmuxPacketExtension.class));
//ssrcInfo
providerManager.addExtensionProvider(
SSRCInfoPacketExtension.ELEMENT_NAME,
SSRCInfoPacketExtension.NAMESPACE,
new DefaultPacketExtensionProvider<SSRCInfoPacketExtension>(
SSRCInfoPacketExtension.class));
}
/**

@ -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);
}
}
Loading…
Cancel
Save