提交 d14b4da5 编写于 作者: 云逸之's avatar 云逸之 💬

修复广域网ip不满位导致无法显示视频问题

上级 82d15652
......@@ -64,6 +64,5 @@ void LightUDP::send(uint8_t* buf, size_t len) {
sizeof(recipient));
if (sent < 0) {
Serial.printf("could not send data: %d\n", errno);
return;
}
}
\ No newline at end of file
package org.btik.server.util;
import java.io.IOException;
/**
* @author lustre
* @version 1.0
......@@ -89,6 +91,18 @@ public class ByteUtil {
return buf;
}
public static byte[] toFullHexString(long val) {
byte[] buf = new byte[8 << 1];
int charPos = buf.length;
int mask = 0xf;
do {
buf[--charPos] = LOW_DIGEST[((int) val) & mask];
val >>>= 4;
} while (charPos > 0);
return buf;
}
public static int getChars(long i, int index, byte[] buf) {
long q;
int r;
......
......@@ -121,29 +121,6 @@ public class NewUDPDeviceChannel extends Thread implements DevChannel {
return SN_LEN;
}
static class UDPDev {
byte[] frame;
int[] sizeTable;
VideoChannel videoChannel;
BufferPool bufferPool;
long address;
int segmentIndex = 0;
public UDPDev(byte[] frame, VideoChannel videoChannel, BufferPool bufferPool, long address) {
this.frame = frame;
this.sizeTable = new int[frame.length];
this.videoChannel = videoChannel;
this.address = address;
this.bufferPool = bufferPool;
}
}
class FrameDispatcher implements Runnable {
LinkedBlockingQueue<FrameBuffer> messages = new LinkedBlockingQueue<>();
......@@ -184,7 +161,7 @@ public class NewUDPDeviceChannel extends Thread implements DevChannel {
private void onNewStreamOpen(FrameBuffer frame) {
byte[] sn = new byte[SN_LEN + 1];
System.arraycopy(ByteUtil.toHexString(frame.address), 0, sn, 1, SN_LEN);
System.arraycopy(ByteUtil.toFullHexString(frame.address), 0, sn, 1, SN_LEN);
VideoChannel channel = videoServer.createChannel(sn);
videoChannelMap.put(frame.address, channel);
}
......
......@@ -62,7 +62,7 @@ public class BioHttpVideoServer extends Thread implements HttpConstant, VideoSer
while (runFlag) {
Socket client = serverSocket.accept();
InputStream inputStream = client.getInputStream();
client.setSoTimeout(300);
client.setSoTimeout(3000);
try {
if (inputStream.read(uri) < URI_LEN) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册