Fixes code formatting (lines going beyond column 80)

cusax-fix
Emil Ivov 14 years ago
parent 3b3ff4a92f
commit 3f4fa600e0

@ -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)
{

@ -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;

@ -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 <tt>MediaFormat</tt> should
* override the format if already mapped to a <tt>payloadType</tt>.
*
* @throws OperationFailedException if we have a problem satisfying the
* description received in <tt>offer</tt> (e.g. failed to open a device or
@ -120,8 +118,7 @@ protected void throwOperationFailedException(
* @throws IllegalArgumentException if there's a problem with
* <tt>offer</tt>'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<PayloadTypePacketExtension> answer =
new ArrayList<PayloadTypePacketExtension>();
// 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<Byte, Byte> overridePTMappingMap = null;
if(overrideMapping)
overridePTMappingMap = new HashMap<Byte, Byte>();
List<MediaFormat> 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 <tt>accept</tt>.
* @param overrideMapping will the supplied <tt>MediaFormat</tt> should
* override the format if already mapped to a <tt>payloadType</tt>.
*
* @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<Byte, Byte> overridePTMappingMap = null;
if(overrideMapping)
overridePTMappingMap = new HashMap<Byte, Byte>();
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<Byte, Byte> overridePTMapping =
new HashMap<Byte, Byte>();
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;
}

@ -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 <tt>MediaFormat</tt> should
* override the format if already mapped to a <tt>payloadType</tt>.
*
* @throws OperationFailedException if we have a problem satisfying the
* description received in <tt>offer</tt> (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
* <tt>offer</tt>'s format or semantics.
*/
public void processOffer(List<ContentPacketExtension> offer,
boolean overrideMapping)
public void processOffer(List<ContentPacketExtension> offer)
throws OperationFailedException,
IllegalArgumentException
{
@ -252,23 +249,10 @@ public void processOffer(List<ContentPacketExtension> 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<Byte, Byte> overridePTMappingMap = null;
if(overrideMapping)
overridePTMappingMap = new HashMap<Byte, Byte>();
List<MediaFormat> remoteFormats
= JingleUtils.extractFormats(
description,
getDynamicPayloadTypes(),
overridePTMappingMap);
getDynamicPayloadTypes());
MediaDevice dev = getDefaultDevice(mediaType);
@ -383,14 +367,6 @@ public void processOffer(List<ContentPacketExtension> 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
* <tt>session-accept</tt>.
* @param overrideMapping will the supplied <tt>MediaFormat</tt> should
* override the format if already mapped to a <tt>payloadType</tt>.
*
* @return the last generated list of {@link ContentPacketExtension}s that
* the call peer could use to send a <tt>session-accept</tt>.
*
* @throws OperationFailedException if we fail to configure the media stream
*/
public Iterable<ContentPacketExtension> generateSessionAccept(
boolean overrideMapping)
public Iterable<ContentPacketExtension> generateSessionAccept()
throws OperationFailedException
{
TransportManagerJabberImpl transportManager = getTransportManager();
@ -520,26 +493,11 @@ public Iterable<ContentPacketExtension> 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<Byte, Byte> overridePTMapping = null;
if(overrideMapping)
overridePTMapping = new HashMap<Byte, Byte>();
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<ContentPacketExtension> 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<Byte, Byte> overridePTMapping =
new HashMap<Byte, Byte>();
List<MediaFormat> 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);
}
}
/**

@ -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);
}
}
}

@ -68,10 +68,6 @@ public static RtpDescriptionPacketExtension getRtpDescription(
* @param ptRegistry a reference to the <tt>DynamycPayloadTypeRegistry</tt>
* 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 <tt>MediaFormat</tt>s that are both advertised
* in the <tt>description</tt> and supported by our <tt>MediaService</tt>
@ -79,8 +75,7 @@ public static RtpDescriptionPacketExtension getRtpDescription(
*/
public static List<MediaFormat> extractFormats(
RtpDescriptionPacketExtension description,
DynamicPayloadTypeRegistry ptRegistry,
Map<Byte, Byte> overridePTMapping)
DynamicPayloadTypeRegistry ptRegistry)
{
List<MediaFormat> mediaFmts = new ArrayList<MediaFormat>();
List<PayloadTypePacketExtension> payloadTypes
@ -88,8 +83,7 @@ public static List<MediaFormat> 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<MediaFormat> extractFormats(
* use for the registration of possible dynamic payload types or
* <tt>null</tt> the returned <tt>MediaFormat</tt> is to not be registered
* into a <tt>DynamicPayloadTypeRegistry</tt>.
* @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 <tt>payloadType</tt>
* extension or <tt>null</tt> if we don't recognize the format.
*/
public static MediaFormat payloadTypeToMediaFormat(
PayloadTypePacketExtension payloadType,
DynamicPayloadTypeRegistry ptRegistry,
Map<Byte, Byte> 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
* <tt>null</tt> the returned <tt>MediaFormat</tt> is to not be registered
* into a <tt>DynamicPayloadTypeRegistry</tt>.
* @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 <tt>payloadType</tt>
* extension or <tt>null</tt> 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<Byte, Byte> 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;

@ -461,23 +461,8 @@ private Vector<MediaDescription> 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<Byte, Byte> overridePTMapping = null;
if(localSess != null)
overridePTMapping = new HashMap<Byte, Byte>();
List<MediaFormat> remoteFormats =
SdpUtils.extractFormats(
mediaDescription,
getDynamicPayloadTypes(),
overridePTMapping);
List<MediaFormat> 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<Byte, Byte> overridePTMapping =
new HashMap<Byte, Byte>();
List<MediaFormat> supportedFormats =
SdpUtils.extractFormats(
mediaDescription,
getDynamicPayloadTypes(),
overridePTMapping);
List<MediaFormat> 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);
}
}
}

@ -362,10 +362,6 @@ private static MediaDescription removeMediaDesc(
* @param ptRegistry a reference to the <tt>DynamycPayloadTypeRegistry</tt>
* 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 <tt>MediaFormat</tt>s that are both advertised
* in the <tt>mediaDesc</tt> description and supported by our
@ -374,8 +370,7 @@ private static MediaDescription removeMediaDesc(
@SuppressWarnings("unchecked")//legacy code from jain-sdp
public static List<MediaFormat> extractFormats(
MediaDescription mediaDesc,
DynamicPayloadTypeRegistry ptRegistry,
Map<Byte, Byte> overridePTMapping)
DynamicPayloadTypeRegistry ptRegistry)
{
List<MediaFormat> mediaFmts = new ArrayList<MediaFormat>();
Vector<String> formatStrings;
@ -471,42 +466,7 @@ public static List<MediaFormat> 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 <tt>payloadType</tt> is dynamic and <tt>rtpmap</tt> is
* <tt>null</tt> (in which case we can hope its in the registry).
* @param overrideMapping will the supplied <tt>MediaFormat</tt> should
* override the format if already mapped to a <tt>payloadType</tt>.
*
* @return a <tt>MediaForamt</tt> instance corresponding to the specified
* <tt>payloadType</tt> and <tt>rtpmap</tt>, and <tt>fmtp</tt> attributes
@ -710,8 +668,7 @@ private static MediaFormat createFormat(
Attribute fmtp,
float frameRate,
List<Attribute> 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;
}

@ -497,7 +497,8 @@ public List<String> 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;

@ -42,11 +42,18 @@ public class DynamicPayloadTypeRegistry
private final Map<MediaFormat, Byte> payloadTypeMappings
= new HashMap<MediaFormat, Byte>();
/**
* Maps locally defined payload types to payload type numbers that the
* remote party wants to use.
*/
private final Map<Byte, Byte> payloadTypeOverrides
= new HashMap<Byte, Byte>();
/**
* An override mappings of <tt>MediaFormat</tt> instances to the
* dynamic payload type numbers.
*/
private Map<Byte, String> overridePayloadTypeMappings = null;
private Map<Byte, String> localPayloadTypePreferences = null;
/**
* Payload types mapping from <tt>MediaService</tt>.
@ -58,9 +65,9 @@ public class DynamicPayloadTypeRegistry
*
* @param mappings the override payload-type mappings.
*/
public void setOverridePayloadTypeMappings(Map<Byte, String> mappings)
public void setLocalPayloadTypePreferences(Map<Byte, String> mappings)
{
overridePayloadTypeMappings = mappings;
localPayloadTypePreferences = mappings;
}
/**
@ -144,14 +151,14 @@ private Map<MediaFormat, Byte> 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<Byte, String> 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 <tt>format</tt> to <tt>payloadType</tt> 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 <tt>obtainPayloadTypeNumber</tt>
* instead.
@ -225,15 +236,11 @@ private Byte getPreferredDynamicPayloadType(MediaFormat format)
* to <tt>format</tt>.
* @param format the <tt>MediaFormat</tt> that we'd like to create a
* dynamic mapping for.
* @param overrideMapping will the supplied <tt>MediaFormat</tt> should
* override the format if already mapped to a <tt>payloadType</tt>.
*
* @throws IllegalArgumentException in case <tt>payloadType</tt> 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<MediaFormat, Byte> getMappings()
{
return new HashMap<MediaFormat, Byte>(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<Byte, Byte> getMappingOverrides()
{
return new HashMap<Byte, Byte>(payloadTypeOverrides);
}
}

@ -670,8 +670,9 @@ boolean processKeyFrameRequest(CallPeerMediaHandler<?> callPeerMediaHandler)
}
/**
* Registers all dynamic payload mappings known to this
* <tt>MediaHandler</tt> with the specified <tt>MediaStream</tt>.
* Registers all dynamic payload mappings and any payload type overrides
* that are known to this <tt>MediaHandler</tt> with the specified
* <tt>MediaStream</tt>.
*
* @param stream the <tt>MediaStream</tt> 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<MediaFormat, Byte> 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<Byte, Byte> overrideEntry
: dynamicPayloadTypes.getMappingOverrides().entrySet())
{
byte originalPt = overrideEntry.getKey();
byte overridePt = overrideEntry.getValue();
stream.addDynamicRTPPayloadTypeOverride(originalPt, overridePt);
}
}
/**

@ -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;

Loading…
Cancel
Save