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
winlin
2015-07-14 10:31:42 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
40c264a316e81cb217b4be8a6db1a199ba62226e
40c264a3
1 parent
54bb4248
always reset the max target duration for hls.
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
10 行增加
和
7 行删除
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_hls.hpp
trunk/src/app/srs_app_hls.cpp
查看文件 @
40c264a
...
...
@@ -280,7 +280,7 @@ SrsHlsMuxer::SrsHlsMuxer()
previous_floor_ts
=
0
;
accept_floor_ts
=
0
;
hls_ts_floor
=
false
;
target_duration
=
0
;
max_td
=
0
;
_sequence_no
=
0
;
current
=
NULL
;
acodec
=
SrsCodecAudioReserved1
;
...
...
@@ -400,10 +400,8 @@ int SrsHlsMuxer::update_config(SrsRequest* r, string entry_prefix,
m3u8_url
=
srs_path_build_stream
(
m3u8_file
,
req
->
vhost
,
req
->
app
,
req
->
stream
);
m3u8
=
path
+
"/"
+
m3u8_url
;
// we always keep the target duration increasing.
int
max_td
=
srs_max
(
target_duration
,
(
int
)(
fragment
*
_srs_config
->
get_hls_td_ratio
(
r
->
vhost
)));
srs_info
(
"hls update target duration %d=>%d, aof=%.2f"
,
target_duration
,
max_td
,
aof_ratio
);
target_duration
=
max_td
;
// when update config, reset the history target duration.
max_td
=
(
int
)(
fragment
*
_srs_config
->
get_hls_td_ratio
(
r
->
vhost
));
std
::
string
storage
=
_srs_config
->
get_hls_storage
(
r
->
vhost
);
if
(
storage
==
"ram"
)
{
...
...
@@ -861,6 +859,9 @@ int SrsHlsMuxer::_refresh_m3u8(string m3u8_file)
ss
<<
"#EXT-X-MEDIA-SEQUENCE:"
<<
first
->
sequence_no
<<
SRS_CONSTS_LF
;
srs_verbose
(
"write m3u8 sequence success."
);
// iterator shared for td generation and segemnts wrote.
std
::
vector
<
SrsHlsSegment
*>::
iterator
it
;
// #EXT-X-TARGETDURATION:4294967295\n
/**
* @see hls-m3u8-draft-pantos-http-live-streaming-12.pdf, page 25
...
...
@@ -871,11 +872,13 @@ int SrsHlsMuxer::_refresh_m3u8(string m3u8_file)
* typical target duration is 10 seconds.
*/
// @see https://github.com/simple-rtmp-server/srs/issues/304#issuecomment-74000081
std
::
vector
<
SrsHlsSegment
*>::
iterator
it
;
int
target_duration
=
0
;
for
(
it
=
segments
.
begin
();
it
!=
segments
.
end
();
++
it
)
{
SrsHlsSegment
*
segment
=
*
it
;
target_duration
=
srs_max
(
target_duration
,
(
int
)
ceil
(
segment
->
duration
));
}
target_duration
=
srs_max
(
target_duration
,
max_td
);
ss
<<
"#EXT-X-TARGETDURATION:"
<<
target_duration
<<
SRS_CONSTS_LF
;
srs_verbose
(
"write m3u8 duration success."
);
...
...
trunk/src/app/srs_app_hls.hpp
查看文件 @
40c264a
...
...
@@ -233,7 +233,7 @@ private:
int64_t
previous_floor_ts
;
private
:
int
_sequence_no
;
int
target_duration
;
int
max_td
;
std
::
string
m3u8
;
std
::
string
m3u8_url
;
private
:
...
...
请
注册
或
登录
后发表评论