Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
云逸之
SimpleVideoServer
提交
1948ace7
S
SimpleVideoServer
项目概览
云逸之
/
SimpleVideoServer
通知
704
Star
50
Fork
17
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SimpleVideoServer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1948ace7
编写于
8月 09, 2023
作者:
云逸之
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
支持65535个摄像头
上级
c416482a
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
22 addition
and
30 deletion
+22
-30
simpleVideoRecorder/src/simpleVideoRecorder.cpp
simpleVideoRecorder/src/simpleVideoRecorder.cpp
+9
-19
src/light-video.properties
src/light-video.properties
+1
-1
src/org/btik/server/video/UDP2Main.java
src/org/btik/server/video/UDP2Main.java
+1
-1
src/org/btik/server/video/device/udp2/NewUDPDeviceChannel.java
...rg/btik/server/video/device/udp2/NewUDPDeviceChannel.java
+4
-4
src/org/btik/server/video/device/udp2/bind/DeviceSnChannelBinder.java
.../server/video/device/udp2/bind/DeviceSnChannelBinder.java
+4
-3
src/org/btik/server/video/device/web/SoSendTimeoutTicker.java
...org/btik/server/video/device/web/SoSendTimeoutTicker.java
+3
-2
未找到文件。
simpleVideoRecorder/src/simpleVideoRecorder.cpp
浏览文件 @
1948ace7
...
...
@@ -26,7 +26,7 @@ const uint16_t localUdpPort = 2333;
LightUDP
streamSender
;
// 绑定sn后续为mac 作为sn 代表后续内容是SN 后一位是 6表示SN长度 空位的0 将填充mac
int
channel_index
=
-
1
;
uint8_t
channel_index
[
2
]
=
{
0
,
0
}
;
void
connectWifi
(
const
char
*
ssid
,
const
char
*
passphrase
)
{
...
...
@@ -101,11 +101,11 @@ void setup() {
WiFiClient
client
;
uint8_t
bind_sn
[]
=
{
'S'
,
'N'
,
':'
,
6
,
0
,
0
,
0
,
0
,
0
,
0
};
// 将mac设置到 bind_sn 第
3
位
// 将mac设置到 bind_sn 第
4
位
WiFi
.
macAddress
(
&
bind_sn
[
4
]);
Serial
.
printf
(
"MAC is:%02X%02X%02X%02X%02X%02X
\n
"
,
bind_sn
[
4
],
bind_sn
[
5
],
bind_sn
[
6
],
bind_sn
[
7
],
bind_sn
[
8
],
bind_sn
[
9
]);
int
index
;
int
length
;
do
{
while
(
!
client
.
connect
(
host
,
channelBindPort
))
{
log_i
(
"connection failed,wait 3 sec..."
);
...
...
@@ -115,13 +115,9 @@ void setup() {
client
.
write
(
bind_sn
,
10
);
client
.
flush
();
delay
(
3000
);
index
=
client
.
read
();
}
while
(
index
==
-
1
);
if
(
index
<=
255
)
{
channel_index
=
index
;
log_i
(
"channel_index is : %d "
,
channel_index
);
}
length
=
client
.
read
(
channel_index
,
2
);
}
while
(
length
==
-
1
);
log_i
(
"channel_index is : %d "
,
channel_index
[
1
]
|
(
static_cast
<
int
>
(
channel_index
[
0
])
<<
8
));
client
.
stop
();
streamSender
.
begin
(
WiFi
.
localIP
(),
localUdpPort
);
...
...
@@ -129,14 +125,7 @@ void setup() {
}
void
loop
()
{
// [[noreturn]] 不会执行return这里使用 goto回到行首
return_:
Serial
.
println
(
"do loop"
);
if
(
channel_index
==
-
1
)
{
log_i
(
"delay 3 sec"
);
delay
(
3000
);
goto
return_
;
}
camera_fb_t
*
fb
=
NULL
;
size_t
len
;
log_i
(
"send image"
);
...
...
@@ -148,8 +137,9 @@ void loop() {
break
;
}
len
=
fb
->
len
;
fb
->
buf
[
len
]
=
channel_index
;
streamSender
.
send
(
fb
->
buf
,
len
+
1
);
fb
->
buf
[
len
++
]
=
channel_index
[
0
];
fb
->
buf
[
len
++
]
=
channel_index
[
1
];
streamSender
.
send
(
fb
->
buf
,
len
);
esp_camera_fb_return
(
fb
);
}
}
\ No newline at end of file
src/light-video.properties
浏览文件 @
1948ace7
...
...
@@ -7,4 +7,4 @@ stream.bind.port=8004
frame.delay.skip.timeout
=
300
udp.video.buffer.pool.size
=
500
udp.video.dispatcher.thread.size
=
8
udp.video.channel.size
=
128
\ No newline at end of file
udp.video.channel.size
=
300
\ No newline at end of file
src/org/btik/server/video/UDP2Main.java
浏览文件 @
1948ace7
...
...
@@ -12,7 +12,7 @@ import java.io.IOException;
import
java.util.Properties
;
public
class
UDP2Main
{
private
static
final
String
version
=
"0.0.3.
1
"
;
private
static
final
String
version
=
"0.0.3.
2
"
;
static
Properties
properties
;
static
{
...
...
src/org/btik/server/video/device/udp2/NewUDPDeviceChannel.java
浏览文件 @
1948ace7
...
...
@@ -120,9 +120,9 @@ public class NewUDPDeviceChannel extends Thread implements DevChannel {
DatagramPacket
datagramPacket
=
new
DatagramPacket
(
frameBuffer
.
data
,
0
,
frameBuffer
.
data
.
length
);
while
(
runFlag
)
{
serverSocket
.
receive
(
datagramPacket
);
// 最后
一位是通道索引,故长度 -1
才是照片数据
frameBuffer
.
size
=
datagramPacket
.
getLength
()
-
1
;
frameBuffer
.
channelIndex
=
frameBuffer
.
data
[
frameBuffer
.
size
]
&
0xff
;
// 最后
二位是通道索引,故长度 -2
才是照片数据
frameBuffer
.
size
=
datagramPacket
.
getLength
()
-
2
;
frameBuffer
.
channelIndex
=
((
frameBuffer
.
data
[
frameBuffer
.
size
]
&
0xff
)
<<
8
)
|
(
frameBuffer
.
data
[
frameBuffer
.
size
+
1
]
&
0xff
)
;
frameBuffer
.
time
=
System
.
currentTimeMillis
();
frameDispatchers
[
frameBuffer
.
channelIndex
&
dispatcherPoolSize
-
1
].
messages
.
add
(
frameBuffer
);
// 切换缓冲区
...
...
@@ -208,7 +208,7 @@ public class NewUDPDeviceChannel extends Thread implements DevChannel {
System
.
arraycopy
(
snHexVal
,
0
,
snAddr
,
1
,
SN_LEN
);
VideoChannel
channel
=
videoServer
.
createChannel
(
snAddr
);
videoChannelTable
[
channelIndex
]
=
channel
;
if
(
channel
instanceof
SoSendCheckTarget
)
{
if
(
channel
instanceof
SoSendCheckTarget
)
{
soSendTimeoutTicker
.
registerChannel
(
channelIndex
,
(
SoSendCheckTarget
)
channel
);
}
}
...
...
src/org/btik/server/video/device/udp2/bind/DeviceSnChannelBinder.java
浏览文件 @
1948ace7
...
...
@@ -41,8 +41,8 @@ public class DeviceSnChannelBinder extends Thread {
public
DeviceSnChannelBinder
(
int
size
,
int
port
)
{
super
(
"UDPDeviceSnChannelBinder"
);
if
(
size
<
0
||
size
>
0xff
)
{
throw
new
IllegalArgumentException
(
"The count of channels can only be between 0~
25
5 "
);
if
(
size
<
0
||
size
>
0xff
ff
)
{
throw
new
IllegalArgumentException
(
"The count of channels can only be between 0~
6553
5 "
);
}
for
(
int
i
=
0
;
i
<
size
;
i
++)
{
channelIndexQueue
.
add
(
i
);
...
...
@@ -94,7 +94,8 @@ public class DeviceSnChannelBinder extends Thread {
}
OutputStream
outputStream
=
cam
.
getOutputStream
();
outputStream
.
write
(
index
);
outputStream
.
write
((
index
>>
8
)
&
0xff
);
outputStream
.
write
(
index
&
0xff
);
outputStream
.
flush
();
newUDPDeviceChannel
.
onNewChannelOpen
(
index
,
snBytes
);
}
catch
(
IOException
e
)
{
...
...
src/org/btik/server/video/device/web/SoSendTimeoutTicker.java
浏览文件 @
1948ace7
...
...
@@ -24,7 +24,7 @@ public class SoSendTimeoutTicker extends Thread {
private
int
timeout
=
300
;
private
final
SoSendCheckTarget
[]
checkTargets
;
private
SoSendCheckTarget
[]
checkTargets
;
public
void
setVideoChannelCount
(
int
videoChannelCount
)
{
this
.
videoChannelCount
=
Math
.
max
(
videoChannelCount
,
1
);
...
...
@@ -36,11 +36,12 @@ public class SoSendTimeoutTicker extends Thread {
public
SoSendTimeoutTicker
()
{
super
(
"SoSendTimeoutTicker"
);
checkTargets
=
new
SoSendCheckTarget
[
videoChannelCount
];
}
@Override
public
void
run
()
{
checkTargets
=
new
SoSendCheckTarget
[
videoChannelCount
];
while
(
runFlag
)
{
synchronized
(
lock
)
{
try
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录