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