diff options
author | Boris Grozev <boris@jitsi.org> | 2014-04-11 18:44:00 +0200 |
---|---|---|
committer | Boris Grozev <boris@jitsi.org> | 2014-04-15 14:59:58 +0200 |
commit | 1e2331c5ada065b229aef9b41aec89bd14fbb1f7 (patch) | |
tree | 900ec4451d1970ae1034e14a912f51458d05e35b /src/net/java | |
parent | 56a092de3cbbd107bc6e4291fc7eb47658c524dc (diff) | |
download | jitsi-1e2331c5ada065b229aef9b41aec89bd14fbb1f7.zip jitsi-1e2331c5ada065b229aef9b41aec89bd14fbb1f7.tar.gz jitsi-1e2331c5ada065b229aef9b41aec89bd14fbb1f7.tar.bz2 |
Describes the local source in a 'source' child element
of the 'description' elements when sending a jingle
session-accept.
Diffstat (limited to 'src/net/java')
4 files changed, 113 insertions, 9 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java index 0bbc9f8..92e7baa 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java @@ -20,6 +20,7 @@ import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.media.*;
import net.java.sip.communicator.util.*;
+import org.jitsi.service.libjitsi.*;
import org.jitsi.service.neomedia.*;
import org.jitsi.service.neomedia.device.*;
import org.jitsi.service.neomedia.format.*;
@@ -669,20 +670,57 @@ public class CallPeerMediaHandlerJabberImpl }
// create the corresponding stream...
- initStream(
- contentName,
- connector,
- dev,
- format,
- target,
- direction,
- rtpExtensions,
- masterStream);
+ MediaStream stream = initStream(contentName,
+ connector,
+ dev,
+ format,
+ target,
+ direction,
+ rtpExtensions,
+ masterStream);
+
+ long ourSsrc = stream.getLocalSourceID() & 0xffffffffL;
+ if (direction.allowsSending() && ourSsrc != -1)
+ {
+ description.setSsrc(Long.toString(ourSsrc));
+ addSourceExtension(description, ourSsrc);
+ }
}
return sessAccept;
}
/**
+ * Adds a <tt>SourcePacketExtension</tt> as a child element of
+ * <tt>description</tt>. See XEP-0339.
+ *
+ * @param description the <tt>RtpDescriptionPacketExtension</tt> to which
+ * a child element will be added.
+ * @param ssrc the SSRC for the <tt>SourcePacketExtension</tt> to use.
+ */
+ private void addSourceExtension(RtpDescriptionPacketExtension description,
+ long ssrc)
+ {
+ MediaType type = MediaType.parseString(description.getMedia());
+
+ SourcePacketExtension sourcePacketExtension
+ = new SourcePacketExtension();
+
+ sourcePacketExtension.setSSRC(ssrc);
+ sourcePacketExtension.addChildExtension(
+ new ParameterPacketExtension("cname",
+ LibJitsi.getMediaService()
+ .getRtpCname()));
+ sourcePacketExtension.addChildExtension(
+ new ParameterPacketExtension("msid", getMsid(type)));
+ sourcePacketExtension.addChildExtension(
+ new ParameterPacketExtension("mslabel", getMsLabel()));
+ sourcePacketExtension.addChildExtension(
+ new ParameterPacketExtension("label", getLabel(type)));
+
+ description.addChildExtension(sourcePacketExtension);
+ }
+
+ /**
* Returns the local content of a specific content type (like audio or
* video).
*
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/ParameterPacketExtension.java b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/ParameterPacketExtension.java index a82cbd9..cbfd17d 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/ParameterPacketExtension.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/extensions/jingle/ParameterPacketExtension.java @@ -41,6 +41,18 @@ public class ParameterPacketExtension extends AbstractPacketExtension } /** + * Creates a new {@link ParameterPacketExtension} instance and sets the + * given name and value. + */ + public ParameterPacketExtension(String name, String value) + { + super(null, ELEMENT_NAME); + + setName(name); + setValue(value); + } + + /** * Sets the name of the format parameter we are representing here. * * @param name the name of the format parameter we are representing here. diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf b/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf index 549d8d3..3651256 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf +++ b/src/net/java/sip/communicator/impl/protocol/jabber/jabber.provider.manifest.mf @@ -36,6 +36,7 @@ Import-Package: ch.imvs.sdes4j.srtp, org.ice4j.socket, org.ice4j.stack, org.jitsi.service.configuration, + org.jitsi.service.libjitsi, org.jitsi.service.neomedia, org.jitsi.service.neomedia.device, org.jitsi.service.neomedia.event, diff --git a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java index 788dc60..6235a13 100644 --- a/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java +++ b/src/net/java/sip/communicator/service/protocol/media/CallPeerMediaHandler.java @@ -236,6 +236,12 @@ public abstract class CallPeerMediaHandler<T extends MediaAwareCallPeer<?,?,?>> private VideoMediaStream videoStream; /** + * Identifier used to group the audio stream and video stream towards + * the <tt>CallPeer</tt> in SDP. + */ + private String msLabel = UUID.randomUUID().toString(); + + /** * The <tt>VideoListener</tt> which listens to the video * <tt>MediaStream</tt> of this instance for changes in the availability of * visual <tt>Component</tt>s displaying remote video and re-fires them as @@ -1952,6 +1958,53 @@ public abstract class CallPeerMediaHandler<T extends MediaAwareCallPeer<?,?,?>> throws OperationFailedException; /** + * Returns the value to use for the 'msid' source-specific SDP media + * attribute (RFC5576) for the stream of type <tt>mediaType</tt> towards + * the <tt>CallPeer</tt>. It consist of a group identifier (shared between + * the local audio and video streams towards the <tt>CallPeer</tt>) and an + * identifier for the particular stream, separated by a space. + * + * {@see http://tools.ietf.org/html/draft-ietf-mmusic-msid} + * + * @param mediaType the media type of the stream for which to return the + * value for 'msid' + * @return the value to use for the 'msid' source-specific SDP media + * attribute (RFC5576) for the stream of type <tt>mediaType</tt> towards + * the <tt>CallPeer</tt>. + */ + public String getMsid(MediaType mediaType) + { + return msLabel + " " + getLabel(mediaType); + } + + /** + * Returns the value to use for the 'label' source-specific SDP media + * attribute (RFC5576) for the stream of type <tt>mediaType</tt> towards + * the <tt>CallPeer</tt>. + * + * @param mediaType the media type of the stream for which to return the + * value for 'label' + * @return the value to use for the 'label' source-specific SDP media + * attribute (RFC5576) for the stream of type <tt>mediaType</tt> towards + * the <tt>CallPeer</tt>. + */ + public String getLabel(MediaType mediaType) + { + return mediaType.toString(); + } + + /** + * Returns the value to use for the 'mslabel' source-specific SDP media + * attribute (RFC5576). + * @return the value to use for the 'mslabel' source-specific SDP media + * attribute (RFC5576). + */ + public String getMsLabel() + { + return msLabel; + } + + /** * Represents the <tt>PropertyChangeListener</tt> which listens to changes * in the values of the properties of the <tt>Call</tt> of {@link #peer}. * Remembers the <tt>Call</tt> it has been added to because <tt>peer</tt> |