private void handleUDPData(byte[] data) { VFHead head = VFHead.readBytes(BytesUtil.subBytes(data, 0, VFHead.LENGTH)); if (head.FrameOrder < curFrameOrder) { return; } if (head.FrameOrder > curFrameOrder) { curFrameOrder = head.FrameOrder; buffer = new FramePart[head.PartsNum]; isfull = new bool[head.PartsNum]; } if (buffer.Length != head.PartsNum) { return; } buffer[head.PartOrder] = new FramePart(BytesUtil.subBytes(data, VFHead.LENGTH)); isfull[head.PartOrder] = true; if (ifFull(isfull)) { videoFrameHandler.Invoke(BytesUtil.bytes2Bitmap(BytesUtil.FrameParts2Bytes(buffer))); } }
private void handleUDPData(byte[] data) { foreach (MySocket socket in tcpSockets) { ThreadPool.QueueUserWorkItem(new WaitCallback(send4ThreadPool), new Object4Send(data, socket)); } VFHead head = VFHead.readBytes(BytesUtil.subBytes(data, 0, VFHead.LENGTH)); if (head.FrameOrder < curFrameOrder) { return; } if (head.FrameOrder > curFrameOrder) { curFrameOrder = head.FrameOrder; buffer = new FramePart[head.PartsNum]; isfull = new bool[head.PartsNum]; } if (buffer.Length != head.PartsNum) { return; } buffer[head.PartOrder] = new FramePart(BytesUtil.subBytes(data, VFHead.LENGTH)); isfull[head.PartOrder] = true; if (ifFull(isfull)) { videoFrameHandler.Invoke(BytesUtil.bytes2Bitmap(BytesUtil.FrameParts2Bytes(buffer))); } }