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-04-13 11:45:08 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
40eab7fc886d550f24d4bd02d98bea65175c69b4
40eab7fc
1 parent
dcac9c69
for #381, refine the deviation for hls.
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
6 行增加
和
4 行删除
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_hls.cpp
查看文件 @
40eab7f
...
...
@@ -60,9 +60,9 @@ using namespace std;
#define SRS_AUTO_HLS_SEGMENT_MIN_DURATION_MS 100
// fragment plus the deviation percent.
#define SRS_HLS_FLOOR_REAP_PERCENT 0.
2
#define SRS_HLS_FLOOR_REAP_PERCENT 0.
3
// reset the piece id when deviation overflow this.
#define SRS_JUMP_WHEN_PIECE_DEVIATION
1
0
#define SRS_JUMP_WHEN_PIECE_DEVIATION
2
0
ISrsHlsHandler
::
ISrsHlsHandler
()
{
...
...
@@ -441,7 +441,7 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts)
ts_file
=
srs_path_build_stream
(
ts_file
,
req
->
vhost
,
req
->
app
,
req
->
stream
);
if
(
hls_ts_floor
)
{
// accept the floor ts for the first piece.
int64_t
current_floor_ts
=
(
int64_t
)(
srs_
get
_system_time_ms
()
/
(
1000
*
hls_fragment
));
int64_t
current_floor_ts
=
(
int64_t
)(
srs_
update
_system_time_ms
()
/
(
1000
*
hls_fragment
));
if
(
!
accept_floor_ts
)
{
accept_floor_ts
=
current_floor_ts
-
1
;
}
else
{
...
...
@@ -459,7 +459,7 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts)
// dup/jmp detect for ts in floor mode.
if
(
previous_floor_ts
&&
previous_floor_ts
!=
current_floor_ts
-
1
)
{
srs_warn
(
"hls: dup
or jmp for floor
ts, previous=%"
PRId64
", current=%"
PRId64
", accept=%"
PRId64
", deviation=%d"
,
srs_warn
(
"hls: dup
/jmp
ts, previous=%"
PRId64
", current=%"
PRId64
", accept=%"
PRId64
", deviation=%d"
,
previous_floor_ts
,
current_floor_ts
,
accept_floor_ts
,
deviation_ts
);
}
previous_floor_ts
=
current_floor_ts
;
...
...
@@ -540,6 +540,8 @@ bool SrsHlsMuxer::is_segment_overflow()
// use N% deviation, to smoother.
double
deviation
=
hls_ts_floor
?
SRS_HLS_FLOOR_REAP_PERCENT
*
deviation_ts
*
hls_fragment
:
0.0
;
srs_info
(
"hls: dur=%.2f, tar=%.2f, dev=%.2fms/%dp, frag=%.2f"
,
current
->
duration
,
hls_fragment
+
deviation
,
deviation
,
deviation_ts
,
hls_fragment
);
return
current
->
duration
>=
hls_fragment
+
deviation
;
}
...
...
请
注册
或
登录
后发表评论