diff --git a/lib/installer-exclude/jml-1.0b2.jar b/lib/installer-exclude/jml-1.0b2.jar index 43321b944..50bf299f9 100644 Binary files a/lib/installer-exclude/jml-1.0b2.jar and b/lib/installer-exclude/jml-1.0b2.jar differ diff --git a/src/net/java/sip/communicator/impl/gui/PopupDialogImpl.java b/src/net/java/sip/communicator/impl/gui/PopupDialogImpl.java index 3526d3ab5..98cc54e3f 100644 --- a/src/net/java/sip/communicator/impl/gui/PopupDialogImpl.java +++ b/src/net/java/sip/communicator/impl/gui/PopupDialogImpl.java @@ -174,7 +174,9 @@ else if (messageType == PopupDialog.WARNING_MESSAGE) type = JOptionPane.PLAIN_MESSAGE; } - ImageIcon imageIcon = new ImageIcon(icon); + ImageIcon imageIcon = null; + if(icon != null) + imageIcon = new ImageIcon(icon); return showInputDialog(null, message, title, type, imageIcon, selectionValues, initialSelectionValue); @@ -264,7 +266,9 @@ else if (messageType == PopupDialog.WARNING_MESSAGE) type = JOptionPane.PLAIN_MESSAGE; } - ImageIcon imageIcon = new ImageIcon(icon); + ImageIcon imageIcon = null; + if(icon != null) + imageIcon = new ImageIcon(icon); showMessageDialog(null, message, title, type, imageIcon); } @@ -431,7 +435,9 @@ else if (messageType == PopupDialog.WARNING_MESSAGE) msgType = JOptionPane.PLAIN_MESSAGE; } - ImageIcon imageIcon = new ImageIcon(icon); + ImageIcon imageIcon = null; + if(icon != null) + imageIcon = new ImageIcon(icon); return showConfirmDialog(null, message, title, optType, msgType, imageIcon); diff --git a/src/net/java/sip/communicator/impl/media/codec/video/h264/H264Parser.java b/src/net/java/sip/communicator/impl/media/codec/video/h264/H264Parser.java index 6d462861b..759eaabe8 100644 --- a/src/net/java/sip/communicator/impl/media/codec/video/h264/H264Parser.java +++ b/src/net/java/sip/communicator/impl/media/codec/video/h264/H264Parser.java @@ -7,22 +7,22 @@ /** * Parses H264 rtp headers and extracts the data in the format * the decoder expects it. RFC3984. - * + * * @author Damian Minkov */ public class H264Parser { private final Logger logger = Logger.getLogger(H264Parser.class); - + // allocate enough space for the incoming data private static final int MAX_FRAME_SIZE = 128 * 1024; - + // every NAL starts with this start sequence private static final byte[] startSequence = { 0, 0, 1}; - + // the timestamp of the last received rtp packet private long lastTimestamp = -1; - + // the result data is collected in this buffer private byte[] encodedFrame = new byte[MAX_FRAME_SIZE]; // the size of the result data @@ -37,9 +37,9 @@ public boolean pushRTPInput(Buffer inputBuffer) { long currentStamp = inputBuffer.getTimeStamp(); - // the rtp marker field points that this is the last packet of + // the rtp marker field points that this is the last packet of // the received frame - boolean hasMarker = + boolean hasMarker = (inputBuffer.getFlags() & Buffer.FLAG_RTP_MARKER) != 0; // if the timestamp changes we are starting receiving a new frame @@ -93,11 +93,11 @@ else if (type == 28) * Extract data from FU packet. This are packets across several rtp packets, * the first has a start bit set, we store all data and don't care about end * bit. - * + * * @param nal * @param inputBuffer */ - private void deencapsulateFU (byte nal, Buffer inputBuffer) + private void deencapsulateFU (byte nal, Buffer inputBuffer) { byte[] buf = (byte[])inputBuffer.getData(); int len = inputBuffer.getLength(); @@ -114,7 +114,7 @@ private void deencapsulateFU (byte nal, Buffer inputBuffer) byte reconstructed_nal; //reconstruct this packet's true nal; only the data follows.. //the original nal forbidden bit and NRI are stored in this packet's nal; - reconstructed_nal = (byte)(fu_indicator & (byte)0xe0); + reconstructed_nal = (byte)(fu_indicator & (byte)0xe0); reconstructed_nal |= nal_type; // skip the fu_header... diff --git a/src/net/java/sip/communicator/impl/media/codec/video/h264/NativeDecoder.java b/src/net/java/sip/communicator/impl/media/codec/video/h264/NativeDecoder.java index d33fbedf7..328048e07 100644 --- a/src/net/java/sip/communicator/impl/media/codec/video/h264/NativeDecoder.java +++ b/src/net/java/sip/communicator/impl/media/codec/video/h264/NativeDecoder.java @@ -73,6 +73,11 @@ public class NativeDecoder // current width of video, so we can detect changes in video size private double currentVideoWidth; + // keep track of last received sequence in order to avoid inconsistent data + private long lastReceivedSeq = -1; + // in case of inconsistent data drop all data till a marker is received + private boolean waitingForMarker = false; + /** * Constructs new h264 decoder */ @@ -204,7 +209,7 @@ public void close() if (opened) { opened = false; - synchronized (AVCODEC) + synchronized (this) { super.close(); @@ -216,8 +221,6 @@ public void close() } } - long lastReceivedSeq = -1; - public int process(Buffer inputBuffer, Buffer outputBuffer) { if (!checkInputBuffer(inputBuffer)) @@ -238,15 +241,28 @@ public int process(Buffer inputBuffer, Buffer outputBuffer) return BUFFER_PROCESSED_OK; } + if(waitingForMarker) + { + lastReceivedSeq = inputBuffer.getSequenceNumber(); + if((inputBuffer.getFlags() & Buffer.FLAG_RTP_MARKER) != 0) + { + waitingForMarker = false; + outputBuffer.setDiscard(true); + return BUFFER_PROCESSED_OK; + } + else + return OUTPUT_BUFFER_NOT_FILLED; + } + if(lastReceivedSeq != -1 && inputBuffer.getSequenceNumber() - lastReceivedSeq > 1) { + long oldRecv = lastReceivedSeq; lastReceivedSeq = inputBuffer.getSequenceNumber(); - logger.trace("DROP rtp data!"); + waitingForMarker = true; + logger.trace("DROP rtp data! " + oldRecv + "/" + lastReceivedSeq); parser.reset(); - inputBuffer.setDiscard(true); - outputBuffer.setDiscard(true); reset(); - return BUFFER_PROCESSED_OK; + return OUTPUT_BUFFER_NOT_FILLED; } else if(!parser.pushRTPInput(inputBuffer)) { @@ -261,22 +277,22 @@ else if(!parser.pushRTPInput(inputBuffer)) Pointer encBuf = AVUTIL.av_malloc(parser.getEncodedFrameLen()); arraycopy(parser.getEncodedFrame(), 0, encBuf, 0, parser.getEncodedFrameLen()); - synchronized (AVCODEC) + synchronized (this) { // decodes the data AVCODEC.avcodec_decode_video( avcontext, avpicture, got_picture, encBuf, parser.getEncodedFrameLen()); - if(currentVideoWidth != avcontext.width) + if(avcontext.width != 0 && currentVideoWidth != avcontext.width) { currentVideoWidth = avcontext.width; VideoFormat format = getVideoFormat(currentVideoWidth); if(format != null) { - outputBuffer.setFormat(format); outputFormat = format; } } + outputBuffer.setFormat(outputFormat); if(got_picture.getValue() == 0) {