Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
胡斌
2017-02-17 09:21:02 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f5de843721f86197f5ae646e29c966b955a658c8
f5de8437
1 parent
92d0da7e
don't save total duration if hls_total_file is not configured
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
24 行增加
和
20 行删除
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_config.cpp
查看文件 @
f5de843
...
...
@@ -73,7 +73,7 @@ const char* _srs_version = "XCORE-"RTMP_SIG_SRS_SERVER;
#define SRS_CONF_DEFAULT_HLS_PATH "./objs/nginx/html"
#define SRS_CONF_DEFAULT_HLS_M3U8_FILE "[app]/[stream].m3u8"
#define SRS_CONF_DEFAULT_HLS_TOTAL_M3U8_FILE ""
#define SRS_CONF_DEFAULT_HLS_TOTAL_FILE "
[app]/[stream]_total
"
#define SRS_CONF_DEFAULT_HLS_TOTAL_FILE ""
#define SRS_CONF_DEFAULT_HLS_TS_FILE "[app]/[stream]-[seq].ts"
#define SRS_CONF_DEFAULT_HLS_TS_FLOOR false
#define SRS_CONF_DEFAULT_HLS_FRAGMENT 10
...
...
trunk/src/app/srs_app_hls.cpp
查看文件 @
f5de843
...
...
@@ -833,26 +833,30 @@ int SrsHlsMuxer::segment_close(string log_desc)
}
srs_info
(
"write total m3u8 %s success."
,
m3u8_total_file
.
c_str
());
this
->
total_duraion
+=
currentSeg
->
duration
;
SrsFileWriter
total_writer
;
//write total duration to total
std
::
stringstream
ss_total
;
std
::
string
total_tmp
=
total
+
".tmp"
;
ret
=
total_writer
.
open
(
total_tmp
);
ss_total
.
precision
(
3
);
ss_total
.
setf
(
std
::
ios
::
fixed
,
std
::
ios
::
floatfield
);
ss_total
<<
total_duraion
;
if
((
ret
=
total_writer
.
write
((
char
*
)
ss_total
.
str
().
c_str
(),
(
int
)
ss_total
.
str
().
length
(),
NULL
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"write total temp:%s failed. ret=%d"
,(
char
*
)
total_tmp
.
c_str
(),
ret
);
return
ret
;
}
if
(
!
total_url
.
empty
())
{
this
->
total_duraion
+=
currentSeg
->
duration
;
SrsFileWriter
total_writer
;
//write total duration to total
std
::
stringstream
ss_total
;
std
::
string
total_tmp
=
total
+
".tmp"
;
ret
=
total_writer
.
open
(
total_tmp
);
ss_total
.
precision
(
3
);
ss_total
.
setf
(
std
::
ios
::
fixed
,
std
::
ios
::
floatfield
);
ss_total
<<
total_duraion
;
if
((
ret
=
total_writer
.
write
((
char
*
)
ss_total
.
str
().
c_str
(),
(
int
)
ss_total
.
str
().
length
(),
NULL
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"write total temp:%s failed. ret=%d"
,
(
char
*
)
total_tmp
.
c_str
(),
ret
);
return
ret
;
}
if
(
rename
(
total_tmp
.
c_str
(),
total
.
c_str
())
<
0
)
{
ret
=
ERROR_HLS_WRITE_FAILED
;
srs_error
(
"rename total file failed. %s => %s, ret=%d"
,
total_tmp
.
c_str
(),
total
.
c_str
(),
ret
);
if
(
rename
(
total_tmp
.
c_str
(),
total
.
c_str
())
<
0
)
{
ret
=
ERROR_HLS_WRITE_FAILED
;
srs_error
(
"rename total file failed. %s => %s, ret=%d"
,
total_tmp
.
c_str
(),
total
.
c_str
(),
ret
);
}
}
}
...
...
请
注册
或
登录
后发表评论