diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerGTalkImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerGTalkImpl.java
index 578faf80e..bdef35093 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerGTalkImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerGTalkImpl.java
@@ -105,14 +105,14 @@ public synchronized void answer()
{
getMediaHandler().getTransportManager().
wrapupConnectivityEstablishment();
- answer = getMediaHandler().generateSessionAccept(true, false);
+ answer = getMediaHandler().generateSessionAccept(true);
}
catch(IllegalArgumentException e)
{
sessAcceptedWithNoCands = new SessionIQ();
// HACK apparently FreeSwitch need to have accept before
- answer = getMediaHandler().generateSessionAccept(false, false);
+ answer = getMediaHandler().generateSessionAccept(false);
SessionIQ response
= GTalkPacketFactory.createSessionAccept(
@@ -548,7 +548,7 @@ protected synchronized void processSessionInitiate(SessionIQ sessionInitIQ)
try
{
- getMediaHandler().processOffer(description, false);
+ getMediaHandler().processOffer(description);
}
catch(Exception ex)
{
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerJabberImpl.java
index 24b98edc0..4ec4dd004 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerJabberImpl.java
@@ -116,7 +116,7 @@ public synchronized void answer()
{
getMediaHandler().getTransportManager().
wrapupConnectivityEstablishment();
- answer = getMediaHandler().generateSessionAccept(false);
+ answer = getMediaHandler().generateSessionAccept();
}
catch(Exception exc)
{
@@ -422,7 +422,7 @@ public void processContentAdd(final JingleIQ content)
{
if(!contentAddWithNoCands)
{
- mediaHandler.processOffer(contents, true);
+ mediaHandler.processOffer(contents);
/*
* Gingle transport will not put candidate in session-initiate
@@ -470,7 +470,7 @@ public void run()
mediaHandler.getTransportManager().
wrapupConnectivityEstablishment();
logger.info("wraping up");
- answerContents = mediaHandler.generateSessionAccept(true);
+ answerContents = mediaHandler.generateSessionAccept();
contentIQ = null;
}
catch(Exception e)
@@ -701,7 +701,7 @@ protected synchronized void processSessionInitiate(JingleIQ sessionInitIQ)
try
{
- getMediaHandler().processOffer(offer, false);
+ getMediaHandler().processOffer(offer);
CoinPacketExtension coin = null;
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerGTalkImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerGTalkImpl.java
index 6212ec85e..9ea77b045 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerGTalkImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerGTalkImpl.java
@@ -111,8 +111,6 @@ protected void throwOperationFailedException(
*
* @param offer the offer that we'd like to parse, handle and get an answer
* for.
- * @param overrideMapping will the supplied MediaFormat should
- * override the format if already mapped to a payloadType.
*
* @throws OperationFailedException if we have a problem satisfying the
* description received in offer (e.g. failed to open a device or
@@ -120,8 +118,7 @@ protected void throwOperationFailedException(
* @throws IllegalArgumentException if there's a problem with
* offer's format or semantics.
*/
- public void processOffer(RtpDescriptionPacketExtension offer,
- boolean overrideMapping)
+ public void processOffer(RtpDescriptionPacketExtension offer)
throws OperationFailedException,
IllegalArgumentException
{
@@ -132,22 +129,8 @@ public void processOffer(RtpDescriptionPacketExtension offer,
List answer =
new ArrayList();
- // if we got payload types that override ours
- // they goes in here so we can pass it to the stream to use them
- // when sending. To change the outgoing packets payload types
- // with the value preferred from the sender
- // in case of answer to first offer don't remap anything,
- // just override our settings and use the offered one
- // this way we agree with other party payload mappings
- HashMap overridePTMappingMap = null;
-
- if(overrideMapping)
- overridePTMappingMap = new HashMap();
-
List remoteFormats = JingleUtils.extractFormats(
- offer,
- getDynamicPayloadTypes(),
- overridePTMappingMap);
+ offer, getDynamicPayloadTypes());
boolean isAudio = false;
boolean isVideo = false;
@@ -196,14 +179,6 @@ else if(ext.getNamespace().equals(
localContentMap.put(mediaType.toString(), answer);
- // if stream is configured/created, lets set
- // the override payload type mappings
- MediaStream stream = getStream(mediaType);
- if(overrideMapping && stream != null)
- {
- stream.setPTMappingOverrides(overridePTMappingMap);
- }
-
atLeastOneValidDescription = true;
}
@@ -242,13 +217,11 @@ public void sendCandidates(
* @return the last generated list of
* {@link RtpDescriptionPacketExtension}s that the call peer could use to
* send a accept.
- * @param overrideMapping will the supplied MediaFormat should
- * override the format if already mapped to a payloadType.
*
* @throws OperationFailedException if we fail to configure the media stream
*/
public RtpDescriptionPacketExtension generateSessionAccept(
- boolean initStream, boolean overrideMapping)
+ boolean initStream)
throws OperationFailedException
{
RtpDescriptionPacketExtension description =
@@ -264,18 +237,6 @@ public RtpDescriptionPacketExtension generateSessionAccept(
String ns = getNamespaceForMediaType(mediaType);
String mediaName = getNameForMediaType(mediaType);
- // if we got payload types that override ours
- // they goes in here so we can pass it to the stream to use them
- // when sending. To change the outgoing packets payload types
- // with the value preferred from the sender
- // in case of answer to first offer don't remap anything,
- // just override our settings and use the offered one
- // this way we agree with other party payload mappings
- HashMap overridePTMappingMap = null;
-
- if(overrideMapping)
- overridePTMappingMap = new HashMap();
-
for(PayloadTypePacketExtension ext : lst)
{
if(ext.getNamespace().equals(ns))
@@ -294,9 +255,7 @@ public RtpDescriptionPacketExtension generateSessionAccept(
}
format = JingleUtils.payloadTypeToMediaFormat(
- ext,
- getDynamicPayloadTypes(),
- overridePTMappingMap);
+ ext, getDynamicPayloadTypes());
description.addPayloadType(ext);
if(format != null)
@@ -355,14 +314,6 @@ public RtpDescriptionPacketExtension generateSessionAccept(
initStream(mediaName, connector, dev, format, target,
direction, rtpExtensions, masterStream);
-
- // stream is configured/created, lets set
- // the override payload type mappings
- MediaStream stream = getStream(mediaType);
- if(overrideMapping && stream != null)
- {
- stream.setPTMappingOverrides(overridePTMappingMap);
- }
}
return description;
@@ -396,22 +347,12 @@ public void processAnswer(RtpDescriptionPacketExtension answer)
String mediaName = getNameForMediaType(mediaType);
MediaFormat format = null;
- // if we got payload types that override ours
- // they goes in here so we can pass it to the stream to use them
- // when sending. To change the outgoing packets payload types
- // with the value preferred from the sender
- HashMap overridePTMapping =
- new HashMap();
-
-
for(PayloadTypePacketExtension ext : lst)
{
if(ext.getNamespace().equals(ns))
{
format = JingleUtils.payloadTypeToMediaFormat(
- ext,
- getDynamicPayloadTypes(),
- overridePTMapping);
+ ext, getDynamicPayloadTypes());
if(format != null)
break;
}
@@ -461,14 +402,6 @@ public void processAnswer(RtpDescriptionPacketExtension answer)
initStream(mediaName, connector, dev, format, target,
direction, rtpExtensions, masterStream);
-
- // stream is configured/created, lets set
- // the override payload type mappings
- MediaStream stream = getStream(mediaType);
- if(stream != null)
- {
- stream.setPTMappingOverrides(overridePTMapping);
- }
}
}
@@ -854,7 +787,7 @@ protected DynamicPayloadTypeRegistry getDynamicPayloadTypes()
// something else in codec negociation
mappings.put(Byte.valueOf((byte)97), new String("H264"));
- registry.setOverridePayloadTypeMappings(mappings);
+ registry.setLocalPayloadTypePreferences(mappings);
return registry;
}
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 2bd333ee3..6af49cb27 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/CallPeerMediaHandlerJabberImpl.java
@@ -224,8 +224,6 @@ protected MediaStream initStream(String streamName,
*
* @param offer the offer that we'd like to parse, handle and get an answer
* for.
- * @param overrideMapping will the supplied MediaFormat should
- * override the format if already mapped to a payloadType.
*
* @throws OperationFailedException if we have a problem satisfying the
* description received in offer (e.g. failed to open a device or
@@ -233,8 +231,7 @@ protected MediaStream initStream(String streamName,
* @throws IllegalArgumentException if there's a problem with
* offer's format or semantics.
*/
- public void processOffer(List offer,
- boolean overrideMapping)
+ public void processOffer(List offer)
throws OperationFailedException,
IllegalArgumentException
{
@@ -252,23 +249,10 @@ public void processOffer(List offer,
MediaType mediaType
= MediaType.parseString( description.getMedia() );
- // if we got payload types that override ours
- // they goes in here so we can pass it to the stream to use them
- // when sending. To change the outgoing packets payload types
- // with the value preferred from the sender
- // in case of answer to first offer don't remap anything,
- // just override our settings and use the offered one
- // this way we agree with other party payload mappings
- HashMap overridePTMappingMap = null;
-
- if(overrideMapping)
- overridePTMappingMap = new HashMap();
-
List remoteFormats
= JingleUtils.extractFormats(
description,
- getDynamicPayloadTypes(),
- overridePTMappingMap);
+ getDynamicPayloadTypes());
MediaDevice dev = getDefaultDevice(mediaType);
@@ -383,14 +367,6 @@ public void processOffer(List offer,
answer.add(ourContent);
localContentMap.put(content.getName(), ourContent);
- // if stream is configured/created, lets set
- // the override payload type mappings
- MediaStream stream = getStream(mediaType);
- if(overrideMapping && stream != null)
- {
- stream.setPTMappingOverrides(overridePTMappingMap);
- }
-
atLeastOneValidDescription = true;
}
@@ -438,16 +414,13 @@ public void sendTransportInfo(
* Wraps up any ongoing candidate harvests and returns our response to the
* last offer we've received, so that the peer could use it to send a
* session-accept.
- * @param overrideMapping will the supplied MediaFormat should
- * override the format if already mapped to a payloadType.
*
* @return the last generated list of {@link ContentPacketExtension}s that
* the call peer could use to send a session-accept.
*
* @throws OperationFailedException if we fail to configure the media stream
*/
- public Iterable generateSessionAccept(
- boolean overrideMapping)
+ public Iterable generateSessionAccept()
throws OperationFailedException
{
TransportManagerJabberImpl transportManager = getTransportManager();
@@ -520,26 +493,11 @@ public Iterable generateSessionAccept(
= JingleUtils.getRtpDescription(theirContent);
MediaFormat format = null;
- // if we got payload types that override ours
- // they goes in here so we can pass it to the stream to use them
- // when sending. To change the outgoing packets payload types
- // with the value preferred from the sender
- // in case of answer to first offer don't remap anything,
- // just override our settings and use the offered one
- // this way we agree with other party payload mappings
- HashMap overridePTMapping = null;
-
- if(overrideMapping)
- overridePTMapping = new HashMap();
-
for(PayloadTypePacketExtension payload
: theirDescription.getPayloadTypes())
{
- format
- = JingleUtils.payloadTypeToMediaFormat(
- payload,
- getDynamicPayloadTypes(),
- overridePTMapping);
+ format = JingleUtils.payloadTypeToMediaFormat(
+ payload, getDynamicPayloadTypes());
if(format != null)
break;
}
@@ -599,14 +557,6 @@ public Iterable generateSessionAccept(
direction,
rtpExtensions,
masterStream);
-
- // stream is configured/created, lets set
- // the override payload type mappings
- MediaStream stream = getStream(type);
- if(stream != null)
- {
- stream.setPTMappingOverrides(overridePTMapping);
- }
}
return sessAccept;
}
@@ -1068,15 +1018,8 @@ private void processContent(
return;
}
- // if we got payload types that override ours
- // they goes in here so we can pass it to the stream to use them
- // when sending. To change the outgoing packets payload types
- // with the value preferred from the sender
- HashMap overridePTMapping =
- new HashMap();
-
List supportedFormats = JingleUtils.extractFormats(
- description, getDynamicPayloadTypes(), overridePTMapping);
+ description, getDynamicPayloadTypes());
MediaDevice dev = getDefaultDevice(mediaType);
@@ -1186,14 +1129,6 @@ private void processContent(
direction,
rtpExtensions,
masterStream);
-
- // stream is configured/created, lets set
- // the override payload type mappings
- MediaStream stream = getStream(mediaType);
- if(stream != null)
- {
- stream.setPTMappingOverrides(overridePTMapping);
- }
}
/**
diff --git a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java
index 61ae300fa..3c98bd927 100644
--- a/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/jabber/OperationSetPersistentPresenceJabberImpl.java
@@ -1491,7 +1491,9 @@ public void parseContactPhotoPresence(Packet packet)
}
catch(XMPPException ex)
{
- logger.info("Can not retrieve vCard from: " + packet.getFrom(), ex);
+ logger.info("Can not retrieve vCard from: " + packet.getFrom());
+ if(logger.isTraceEnabled())
+ logger.trace("vCard retrieval exception was: ", ex);
}
}
}
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 fb07ba17b..02b9c67fb 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
@@ -68,10 +68,6 @@ public static RtpDescriptionPacketExtension getRtpDescription(
* @param ptRegistry a reference to the DynamycPayloadTypeRegistry
* where we should be registering newly added payload type number to format
* mappings.
- * @param overridePTMapping a payload types that we will need to remap
- * when sending if selected. Use to respect remote party payload types.
- * Can be null, then we override the payload type and use the other party
- * payload types for this session.
*
* @return an ordered list of MediaFormats that are both advertised
* in the description and supported by our MediaService
@@ -79,8 +75,7 @@ public static RtpDescriptionPacketExtension getRtpDescription(
*/
public static List extractFormats(
RtpDescriptionPacketExtension description,
- DynamicPayloadTypeRegistry ptRegistry,
- Map overridePTMapping)
+ DynamicPayloadTypeRegistry ptRegistry)
{
List mediaFmts = new ArrayList();
List payloadTypes
@@ -88,8 +83,7 @@ public static List extractFormats(
for(PayloadTypePacketExtension ptExt : payloadTypes)
{
- MediaFormat format = payloadTypeToMediaFormat(
- ptExt, ptRegistry, overridePTMapping);
+ MediaFormat format = payloadTypeToMediaFormat(ptExt, ptRegistry);
//continue if our media service does not know this format
if(format == null)
@@ -114,25 +108,19 @@ public static List extractFormats(
* use for the registration of possible dynamic payload types or
* null the returned MediaFormat is to not be registered
* into a DynamicPayloadTypeRegistry.
- * @param overridePTMapping a payload types that we will need to remap
- * when sending if selected. Use to respect remote party payload types.
- * Can be null, then we override the payload type and use the other party
- * payload types for this session.
*
* @return the {@link MediaFormat} described in the payloadType
* extension or null if we don't recognize the format.
*/
public static MediaFormat payloadTypeToMediaFormat(
PayloadTypePacketExtension payloadType,
- DynamicPayloadTypeRegistry ptRegistry,
- Map overridePTMapping)
+ DynamicPayloadTypeRegistry ptRegistry)
{
return
payloadTypeToMediaFormat(
payloadType,
JabberActivator.getMediaService(),
- ptRegistry,
- overridePTMapping);
+ ptRegistry);
}
/**
@@ -147,10 +135,6 @@ public static MediaFormat payloadTypeToMediaFormat(
* use for the registration of possible dynamic payload types or
* null the returned MediaFormat is to not be registered
* into a DynamicPayloadTypeRegistry.
- * @param overridePTMapping a payload types that we will need to remap
- * when sending if selected. Use to respect remote party payload types.
- * Can be null, then we override the payload type and use the other party
- * payload types for this session.
*
* @return the {@link MediaFormat} described in the payloadType
* extension or null if we don't recognize the format.
@@ -158,8 +142,7 @@ public static MediaFormat payloadTypeToMediaFormat(
public static MediaFormat payloadTypeToMediaFormat(
PayloadTypePacketExtension payloadType,
MediaService mediaService,
- DynamicPayloadTypeRegistry ptRegistry,
- Map overridePTMapping)
+ DynamicPayloadTypeRegistry ptRegistry)
{
byte pt = (byte)payloadType.getID();
boolean unknown = false;
@@ -208,53 +191,19 @@ public static MediaFormat payloadTypeToMediaFormat(
* 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?
+ * of payloadType in DynamicPayloadTypeRegistry. If the remote peer
+ * tries to remap a payloadType in its answer to a different MediaFormat
+ * than the one we've specified in our offer, then the dynamic paylaod
+ * type registry will keep the original value for receiving and also
+ * add an overriding value for the new one. The overriding value will
+ * be streamed to our peer.
*/
if ((ptRegistry != null)
&& (pt >= MediaFormat.MIN_DYNAMIC_PAYLOAD_TYPE)
&& (pt <= MediaFormat.MAX_DYNAMIC_PAYLOAD_TYPE)
&& (ptRegistry.findFormat(pt) == null))
{
- ptRegistry.addMapping(format, pt, overridePTMapping != null);
- }
-
- // if we need to check and set some override payload
- // type mappings
- if(overridePTMapping != null)
- {
- MediaFormat addedFormat = ptRegistry.findFormat(pt);
-
- if(addedFormat == null)
- {
- // the format wasn't added, as no longer we are overriding
- // our own settings, means the remote party wants
- // payload remapping
- overridePTMapping.put(
- ptRegistry.obtainPayloadTypeNumber(format), pt);
- }
- else
- {
- // if formats are different, other party ignores
- // our settings and wants a particular payload type
- // for its format, lets add a override mapping
- // despite that we already have a format with the same
- // payload
- if(format != null && !format.equals(addedFormat))
- {
- byte ourPT =
- ptRegistry.obtainPayloadTypeNumber(format);
-
- if(ourPT != pt)
- {
- overridePTMapping.put(ourPT, pt);
- }
- }
- }
+ ptRegistry.addMapping(format, pt);
}
return unknown ? null : format;
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandlerSipImpl.java b/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandlerSipImpl.java
index 2c8c84f58..e3b601f0c 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandlerSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandlerSipImpl.java
@@ -461,23 +461,8 @@ private Vector createMediaDescriptionsForAnswer(
continue;
}
- // if we got payload types that override ours
- // they goes in here so we can pass it to the stream to use them
- // when sending. To change the outgoing packets payload types
- // with the value preferred from the sender
- // in case of answer to first offer don't remap anything,
- // just override our settings and use the offered one
- // this way we agree with other party payload mappings
- HashMap overridePTMapping = null;
-
- if(localSess != null)
- overridePTMapping = new HashMap();
-
- List remoteFormats =
- SdpUtils.extractFormats(
- mediaDescription,
- getDynamicPayloadTypes(),
- overridePTMapping);
+ List remoteFormats = SdpUtils.extractFormats(
+ mediaDescription, getDynamicPayloadTypes());
MediaDevice dev = getDefaultDevice(mediaType);
MediaDirection devDirection
@@ -628,14 +613,6 @@ else if(mediaType.equals(MediaType.VIDEO) &&
initStream(connector, dev, fmt, target, direction, rtpExtensions,
masterStream);
- // stream is configured/created, lets set
- // the override payload type mappings
- MediaStream stream = getStream(mediaType);
- if(overridePTMapping != null && stream != null)
- {
- stream.setPTMappingOverrides(overridePTMapping);
- }
-
// create the answer description
answerDescriptions.add(md);
@@ -906,18 +883,8 @@ private synchronized void processAnswer(SessionDescription answer)
continue;
}
- // if we got payload types that override ours
- // they goes in here so we can pass it to the stream to use them
- // when sending. To change the outgoing packets payload types
- // with the value preferred from the sender
- HashMap overridePTMapping =
- new HashMap();
-
- List supportedFormats =
- SdpUtils.extractFormats(
- mediaDescription,
- getDynamicPayloadTypes(),
- overridePTMapping);
+ List supportedFormats = SdpUtils.extractFormats(
+ mediaDescription, getDynamicPayloadTypes());
MediaDevice dev = getDefaultDevice(mediaType);
@@ -1059,14 +1026,6 @@ private synchronized void processAnswer(SessionDescription answer)
// create the corresponding stream...
initStream(connector, dev, supportedFormats.get(0), target,
direction, rtpExtensions, masterStream);
-
- // stream is configured/created, lets set
- // the override payload type mappings
- MediaStream stream = getStream(mediaType);
- if(stream != null)
- {
- stream.setPTMappingOverrides(overridePTMapping);
- }
}
}
diff --git a/src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java b/src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java
index 7499a00af..5e1b48d5a 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java
@@ -362,10 +362,6 @@ private static MediaDescription removeMediaDesc(
* @param ptRegistry a reference to the DynamycPayloadTypeRegistry
* where we should be registering newly added payload type number to format
* mappings.
- * @param overridePTMapping a payload types that we will need to remap
- * when sending if selected. Use to respect remote party payload types.
- * Can be null, then we override the payload type and use the other party
- * payload types for this session.
*
* @return an ordered list of MediaFormats that are both advertised
* in the mediaDesc description and supported by our
@@ -374,8 +370,7 @@ private static MediaDescription removeMediaDesc(
@SuppressWarnings("unchecked")//legacy code from jain-sdp
public static List extractFormats(
MediaDescription mediaDesc,
- DynamicPayloadTypeRegistry ptRegistry,
- Map overridePTMapping)
+ DynamicPayloadTypeRegistry ptRegistry)
{
List mediaFmts = new ArrayList();
Vector formatStrings;
@@ -471,42 +466,7 @@ public static List extractFormats(
try
{
mediaFormat = createFormat(
- pt, rtpmap, fmtp, frameRate, advp, ptRegistry,
- overridePTMapping != null);
-
- // if we need to check and set some override payload
- // type mappings
- if(overridePTMapping != null)
- {
- MediaFormat addedFormat = ptRegistry.findFormat(pt);
-
- if(addedFormat == null)
- {
- // the format wasn't added, as no longer we are overriding
- // our own settings, means the remote party wants
- // payload remapping
- overridePTMapping.put(
- ptRegistry.obtainPayloadTypeNumber(mediaFormat), pt);
- }
- else
- {
- // if formats are different, other party ignores
- // our settings and wants a particular payload type
- // for its format, lets add a override mapping
- // despite that we already have a format with the same
- // payload
- if(mediaFormat != null && !mediaFormat.equals(addedFormat))
- {
- byte ourPT =
- ptRegistry.obtainPayloadTypeNumber(mediaFormat);
-
- if(ourPT != pt)
- {
- overridePTMapping.put(ourPT, pt);
- }
- }
- }
- }
+ pt, rtpmap, fmtp, frameRate, advp, ptRegistry);
}
catch (SdpException e)
{
@@ -692,8 +652,6 @@ private static RTPExtension parseRTPExtensionAttribute(
* @param ptRegistry the {@link DynamicPayloadTypeRegistry} that we are to
* use in case payloadType is dynamic and rtpmap is
* null (in which case we can hope its in the registry).
- * @param overrideMapping will the supplied MediaFormat should
- * override the format if already mapped to a payloadType.
*
* @return a MediaForamt instance corresponding to the specified
* payloadType and rtpmap, and fmtp attributes
@@ -710,8 +668,7 @@ private static MediaFormat createFormat(
Attribute fmtp,
float frameRate,
List advp,
- DynamicPayloadTypeRegistry ptRegistry,
- boolean overrideMapping)
+ DynamicPayloadTypeRegistry ptRegistry)
throws SdpException
{
//default values in case rtpmap is null.
@@ -804,19 +761,19 @@ private static MediaFormat createFormat(
* 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 remap a
+ * DynamicPayloadTypeRegistry. If the remote peer tries to remap a
* payloadType in its answer to a different MediaFormat than the one
- * we've specified in our offer?
+ * we've specified in our offer, then the dynamic paylaod type registry
+ * will keep the original value for receiving and also add an overriding
+ * value for the new one. The overriding value will be streamed to our
+ * peer.
*/
if ((payloadType >= MediaFormat.MIN_DYNAMIC_PAYLOAD_TYPE)
&& (payloadType
<= MediaFormat.MAX_DYNAMIC_PAYLOAD_TYPE)
&& (format != null)
&& (ptRegistry.findFormat(payloadType) == null))
- ptRegistry.addMapping(format, payloadType, overrideMapping);
+ ptRegistry.addMapping(format, payloadType);
return format;
}
diff --git a/src/net/java/sip/communicator/service/protocol/AccountID.java b/src/net/java/sip/communicator/service/protocol/AccountID.java
index 1fa2cf758..16ea38294 100644
--- a/src/net/java/sip/communicator/service/protocol/AccountID.java
+++ b/src/net/java/sip/communicator/service/protocol/AccountID.java
@@ -497,7 +497,8 @@ public List getEncryptionProtocols(boolean enabled)
for(int i = 0; i < tmp.length; ++i)
{
- encryptionProtocolList.add(tmp[i]);
+ if(tmp[i] != null && tmp[i].trim().length() > 0 )
+ encryptionProtocolList.add(tmp[i]);
}
return encryptionProtocolList;
diff --git a/src/net/java/sip/communicator/service/protocol/media/DynamicPayloadTypeRegistry.java b/src/net/java/sip/communicator/service/protocol/media/DynamicPayloadTypeRegistry.java
index adfed3a9c..1893a923e 100644
--- a/src/net/java/sip/communicator/service/protocol/media/DynamicPayloadTypeRegistry.java
+++ b/src/net/java/sip/communicator/service/protocol/media/DynamicPayloadTypeRegistry.java
@@ -42,11 +42,18 @@ public class DynamicPayloadTypeRegistry
private final Map payloadTypeMappings
= new HashMap();
+ /**
+ * Maps locally defined payload types to payload type numbers that the
+ * remote party wants to use.
+ */
+ private final Map payloadTypeOverrides
+ = new HashMap();
+
/**
* An override mappings of MediaFormat instances to the
* dynamic payload type numbers.
*/
- private Map overridePayloadTypeMappings = null;
+ private Map localPayloadTypePreferences = null;
/**
* Payload types mapping from MediaService.
@@ -58,9 +65,9 @@ public class DynamicPayloadTypeRegistry
*
* @param mappings the override payload-type mappings.
*/
- public void setOverridePayloadTypeMappings(Map mappings)
+ public void setLocalPayloadTypePreferences(Map mappings)
{
- overridePayloadTypeMappings = mappings;
+ localPayloadTypePreferences = mappings;
}
/**
@@ -144,14 +151,14 @@ private Map getDynamicPayloadTypePreferences()
ProtocolMediaActivator.getMediaService()
.getDynamicPayloadTypePreferences());
- if(overridePayloadTypeMappings == null)
+ if(localPayloadTypePreferences == null)
return mappings;
// if we have specific payload type preferences from
// CallPeerMediaHandler, replace them here
for(Map.Entry e :
- this.overridePayloadTypeMappings.entrySet())
+ this.localPayloadTypePreferences.entrySet())
{
Byte key = e.getKey();
String fmt = e.getValue();
@@ -216,7 +223,11 @@ private Byte getPreferredDynamicPayloadType(MediaFormat format)
/**
* Adds the specified format to payloadType mapping to
- * the list of mappings known to this registry. The method is meant for
+ * the list of mappings known to this registry. If the mapping already
+ * exists in the registry then we will use the new value to create an
+ * overriding mapping. This basically means that we will expect packets to
+ * be streamed to us with the original PT but we will be streaming with
+ * The method is meant for
* use primarily when handling incoming media descriptions, methods
* generating local SDP should use the obtainPayloadTypeNumber
* instead.
@@ -225,15 +236,11 @@ private Byte getPreferredDynamicPayloadType(MediaFormat format)
* to format.
* @param format the MediaFormat that we'd like to create a
* dynamic mapping for.
- * @param overrideMapping will the supplied MediaFormat should
- * override the format if already mapped to a payloadType.
*
* @throws IllegalArgumentException in case payloadType has
* already been assigned to another format.
*/
- public void addMapping(MediaFormat format,
- byte payloadType,
- boolean overrideMapping)
+ public void addMapping(MediaFormat format, byte payloadType)
throws IllegalArgumentException
{
MediaFormat alreadyMappedFmt = findFormat(payloadType);
@@ -254,11 +261,19 @@ public void addMapping(MediaFormat format,
+ MediaFormat.MAX_DYNAMIC_PAYLOAD_TYPE);
}
- // check whether we should override our mappings
- if(!overrideMapping && payloadTypeMappings.containsKey(format))
- return;
-
- payloadTypeMappings.put(format, Byte.valueOf(payloadType));
+ // if the format is already mapped to a PT then we'll keep it and use
+ // the new one as an override value for sending. we'd still expect to
+ // receive packets with the value that we had first selected.
+ if(payloadTypeMappings.containsKey(format))
+ {
+ byte originalPayloadType = payloadTypeMappings.get(format);
+ payloadTypeOverrides.put(originalPayloadType, payloadType);
+ }
+ else
+ {
+ //we are just adding a new mapping. nothing out of the ordinary
+ payloadTypeMappings.put(format, Byte.valueOf(payloadType));
+ }
}
/**
@@ -353,4 +368,16 @@ public Map getMappings()
{
return new HashMap(payloadTypeMappings);
}
+
+ /**
+ * Returns a copy of all mapping overrides currently registered in this
+ * registry.
+ *
+ * @return a copy of all mapping overrides currently registered in this
+ * registry.
+ */
+ public Map getMappingOverrides()
+ {
+ return new HashMap(payloadTypeOverrides);
+ }
}
diff --git a/src/net/java/sip/communicator/service/protocol/media/MediaHandler.java b/src/net/java/sip/communicator/service/protocol/media/MediaHandler.java
index 34c06e3f1..5211d80c6 100644
--- a/src/net/java/sip/communicator/service/protocol/media/MediaHandler.java
+++ b/src/net/java/sip/communicator/service/protocol/media/MediaHandler.java
@@ -670,8 +670,9 @@ boolean processKeyFrameRequest(CallPeerMediaHandler> callPeerMediaHandler)
}
/**
- * Registers all dynamic payload mappings known to this
- * MediaHandler with the specified MediaStream.
+ * Registers all dynamic payload mappings and any payload type overrides
+ * that are known to this MediaHandler with the specified
+ * MediaStream.
*
* @param stream the MediaStream that we'd like to register our
* dynamic payload mappings with.
@@ -680,15 +681,30 @@ private void registerDynamicPTsWithStream(
CallPeerMediaHandler> callPeerMediaHandler,
MediaStream stream)
{
+ DynamicPayloadTypeRegistry dynamicPayloadTypes
+ = callPeerMediaHandler.getDynamicPayloadTypes();
+
+ //first register the mappings
for (Map.Entry mapEntry
- : callPeerMediaHandler.getDynamicPayloadTypes().getMappings()
- .entrySet())
+ : dynamicPayloadTypes.getMappings().entrySet())
{
byte pt = mapEntry.getValue();
MediaFormat fmt = mapEntry.getKey();
stream.addDynamicRTPPayloadType(pt, fmt);
}
+
+ //now register whatever overrides we have for the above mappings
+ for (Map.Entry overrideEntry
+ : dynamicPayloadTypes.getMappingOverrides().entrySet())
+ {
+ byte originalPt = overrideEntry.getKey();
+ byte overridePt = overrideEntry.getValue();
+
+ stream.addDynamicRTPPayloadTypeOverride(originalPt, overridePt);
+ }
+
+
}
/**
diff --git a/src/net/java/sip/communicator/util/plugin/wizard/SecurityPanel.java b/src/net/java/sip/communicator/util/plugin/wizard/SecurityPanel.java
index 81f0e769f..1f499cb60 100644
--- a/src/net/java/sip/communicator/util/plugin/wizard/SecurityPanel.java
+++ b/src/net/java/sip/communicator/util/plugin/wizard/SecurityPanel.java
@@ -83,8 +83,8 @@ private static class SavpOption
@Override
public String toString()
{
- return UtilActivator.getResources().getI18NString("plugin.sipaccregwizz.SAVP_OPTION_"
- + option);
+ return UtilActivator.getResources().getI18NString(
+ "plugin.sipaccregwizz.SAVP_OPTION_" + option);
}
}
@@ -244,8 +244,9 @@ private void initComponents()
c.fill = GridBagConstraints.HORIZONTAL;
//general encryption option
- enableDefaultEncryption = new SIPCommCheckBox(UtilActivator.getResources()
- .getI18NString("plugin.sipaccregwizz.ENABLE_DEFAULT_ENCRYPTION"),
+ enableDefaultEncryption = new SIPCommCheckBox(UtilActivator
+ .getResources()
+ .getI18NString("plugin.sipaccregwizz.ENABLE_DEFAULT_ENCRYPTION"),
regform.isDefaultEncryption());
enableDefaultEncryption.addActionListener(this);
mainPanel.add(enableDefaultEncryption, c);
@@ -308,7 +309,8 @@ public void mouseClicked(MouseEvent e)
// Encryption protcol preferences.
JLabel lblEncryptionProtocolPreferences = new JLabel();
lblEncryptionProtocolPreferences.setText(UtilActivator.getResources()
- .getI18NString("plugin.sipaccregwizz.ENCRYPTION_PROTOCOL_PREFERENCES"));
+ .getI18NString(
+ "plugin.sipaccregwizz.ENCRYPTION_PROTOCOL_PREFERENCES"));
c.gridy++;
pnlAdvancedSettings.add(lblEncryptionProtocolPreferences, c);
@@ -330,8 +332,8 @@ public void mouseClicked(MouseEvent e)
//ZRTP
JLabel lblZrtpOption = new JLabel();
lblZrtpOption.setBorder(new EmptyBorder(5, 5, 5, 0));
- lblZrtpOption.setText(
- UtilActivator.getResources().getI18NString("plugin.sipaccregwizz.ZRTP_OPTION"));
+ lblZrtpOption.setText(UtilActivator.getResources()
+ .getI18NString("plugin.sipaccregwizz.ZRTP_OPTION"));
c.gridx = 0;
c.gridy++;
c.gridwidth = 1;
@@ -339,7 +341,8 @@ public void mouseClicked(MouseEvent e)
c.gridx = 1;
pnlAdvancedSettings.add(new JSeparator(), c);
- enableSipZrtpAttribute = new SIPCommCheckBox(UtilActivator.getResources()
+ enableSipZrtpAttribute = new SIPCommCheckBox(
+ UtilActivator.getResources()
.getI18NString("plugin.sipaccregwizz.ENABLE_SIPZRTP_ATTRIBUTE"),
regform.isSipZrtpAttribute());
c.gridx = 0;
@@ -350,8 +353,8 @@ public void mouseClicked(MouseEvent e)
//SDES
JLabel lblSDesOption = new JLabel();
lblSDesOption.setBorder(new EmptyBorder(5, 5, 5, 0));
- lblSDesOption.setText(
- UtilActivator.getResources().getI18NString("plugin.sipaccregwizz.SDES_OPTION"));
+ lblSDesOption.setText( UtilActivator.getResources().getI18NString(
+ "plugin.sipaccregwizz.SDES_OPTION"));
c.gridx = 0;
c.gridy++;
c.gridwidth = 1;
@@ -384,8 +387,8 @@ public void mouseClicked(MouseEvent e)
c.gridwidth = 1;
JLabel lblSavpOption = new JLabel();
lblSavpOption.setBorder(new EmptyBorder(5, 5, 5, 0));
- lblSavpOption.setText(
- UtilActivator.getResources().getI18NString("plugin.sipaccregwizz.SAVP_OPTION"));
+ lblSavpOption.setText( UtilActivator.getResources().getI18NString(
+ "plugin.sipaccregwizz.SAVP_OPTION"));
if(this.displaySavpOtions)
{
c.gridy++;
@@ -486,10 +489,12 @@ private void loadStates()
this.encryptionProtocolPreferences.setEnabled(b);
enableSipZrtpAttribute.setEnabled(
b
- && this.encryptionConfigurationTableModel.isEnabledLabel("ZRTP"));
+ && this.encryptionConfigurationTableModel
+ .isEnabledLabel("ZRTP"));
tabCiphers.setEnabled(
b
- && this.encryptionConfigurationTableModel.isEnabledLabel("SDES"));
+ && this.encryptionConfigurationTableModel
+ .isEnabledLabel("SDES"));
}
/**
@@ -536,7 +541,8 @@ private void loadEncryptionProtocols(
Arrays.asList(encryptions);
for(int i = 0; i < this.encryptionProtocols.length; ++i)
{
- if(!alreadyLoadedEncryptionProtocols.contains(encryptionProtocols[i]))
+ if(!alreadyLoadedEncryptionProtocols
+ .contains(encryptionProtocols[i]))
{
encryptions[index] = encryptionProtocols[i];
selectedEncryptions[index] = false;