aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEmil Ivov <emcho@jitsi.org>2011-03-09 09:06:36 +0000
committerEmil Ivov <emcho@jitsi.org>2011-03-09 09:06:36 +0000
commitdcb607dd8b10f297af6a590e29a7b9b6f6002aff (patch)
tree2fdfc22aaf0d40ed22ef383803c56a68689ec554
parent2335a598e8e6ae8b245c7b818a8a37f7c7ffc9eb (diff)
downloadjitsi-dcb607dd8b10f297af6a590e29a7b9b6f6002aff.zip
jitsi-dcb607dd8b10f297af6a590e29a7b9b6f6002aff.tar.gz
jitsi-dcb607dd8b10f297af6a590e29a7b9b6f6002aff.tar.bz2
Adds proper handling for unsupported media types in SDP offers/answers. Bug reported on dev by Jose Sanchez (media type "text") and z___al (media type "image").
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandlerSipImpl.java31
-rw-r--r--src/net/java/sip/communicator/impl/protocol/sip/sdp/SdpUtils.java8
2 files changed, 33 insertions, 6 deletions
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 09fc0d8..6343ac8 100644
--- a/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandlerSipImpl.java
+++ b/src/net/java/sip/communicator/impl/protocol/sip/CallPeerMediaHandlerSipImpl.java
@@ -359,7 +359,18 @@ public class CallPeerMediaHandlerSipImpl
for (MediaDescription mediaDescription : remoteDescriptions)
{
- MediaType mediaType = SdpUtils.getMediaType(mediaDescription);
+ MediaType mediaType = null;
+ try
+ {
+ mediaType = SdpUtils.getMediaType(mediaDescription);
+ }
+ catch (IllegalArgumentException iae)
+ {
+ //remote party offers a stream of a type that we don't support.
+ //we'll disable it and move on.
+ answerDescriptions.add(
+ SdpUtils.createDisablingAnswer(mediaDescription));
+ }
List<MediaFormat> remoteFormats = SdpUtils.extractFormats(
mediaDescription, getDynamicPayloadTypes());
@@ -523,10 +534,22 @@ public class CallPeerMediaHandlerSipImpl
for ( MediaDescription mediaDescription : remoteDescriptions)
{
- MediaType mediaType = SdpUtils.getMediaType(mediaDescription);
+ MediaType mediaType;
+ try
+ {
+ mediaType = SdpUtils.getMediaType(mediaDescription);
+ }
+ catch(IllegalArgumentException iae)
+ {
+ logger.info("Remote party added to answer a media type that " +
+ "we don't understand. Ignoring stream.");
+ continue;
+ }
+
//stream target
MediaStreamTarget target
= SdpUtils.extractDefaultTarget(mediaDescription, answer);
+
// not target port - try next media description
if(target.getDataAddress().getPort() == 0)
{
@@ -556,7 +579,9 @@ public class CallPeerMediaHandlerSipImpl
{
//remote party must have messed up our SDP. throw an exception.
ProtocolProviderServiceSipImpl.throwOperationFailedException(
- "Remote party sent an invalid SDP answer.",
+ "Remote party sent an invalid SDP answer. The codecs in " +
+ "the answer are either not present or not " +
+ "supported",
OperationFailedException.ILLEGAL_ARGUMENT, null, logger);
}
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 44028b5..e9cf637 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
@@ -1528,9 +1528,10 @@ public class SdpUtils
MediaDescription offer)
throws IllegalArgumentException
{
- MediaType type = getMediaType(offer);
try
{
+ String mediaType = offer.getMedia().getMediaType();
+
Vector<String> formatsVec = offer.getMedia().getMediaFormats(true);
if(formatsVec == null)
@@ -1543,12 +1544,13 @@ public class SdpUtils
String[] formatsArray = new String[formatsVec.size()];
- return sdpFactory.createMediaDescription(type.toString(), 0, 1,
+ return sdpFactory.createMediaDescription(mediaType, 0, 1,
SdpConstants.RTP_AVP, formatsVec.toArray(formatsArray));
}
catch (Exception e)
{
- throw new IllegalArgumentException("Could not create an ");
+ throw new IllegalArgumentException("Could not create a disabling " +
+ "answer", e);
}
}