Fix wrong negociation of video size with SDP.

cusax-fix
Sebastien Vincent 16 years ago
parent 7393be5cfb
commit d7b9dc0142

@ -111,6 +111,8 @@ public class AudioMediaFormatImpl
* <tt>AudioMediaFormatImpl</tt> instance
* @param formatParameters any codec-specific parameters that have been
* received via SIP/SDP or XMPP/Jingle.
* @param advancedParameters set of advanced parameters that have been
* received by SIP/SDP or XMPP/Jingle
*/
AudioMediaFormatImpl(
String encoding,

@ -285,6 +285,8 @@ public MediaFormat createMediaFormat(
* <tt>encoding</tt>; otherwise, ignored
* @param formatParams any codec specific parameters which have been
* received via SIP/SDP or XMPP/Jingle
* @param advancedParams any parameters which have been
* received via SIP/SDP or XMPP/Jingle
* @return a <tt>MediaFormat</tt> with the specified <tt>encoding</tt>,
* <tt>clockRate</tt>, <tt>channels</tt> and set of format parameters which
* is either an <tt>AudioMediaFormat</tt> or a <tt>VideoMediaFormat</tt>

@ -101,6 +101,7 @@ public class VideoMediaFormatImpl
* instance
* @param formatParameters the set of format-specific parameters of the new
* instance
* @param advancedParameters set of advanced parameters of the new instance
*/
VideoMediaFormatImpl(
VideoFormat format,

@ -1129,6 +1129,58 @@ private SessionDescription processUpdateOffer(
return localSess;
}
/**
* Get the advanced format parameters list of our device that match
* remote supported ones.
*
* @param remoteFormats remote advanced format parameters found in the
* SDP message
* @param localFormats local advanced format parameters of our device
* @return intersection between our local advanced parameters and remote
* advanced parameters
*/
private List<MediaFormat> getAdvancedFormatParameters(
List<MediaFormat> remoteFormats, List<MediaFormat> localFormats )
{
List<MediaFormat> ret = new ArrayList<MediaFormat>();
for(MediaFormat format : remoteFormats)
{
MediaFormat mf = findMediaFormat(localFormats,
format.getEncoding());
if(mf != null)
{
ret.add(mf);
}
}
return ret;
}
/**
* Find a <tt>MediaFormat</tt> specified by its encoding in the list of
* <tt>MediaFormat</tt>.
*
* @param formats list of <tt>MediaFormat</tt>
* @param encoding encoding of the <tt>MediaFormat</tt> to find
* @return <tt>MediaFormat</tt> if found in list of formats, null
* otherwise
*/
private MediaFormat findMediaFormat(List<MediaFormat> formats,
String encoding)
{
for(MediaFormat f : formats)
{
if(f.getEncoding().equals(encoding))
{
return f;
}
}
return null;
}
/**
* Creates a number of <tt>MediaDescription</tt>s answering the descriptions
* offered by the specified <tt>offer</tt> and reflecting the state of this
@ -1171,6 +1223,11 @@ private Vector<MediaDescription> createMediaDescriptionsForAnswer(
MediaDirection devDirection
= (dev == null) ? MediaDirection.INACTIVE : dev.getDirection();
/* intersect the MediaFormat of our device with remote ones */
List<MediaFormat> supportedAdvancedParameters =
getAdvancedFormatParameters(supportedFormats,
dev.getSupportedFormats());
// Take the preference of the user with respect to streaming
// mediaType into account.
devDirection
@ -1220,7 +1277,7 @@ private Vector<MediaDescription> createMediaDescriptionsForAnswer(
// create the answer description
answerDescriptions.add(createMediaDescription(
dev.getFormat(),
supportedFormats, connector,
supportedAdvancedParameters, connector,
direction, rtpExtensions));
atLeastOneValidDescription = true;

@ -16,7 +16,6 @@
import net.java.sip.communicator.impl.protocol.sip.*;
import net.java.sip.communicator.service.neomedia.*;
import net.java.sip.communicator.service.neomedia.device.*;
import net.java.sip.communicator.service.neomedia.format.*;
import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*;

Loading…
Cancel
Save