diff options
author | Emil Ivov <emcho@jitsi.org> | 2010-07-28 13:46:18 +0000 |
---|---|---|
committer | Emil Ivov <emcho@jitsi.org> | 2010-07-28 13:46:18 +0000 |
commit | 1f5e97555ca3e68bfe669d8e59fdb4e13e154aa1 (patch) | |
tree | c54cadbedbe6c3ce11059603e352e51ea6267a6f /src/net/java/sip/communicator/impl/protocol/jabber/jinglesdp | |
parent | 48427fcb9d3f980e7530122ab399d09e6c0d519f (diff) | |
download | jitsi-1f5e97555ca3e68bfe669d8e59fdb4e13e154aa1.zip jitsi-1f5e97555ca3e68bfe669d8e59fdb4e13e154aa1.tar.gz jitsi-1f5e97555ca3e68bfe669d8e59fdb4e13e154aa1.tar.bz2 |
Outgoing calls: media streams are now only initiated after we get the session-accept
Diffstat (limited to 'src/net/java/sip/communicator/impl/protocol/jabber/jinglesdp')
-rw-r--r-- | src/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/JingleUtils.java | 89 |
1 files changed, 57 insertions, 32 deletions
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/JingleUtils.java b/src/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/JingleUtils.java index f43ac30..3eef5ad 100644 --- a/src/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/JingleUtils.java +++ b/src/net/java/sip/communicator/impl/protocol/jabber/jinglesdp/JingleUtils.java @@ -84,41 +84,11 @@ public class JingleUtils for(PayloadTypePacketExtension ptExt : payloadTypes) { - byte pt = (byte)ptExt.getID(); - List<ParameterPacketExtension> params = ptExt.getParameters(); - - //convert params to a name:value map - Map<String, String> paramsMap = new Hashtable<String, String>(); - - for(ParameterPacketExtension param : params) - paramsMap.put(param.getName(), param.getValue()); - - //now create the format. - MediaFormat format = JabberActivator.getMediaService() - .getFormatFactory().createMediaFormat( - pt, ptExt.getName(), (double)ptExt.getClockrate(), - ptExt.getChannels(), paramsMap, null); + MediaFormat format = payloadTypeToMediaFormat(ptExt, ptRegistry); //continue if our media service does not know this format if(format == null) - continue; - - /* - * We've just created a MediaFormat for the specified payloadType - * so we have to remember the mapping between the two so that we - * don't, for example, map the same payloadType to a different - * MediaFormat at a later time when we do automatic generation - * of payloadType in DynamicPayloadTypeRegistry. - */ - /* - * TODO What is expected to happen when the remote peer tries to - * re-map a payloadType in its answer to a different MediaFormat - * than the one we've specified in our offer? - */ - if ((pt >= MediaFormat.MIN_DYNAMIC_PAYLOAD_TYPE) - && (pt <= MediaFormat.MAX_DYNAMIC_PAYLOAD_TYPE) - && (ptRegistry.findFormat(pt) == null)) - ptRegistry.addMapping(format, pt); + return null; mediaFmts.add(format); } @@ -127,6 +97,61 @@ public class JingleUtils } /** + * Returns the {@link MediaFormat} described in the <tt>payloadType</tt> + * extension or <tt>null</tt> if we don't recognize the format. + * + * @param payloadType the {@link PayloadTypePacketExtension} that we'd like + * to parse into a {@link MediaFormat}. + * @param ptRegistry the {@link DynamicPayloadTypeRegistry} that we would + * use for the registration of possible dynamic payload types. + * + * @return the {@link MediaFormat} described in the <tt>payloadType</tt> + * extension or <tt>null</tt> if we don't recognize the format. + */ + public static MediaFormat payloadTypeToMediaFormat( + PayloadTypePacketExtension payloadType, + DynamicPayloadTypeRegistry ptRegistry) + { + byte pt = (byte)payloadType.getID(); + List<ParameterPacketExtension> params = payloadType.getParameters(); + + //convert params to a name:value map + Map<String, String> paramsMap = new Hashtable<String, String>(); + + for(ParameterPacketExtension param : params) + paramsMap.put(param.getName(), param.getValue()); + + //now create the format. + MediaFormat format = JabberActivator.getMediaService() + .getFormatFactory().createMediaFormat( + pt, payloadType.getName(), (double)payloadType.getClockrate(), + payloadType.getChannels(), paramsMap, null); + + //we don't seem to know anything about this format + if(format == null) + return null; + + /* + * We've just created a MediaFormat for the specified payloadType + * so we have to remember the mapping between the two so that we + * don't, for example, map the same payloadType to a different + * MediaFormat at a later time when we do automatic generation + * of payloadType in DynamicPayloadTypeRegistry. + */ + /* + * TODO What is expected to happen when the remote peer tries to + * re-map a payloadType in its answer to a different MediaFormat + * than the one we've specified in our offer? + */ + if ((pt >= MediaFormat.MIN_DYNAMIC_PAYLOAD_TYPE) + && (pt <= MediaFormat.MAX_DYNAMIC_PAYLOAD_TYPE) + && (ptRegistry.findFormat(pt) == null)) + ptRegistry.addMapping(format, pt); + + return format; + } + + /** * Extracts and returns the list of <tt>RTPExtension</tt>s advertised in * <tt>desc</tt> and registers newly encountered ones into the specified * <tt>extMap</tt>. The method returns an empty list in case there were no |