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-03-31 17:03:14 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
97442c56b64d2502e55be8ab2142a90cf835071c
97442c56
1 parent
76c19572
enhance hls in floor mode.
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
15 行增加
和
5 行删除
trunk/research/api-server/server.py
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_hls.hpp
trunk/research/api-server/server.py
查看文件 @
97442c5
...
...
@@ -253,7 +253,7 @@ class RESTDvrs(object):
return
json
.
dumps
(
dvrs
)
'''
for SRS hook: on_dvr,
on_dvr_reap_segment
for SRS hook: on_dvr,
on_dvr:
when srs reap a dvr file, call the hook,
the request in the POST data string is a object encode by json:
...
...
@@ -346,7 +346,7 @@ class RESTHls(object):
return
json
.
dumps
(
hls
)
'''
for SRS hook: on
_dvr
, on_dvr_reap_segment
for SRS hook: on, on_dvr_reap_segment
on_dvr:
when srs reap a dvr file, call the hook,
the request in the POST data string is a object encode by json:
...
...
trunk/src/app/srs_app_hls.cpp
查看文件 @
97442c5
...
...
@@ -177,6 +177,7 @@ SrsHlsMuxer::SrsHlsMuxer()
hls_aof_ratio
=
1.0
;
hls_fragment_deviation
=
0
;
previous_floor_ts
=
0
;
accept_floor_ts
=
0
;
hls_ts_floor
=
false
;
target_duration
=
0
;
_sequence_no
=
0
;
...
...
@@ -244,6 +245,7 @@ int SrsHlsMuxer::update_config(SrsRequest* r, string entry_prefix,
hls_aof_ratio
=
aof_ratio
;
hls_ts_floor
=
ts_floor
;
previous_floor_ts
=
0
;
accept_floor_ts
=
0
;
hls_window
=
window
;
// for the first time, we set to -N% of fragment,
// that is, the first piece always smaller.
...
...
@@ -331,18 +333,25 @@ int SrsHlsMuxer::segment_open(int64_t segment_start_dts)
std
::
string
ts_file
=
hls_ts_file
;
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
floor_ts
=
(
int64_t
)(
srs_get_system_time_ms
()
/
(
1000
*
hls_fragment
));
if
(
!
accept_floor_ts
)
{
accept_floor_ts
=
floor_ts
-
1
;
}
else
{
accept_floor_ts
++
;
}
// we always ensure the piece is increase one by one.
std
::
stringstream
ts_floor
;
ts_floor
<<
(
int64_t
)(
previous_floor_ts
+
1
)
;
ts_floor
<<
accept_floor_ts
;
ts_file
=
srs_string_replace
(
ts_file
,
"[timestamp]"
,
ts_floor
.
str
());
// dup/jmp detect for ts in floor mode.
int64_t
floor_ts
=
(
int64_t
)(
srs_get_system_time_ms
()
/
(
1000
*
hls_fragment
));
if
(
previous_floor_ts
&&
previous_floor_ts
!=
floor_ts
-
1
)
{
srs_warn
(
"hls: dup or jmp for floor ts, previous=%"
PRId64
", current=%"
PRId64
", ts=%s, deviation=%.2f"
,
previous_floor_ts
,
floor_ts
,
ts_file
.
c_str
(),
hls_fragment_deviation
);
}
previous_floor_ts
++
;
previous_floor_ts
=
floor_ts
;
}
ts_file
=
srs_path_build_timestamp
(
ts_file
);
if
(
true
)
{
...
...
trunk/src/app/srs_app_hls.hpp
查看文件 @
97442c5
...
...
@@ -182,6 +182,7 @@ private:
double
hls_fragment_deviation
;
// the previous reap floor timestamp,
// used to detect the dup or jmp or ts.
int64_t
accept_floor_ts
;
int64_t
previous_floor_ts
;
private
:
int
_sequence_no
;
...
...
请
注册
或
登录
后发表评论