Handles unsupported 'data' media type when processing jingle offer.

sipgateway
paweldomas 12 years ago
parent c0c8d8d1ab
commit 93305496ff

@ -1469,7 +1469,7 @@ private void processContent(
RtpDescriptionPacketExtension description
= JingleUtils.getRtpDescription(content);
MediaType mediaType
= MediaType.parseString(description.getMedia());
= JingleUtils.getMediaType(content);
//stream target
TransportManagerJabberImpl transportManager = getTransportManager();
@ -1666,7 +1666,7 @@ public void processOffer(List<ContentPacketExtension> offer)
RtpDescriptionPacketExtension description
= JingleUtils.getRtpDescription(content);
MediaType mediaType
= MediaType.parseString( description.getMedia() );
= JingleUtils.getMediaType(content);
List<MediaFormat> remoteFormats
= JingleUtils.extractFormats(

@ -890,15 +890,23 @@ protected synchronized boolean startConnectivityEstablishment(
if (iceAgentStateIsRunning && (candidates.size() == 0))
return false;
String media = e.getKey();
IceMediaStream stream = iceAgent.getStream(media);
if (stream == null)
{
logger.warn(
"No ICE media stream for media: " + media
+ " - ignored candidates.");
continue;
}
// Sort the remote candidates (host < reflexive < relayed) in order
// to create first the host, then the reflexive, the relayed
// candidates and thus be able to set the relative-candidate
// matching the rel-addr/rel-port attribute.
Collections.sort(candidates);
String media = e.getKey();
IceMediaStream stream = iceAgent.getStream(media);
// Different stream may have different ufrag/password
String ufrag = transport.getUfrag();

@ -15,9 +15,11 @@
import net.java.sip.communicator.impl.protocol.jabber.extensions.jingle.ContentPacketExtension.SendersEnum;
import net.java.sip.communicator.service.protocol.media.*;
import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.Logger;
import org.jitsi.service.neomedia.*;
import org.jitsi.service.neomedia.format.*;
import org.jitsi.util.*;
/**
* The class contains a number of utility methods that are meant to facilitate
@ -77,6 +79,12 @@ public static List<MediaFormat> extractFormats(
DynamicPayloadTypeRegistry ptRegistry)
{
List<MediaFormat> mediaFmts = new ArrayList<MediaFormat>();
if (description == null)
{
return mediaFmts;
}
List<PayloadTypePacketExtension> payloadTypes
= description.getPayloadTypes();
@ -234,6 +242,11 @@ public static List<RTPExtension> extractRTPExtensions(
{
List<RTPExtension> extensionsList = new ArrayList<RTPExtension>();
if (desc == null)
{
return extensionsList;
}
List<RTPHdrExtPacketExtension> extmapList = desc.getExtmapList();
for (RTPHdrExtPacketExtension extmap : extmapList)
@ -649,15 +662,31 @@ public static MediaType getMediaType(ContentPacketExtension content)
{
if (content == null)
return null;
// We will use content name for determining media type
// if no RTP description is present(SCTP connection case)
String mediaTypeName = content.getName();
RtpDescriptionPacketExtension desc = getRtpDescription(content);
if (desc != null)
{
String mediaTypeStr = desc.getMedia();
if (mediaTypeStr != null)
return MediaType.parseString(mediaTypeStr);
String rtpMedia = desc.getMedia();
if (!StringUtils.isNullOrEmpty(rtpMedia))
{
mediaTypeName = rtpMedia;
}
}
return null;
// SDP:
// 'm=application SCTP/DTLS'
// ...
// 'a=mid:data'
// is used for SCTP connection in Jitsi Meet
// which translates to RtpDescriptionPacketExtension#media
if ("application".equals(mediaTypeName))
{
return MediaType.DATA;
}
return MediaType.parseString(mediaTypeName);
}
}

@ -611,6 +611,8 @@ protected MediaDirection getDirectionUserPreference(MediaType mediaType)
return audioDirectionUserPreference;
case VIDEO:
return videoDirectionUserPreference;
case DATA:
return MediaDirection.INACTIVE;
default:
throw new IllegalArgumentException("mediaType");
}
@ -655,7 +657,10 @@ public SrtpControl getEncryptionMethod(MediaType mediaType)
*/
protected List<RTPExtension> getExtensionsForType(MediaType type)
{
return getDefaultDevice(type).getSupportedExtensions();
MediaDevice device = getDefaultDevice(type);
return device != null
? device.getSupportedExtensions()
: new ArrayList<RTPExtension>();
}
/**

Loading…
Cancel
Save