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-14 11:37:06 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
70c1d3cc7eebe8319e000b0f11e01ea66e0502e1
70c1d3cc
2 parents
0c939e71
02a2cb7e
Merge branch '2.0release' into develop
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
21 行增加
和
11 行删除
trunk/conf/full.conf
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_mpegts_udp.cpp
trunk/conf/full.conf
查看文件 @
70c1d3c
...
...
@@ -794,6 +794,7 @@ vhost hooks.callback.srs.com {
# [stream], replace with the stream.
# [ts_url], replace with the ts url.
# ignore any return data of server.
# @remark random select a url to report, not report all.
on_hls_notify
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
hls
/[
app
]/[
stream
][
ts_url
];
}
}
...
...
trunk/src/app/srs_app_hls.cpp
查看文件 @
70c1d3c
...
...
@@ -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
()
{
...
...
@@ -240,13 +240,17 @@ int SrsDvrAsyncCallOnHlsNotify::call()
return
ret
;
}
std
::
string
url
;
if
(
true
)
{
static
u_int32_t
nb_call
=
0
;
int
index
=
nb_call
++
%
on_hls
->
args
.
size
();
url
=
on_hls
->
args
.
at
(
index
);
}
int
nb_notify
=
_srs_config
->
get_vhost_hls_nb_notify
(
req
->
vhost
);
for
(
int
i
=
0
;
i
<
(
int
)
on_hls
->
args
.
size
();
i
++
)
{
std
::
string
url
=
on_hls
->
args
.
at
(
i
);
if
((
ret
=
SrsHttpHooks
::
on_hls_notify
(
url
,
req
,
ts_url
,
nb_notify
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"hook client on_hls_notify failed. url=%s, ts=%s, ret=%d"
,
url
.
c_str
(),
ts_url
.
c_str
(),
ret
);
return
ret
;
}
if
((
ret
=
SrsHttpHooks
::
on_hls_notify
(
url
,
req
,
ts_url
,
nb_notify
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"hook client on_hls_notify failed. url=%s, ts=%s, ret=%d"
,
url
.
c_str
(),
ts_url
.
c_str
(),
ret
);
return
ret
;
}
}
#endif
...
...
@@ -441,7 +445,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 +463,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 +544,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
;
}
...
...
trunk/src/app/srs_app_mpegts_udp.cpp
查看文件 @
70c1d3c
...
...
@@ -419,7 +419,10 @@ int SrsMpegtsOverUdp::write_h264_sps_pps(u_int32_t dts, u_int32_t pts)
{
int
ret
=
ERROR_SUCCESS
;
// only send when both sps and pps changed.
// TODO: FIMXE: there exists bug, see following comments.
// when sps or pps changed, update the sequence header,
// for the pps maybe not changed while sps changed.
// so, we must check when each video ts message frame parsed.
if
(
!
h264_sps_changed
||
!
h264_pps_changed
)
{
return
ret
;
}
...
...
请
注册
或
登录
后发表评论