Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
云逸之
SimpleVideoServer
提交
ce8bc5ee
S
SimpleVideoServer
项目概览
云逸之
/
SimpleVideoServer
通知
685
Star
47
Fork
14
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SimpleVideoServer
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
ce8bc5ee
编写于
8月 28, 2022
作者:
云逸之
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
修改启动的主类
上级
d14b4da5
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
25 addition
and
31 deletion
+25
-31
src/org/btik/server/util/ByteUtil.java
src/org/btik/server/util/ByteUtil.java
+0
-2
src/org/btik/server/video/device/udp2/NewUDPDeviceChannel.java
...rg/btik/server/video/device/udp2/NewUDPDeviceChannel.java
+0
-1
src/org/btik/server/video/device/web/MJPEGVideoChannel.java
src/org/btik/server/video/device/web/MJPEGVideoChannel.java
+23
-26
src/run.bat
src/run.bat
+1
-1
src/run.sh
src/run.sh
+1
-1
未找到文件。
src/org/btik/server/util/ByteUtil.java
浏览文件 @
ce8bc5ee
package
org.btik.server.util
;
import
java.io.IOException
;
/**
* @author lustre
* @version 1.0
...
...
src/org/btik/server/video/device/udp2/NewUDPDeviceChannel.java
浏览文件 @
ce8bc5ee
...
...
@@ -5,7 +5,6 @@ import org.btik.server.util.ByteUtil;
import
org.btik.server.util.NamePrefixThreadFactory
;
import
org.btik.server.video.device.iface.DevChannel
;
import
org.btik.server.video.device.iface.VideoChannel
;
import
org.btik.server.video.device.task.AsyncTaskExecutor
;
import
java.io.IOException
;
...
...
src/org/btik/server/video/device/web/MJPEGVideoChannel.java
浏览文件 @
ce8bc5ee
...
...
@@ -28,8 +28,6 @@ public class MJPEGVideoChannel implements VideoChannel, HttpConstant {
private
final
Set
<
Socket
>
clients
=
Collections
.
newSetFromMap
(
new
ConcurrentHashMap
<>());
private
final
byte
[]
clientLock
=
new
byte
[
0
];
public
MJPEGVideoChannel
(
String
channelId
,
AsyncTaskExecutor
asyncTaskExecutor
)
{
this
.
asyncTaskExecutor
=
asyncTaskExecutor
;
this
.
channelId
=
channelId
;
...
...
@@ -40,23 +38,21 @@ public class MJPEGVideoChannel implements VideoChannel, HttpConstant {
public
void
sendFrame
(
byte
[]
frame
,
int
len
)
{
byte
[]
lenStrBytes
=
ByteUtil
.
toString
(
len
);
byte
[]
lenHexStrBytes
=
ByteUtil
.
toHexString
(
len
);
synchronized
(
clientLock
)
{
for
(
Socket
client
:
clients
)
{
try
{
OutputStream
outputStream
=
client
.
getOutputStream
();
sendChunk
(
_STREAM_BOUNDARY
,
outputStream
);
sendChunk
(
outputStream
,
_STREAM_PART
,
lenStrBytes
,
DOUBLE_LINE
);
sendChunk
(
frame
,
len
,
lenHexStrBytes
,
outputStream
);
outputStream
.
flush
();
}
catch
(
IOException
e
)
{
checkState
(
client
,
e
);
}
for
(
Socket
client
:
clients
)
{
try
{
OutputStream
outputStream
=
client
.
getOutputStream
();
sendChunk
(
_STREAM_BOUNDARY
,
outputStream
);
sendChunk
(
outputStream
,
_STREAM_PART
,
lenStrBytes
,
DOUBLE_LINE
);
sendChunk
(
frame
,
len
,
lenHexStrBytes
,
outputStream
);
outputStream
.
flush
();
}
catch
(
IOException
e
)
{
checkState
(
client
,
e
);
}
}
}
static
long
l
=
System
.
currentTimeMillis
();
}
@Override
public
void
sendFrame
(
byte
[][]
frame
,
int
[]
len
,
int
segmentCount
)
{
...
...
@@ -65,20 +61,20 @@ public class MJPEGVideoChannel implements VideoChannel, HttpConstant {
allLen
+=
len
[
i
];
}
byte
[]
lenStrBytes
=
ByteUtil
.
toString
(
allLen
);
synchronized
(
clientLock
)
{
for
(
Socket
client
:
clients
)
{
try
{
OutputStream
outputStream
=
client
.
getOutputStream
();
sendChunk
(
_STREAM_BOUNDARY
,
outputStream
);
sendChunk
(
outputStream
,
_STREAM_PART
,
lenStrBytes
,
DOUBLE_LINE
);
sendChunk
(
outputStream
,
allLen
,
len
,
frame
);
outputStream
.
flush
();
}
catch
(
IOException
e
)
{
checkState
(
client
,
e
);
}
for
(
Socket
client
:
clients
)
{
try
{
OutputStream
outputStream
=
client
.
getOutputStream
();
sendChunk
(
_STREAM_BOUNDARY
,
outputStream
);
sendChunk
(
outputStream
,
_STREAM_PART
,
lenStrBytes
,
DOUBLE_LINE
);
sendChunk
(
outputStream
,
allLen
,
len
,
frame
);
outputStream
.
flush
();
}
catch
(
IOException
e
)
{
checkState
(
client
,
e
);
}
}
}
/**
...
...
@@ -151,6 +147,7 @@ public class MJPEGVideoChannel implements VideoChannel, HttpConstant {
try
{
System
.
err
.
println
(
"close:"
+
socket
.
getRemoteSocketAddress
());
socket
.
close
();
clients
.
remove
(
socket
);
}
catch
(
IOException
e0
)
{
System
.
err
.
println
(
e
.
getMessage
());
}
...
...
src/run.bat
浏览文件 @
ce8bc5ee
.\jre\bin\java
-classpath
SimpleVideoServer
org
.btik.server.video.UDPMain
\ No newline at end of file
.\jre\bin\java
-classpath
SimpleVideoServer
org
.btik.server.video.UDP2Main
\ No newline at end of file
src/run.sh
浏览文件 @
ce8bc5ee
./jre/bin/java
-classpath
SimpleVideoServer org.btik.server.video.UDPMain
\ No newline at end of file
./jre/bin/java
-classpath
SimpleVideoServer org.btik.server.video.UDP2Main
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录