Fix various exceptions (no display, no device set), Fix 80 lines.

cusax-fix
Sebastien Vincent 16 years ago
parent 5f960182ed
commit f9dc147f3f

@ -484,6 +484,18 @@ public ZrtpControl createZrtpControl()
*/
public java.awt.Dimension getScreenSize()
{
return java.awt.Toolkit.getDefaultToolkit().getScreenSize();
java.awt.Dimension res = null;
try
{
res = java.awt.Toolkit.getDefaultToolkit().getScreenSize();
res = null;
}
catch(NoClassDefFoundError e)
{
return null;
}
return res;
}
}

@ -188,7 +188,9 @@ protected void setFormat(Processor processor, Format format)
*/
if(outputSize != null)
{
newFormat = new VideoFormat(tmp.getEncoding(), outputSize, tmp.getMaxDataLength(), tmp.getDataType(), tmp.getFrameRate());
newFormat = new VideoFormat(tmp.getEncoding(), outputSize,
tmp.getMaxDataLength(), tmp.getDataType(),
tmp.getFrameRate());
}
super.setFormat(processor, newFormat != null ? newFormat : format);

@ -375,7 +375,8 @@ public void setLocalVideoTransmissionEnabled(boolean enabled)
newValue = videoDirectionUserPreference;
firePropertyChange(OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING, oldValue, newValue);
firePropertyChange(OperationSetVideoTelephony.LOCAL_VIDEO_STREAMING,
oldValue, newValue);
}
/**
@ -831,14 +832,19 @@ private MediaStream initStream(StreamConnector connector,
else
{
stream = this.videoStream;
Dimension deviceSize = ((VideoMediaFormat)device.getFormat()).getSize();
if((deviceSize != null && maxRecvSize != null) &&
(maxRecvSize.width > 0 && maxRecvSize.height > 0) &&
(deviceSize.width > maxRecvSize.width ||
deviceSize.height > maxRecvSize.height))
if(device != null && device.getFormat() != null)
{
size = maxRecvSize;
Dimension deviceSize = ((VideoMediaFormat)device.getFormat())
.getSize();
if((deviceSize != null && maxRecvSize != null) &&
(maxRecvSize.width > 0 && maxRecvSize.height > 0) &&
(deviceSize.width > maxRecvSize.width ||
deviceSize.height > maxRecvSize.height))
{
size = maxRecvSize;
}
}
}
@ -1433,7 +1439,8 @@ private void processAnswer(SessionDescription answer)
= devDirection.getDirectionForAnswer(remoteDirection);
/* extract remote peer maximum supported resolution */
Dimension res[] = SdpUtils.extractSendRecvResolution(mediaDescription);
Dimension res[] = SdpUtils.extractSendRecvResolution(
mediaDescription);
if(res != null)
{
maxSendSize = res[0];

@ -325,8 +325,10 @@ public static java.awt.Dimension[] extractSendRecvResolution(
int len = 0;
Pattern pSendSingle = Pattern.compile("send \\[x=[0-9]+,y=[0-9]+\\]");
Pattern pRecvSingle = Pattern.compile("recv \\[x=[0-9]+,y=[0-9]+\\]");
Pattern pSendRange = Pattern.compile("send \\[x=\\[[0-9]+-[0-9]+\\],y=\\[[0-9]+-[0-9]+\\]\\]");
Pattern pRecvRange = Pattern.compile("recv \\[x=\\[[0-9]+-[0-9]+\\],y=\\[[0-9]+-[0-9]+\\]\\]");
Pattern pSendRange = Pattern.compile(
"send \\[x=\\[[0-9]+-[0-9]+\\],y=\\[[0-9]+-[0-9]+\\]\\]");
Pattern pRecvRange = Pattern.compile(
"recv \\[x=\\[[0-9]+-[0-9]+\\],y=\\[[0-9]+-[0-9]+\\]\\]");
Pattern pNumeric = Pattern.compile("[0-9]+");
Matcher mSingle = null;
Matcher mRange = null;
@ -1356,7 +1358,8 @@ public static MediaDescription createMediaDescription(
* basically peer can send any size and can
* receive image size up to its display screen size
*/
java.awt.Dimension screen = SipActivator.getMediaService().getScreenSize();
java.awt.Dimension screen = SipActivator.getMediaService().
getScreenSize();
Attribute imgattr = createImageAttribute((byte)0, vformat, screen);
mediaAttributes.add(imgattr);
}
@ -1494,11 +1497,22 @@ else if(MediaDirection.SENDRECV.equals(direction))
* @param maxRecvSize maximum size peer can display
* @return image <tt>Attribute</tt>
*/
private static Attribute createImageAttribute(byte payloadType, VideoMediaFormat format, java.awt.Dimension maxRecvSize)
private static Attribute createImageAttribute(byte payloadType,
VideoMediaFormat format, java.awt.Dimension maxRecvSize)
{
StringBuffer img = new StringBuffer("imageattr:");
java.awt.Dimension maxSendSize = format.getMaximumSize();
java.awt.Dimension minSendSize = format.getMinimumSize();
java.awt.Dimension maxSendSize = null;
java.awt.Dimension minSendSize = null;
if(format != null)
{
minSendSize = format.getMinimumSize();
maxSendSize = format.getMaximumSize();
}
else
{
maxSendSize = null;
}
if(payloadType != 0)
{

Loading…
Cancel
Save