Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
Z
ZLMediaKit
概览
Overview
Details
Activity
Cycle Analytics
版本库
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
问题
0
Issues
0
列表
Board
标记
里程碑
合并请求
0
Merge Requests
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
Snippets
成员
Collapse sidebar
Close sidebar
活动
图像
聊天
创建新问题
作业
提交
Issue Boards
Open sidebar
张翔宇
ZLMediaKit
Commits
43164d36
Commit
43164d36
authored
4 years ago
by
ziyue
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
68926b4a
b90ebf65
显示空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
17 行增加
和
4 行删除
+17
-4
src/Http/HttpTSPlayer.cpp
+4
-0
src/Http/HttpTSPlayer.h
+1
-0
src/Record/MP4Recorder.cpp
+12
-4
没有找到文件。
src/Http/HttpTSPlayer.cpp
查看文件 @
43164d36
...
...
@@ -20,6 +20,7 @@ HttpTSPlayer::HttpTSPlayer(const EventPoller::Ptr &poller, bool split_ts){
HttpTSPlayer
::~
HttpTSPlayer
()
{}
int64_t
HttpTSPlayer
::
onResponseHeader
(
const
string
&
status
,
const
HttpClient
::
HttpHeader
&
headers
)
{
_status
=
status
;
if
(
status
!=
"200"
&&
status
!=
"206"
)
{
//http状态码不符合预期
shutdown
(
SockException
(
Err_other
,
StrPrinter
<<
"bad http status code:"
+
status
));
...
...
@@ -35,6 +36,9 @@ int64_t HttpTSPlayer::onResponseHeader(const string &status, const HttpClient::H
}
void
HttpTSPlayer
::
onResponseBody
(
const
char
*
buf
,
int64_t
size
,
int64_t
recvedSize
,
int64_t
totalSize
)
{
if
(
_status
!=
"200"
&&
_status
!=
"206"
)
{
return
;
}
if
(
recvedSize
==
size
)
{
//开始接收数据
if
(
buf
[
0
]
==
TS_SYNC_BYTE
)
{
...
...
This diff is collapsed.
Click to expand it.
src/Http/HttpTSPlayer.h
查看文件 @
43164d36
...
...
@@ -48,6 +48,7 @@ private:
bool
_is_first_packet_ts
=
false
;
//是否判断是否是ts并split
bool
_split_ts
;
string
_status
;
TSSegment
_segment
;
onShutdown
_on_disconnect
;
TSSegment
::
onSegment
_on_segment
;
...
...
This diff is collapsed.
Click to expand it.
src/Record/MP4Recorder.cpp
查看文件 @
43164d36
...
...
@@ -11,6 +11,7 @@
#ifdef ENABLE_MP4
#include <ctime>
#include <sys/stat.h>
#include "Util/File.h"
#include "Common/config.h"
#include "MP4Recorder.h"
#include "Thread/WorkThreadPool.h"
...
...
@@ -77,12 +78,19 @@ void MP4Recorder::asyncClose() {
const_cast
<
RecordInfo
&>
(
info
).
time_len
=
::
time
(
NULL
)
-
info
.
start_time
;
//关闭mp4非常耗时,所以要放在后台线程执行
muxer
->
closeMP4
();
//临时文件名改成正式文件名,防止mp4未完成时被访问
rename
(
strFileTmp
.
data
(),
strFile
.
data
());
//获取文件大小
struct
stat
fileData
;
stat
(
strFile
.
data
(),
&
fileData
);
const_cast
<
RecordInfo
&>
(
info
).
file_size
=
fileData
.
st_size
;
stat
(
strFileTmp
.
data
(),
&
fileData
);
const_cast
<
RecordInfo
&>
(
info
).
file_size
=
fileData
.
st_size
;
if
(
fileData
.
st_size
<
1024
)
{
//录像文件太小,删除之
File
::
delete_file
(
strFileTmp
.
data
());
return
;
}
//临时文件名改成正式文件名,防止mp4未完成时被访问
rename
(
strFileTmp
.
data
(),
strFile
.
data
());
/////record 业务逻辑//////
NoticeCenter
::
Instance
().
emitEvent
(
Broadcast
::
kBroadcastRecordMP4
,
info
);
});
...
...
This diff is collapsed.
Click to expand it.
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论