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-03 13:46:44 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
64b065e450414c6f0d4f81c8d1785923ffb41d76
64b065e4
1 parent
c4466a8c
for hls callback, add duration of ts.
隐藏空白字符变更
内嵌
并排对比
正在显示
6 个修改的文件
包含
16 行增加
和
8 行删除
trunk/conf/full.conf
trunk/research/api-server/server.py
trunk/src/app/srs_app_hls.cpp
trunk/src/app/srs_app_hls.hpp
trunk/src/app/srs_app_http_hooks.cpp
trunk/src/app/srs_app_http_hooks.hpp
trunk/conf/full.conf
查看文件 @
64b065e
...
...
@@ -754,6 +754,7 @@ vhost hooks.callback.srs.com {
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream",
# "duration": 9.36, // in seconds
# "cwd": "/usr/local/srs",
# "file": "./objs/nginx/html/live/livestream.1420254068776-100.ts",
# "seq_no": 100
...
...
trunk/research/api-server/server.py
查看文件 @
64b065e
...
...
@@ -328,8 +328,11 @@ class RESTHls(object):
{
"action": "on_dvr",
"client_id": 1985,
"ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
"ip": "192.168.1.10",
"vhost": "video.test.com",
"app": "live",
"stream": "livestream",
"duration": 9.68, // in seconds
"cwd": "/usr/local/srs",
"file": "./objs/nginx/html/live/livestream.1420254068776-100.ts",
"seq_no": 100
...
...
@@ -368,8 +371,8 @@ class RESTHls(object):
def
__on_hls
(
self
,
req
):
code
=
Error
.
success
trace
(
"srs
%
s: client id=
%
s, ip=
%
s, vhost=
%
s, app=
%
s, stream=
%
s, cwd=
%
s, file=
%
s, seq_no=
%
s"
%
(
req
[
"action"
],
req
[
"client_id"
],
req
[
"ip"
],
req
[
"vhost"
],
req
[
"app"
],
req
[
"stream"
],
trace
(
"srs
%
s: client id=
%
s, ip=
%
s, vhost=
%
s, app=
%
s, stream=
%
s, duration=
%
s, cwd=
%
s, file=
%
s, seq_no=
%
s"
%
(
req
[
"action"
],
req
[
"client_id"
],
req
[
"ip"
],
req
[
"vhost"
],
req
[
"app"
],
req
[
"stream"
],
req
[
"duration"
],
req
[
"cwd"
],
req
[
"file"
],
req
[
"seq_no"
]
))
...
...
trunk/src/app/srs_app_hls.cpp
查看文件 @
64b065e
...
...
@@ -170,11 +170,12 @@ void SrsHlsSegment::update_duration(int64_t current_frame_dts)
return
;
}
SrsDvrAsyncCallOnHls
::
SrsDvrAsyncCallOnHls
(
SrsRequest
*
r
,
string
p
,
int
s
)
SrsDvrAsyncCallOnHls
::
SrsDvrAsyncCallOnHls
(
SrsRequest
*
r
,
string
p
,
int
s
,
double
d
)
{
req
=
r
;
path
=
p
;
seq_no
=
s
;
duration
=
d
;
}
SrsDvrAsyncCallOnHls
::~
SrsDvrAsyncCallOnHls
()
...
...
@@ -199,7 +200,7 @@ int SrsDvrAsyncCallOnHls::call()
int
sn
=
seq_no
;
for
(
int
i
=
0
;
i
<
(
int
)
on_hls
->
args
.
size
();
i
++
)
{
std
::
string
url
=
on_hls
->
args
.
at
(
i
);
if
((
ret
=
SrsHttpHooks
::
on_hls
(
url
,
req
,
file
,
sn
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
SrsHttpHooks
::
on_hls
(
url
,
req
,
file
,
sn
,
duration
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"hook client on_hls failed. url=%s, ret=%d"
,
url
.
c_str
(),
ret
);
return
ret
;
}
...
...
trunk/src/app/srs_app_hls.hpp
查看文件 @
64b065e
...
...
@@ -164,8 +164,9 @@ private:
std
::
string
path
;
int
seq_no
;
SrsRequest
*
req
;
double
duration
;
public
:
SrsDvrAsyncCallOnHls
(
SrsRequest
*
r
,
std
::
string
p
,
int
s
);
SrsDvrAsyncCallOnHls
(
SrsRequest
*
r
,
std
::
string
p
,
int
s
,
double
d
);
virtual
~
SrsDvrAsyncCallOnHls
();
public
:
virtual
int
call
();
...
...
trunk/src/app/srs_app_http_hooks.cpp
查看文件 @
64b065e
...
...
@@ -287,7 +287,7 @@ int SrsHttpHooks::on_dvr(string url, SrsRequest* req, string file)
return
ret
;
}
int
SrsHttpHooks
::
on_hls
(
string
url
,
SrsRequest
*
req
,
string
file
,
int
sn
)
int
SrsHttpHooks
::
on_hls
(
string
url
,
SrsRequest
*
req
,
string
file
,
int
sn
,
double
duration
)
{
int
ret
=
ERROR_SUCCESS
;
...
...
@@ -302,6 +302,7 @@ int SrsHttpHooks::on_hls(string url, SrsRequest* req, string file, int sn)
<<
SRS_JFIELD_STR
(
"vhost"
,
req
->
vhost
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"app"
,
req
->
app
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"stream"
,
req
->
stream
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"duration"
,
duration
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"cwd"
,
cwd
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_STR
(
"file"
,
file
)
<<
SRS_JFIELD_CONT
<<
SRS_JFIELD_ORG
(
"seq_no"
,
sn
)
...
...
trunk/src/app/srs_app_http_hooks.hpp
查看文件 @
64b065e
...
...
@@ -102,8 +102,9 @@ public:
* ignore if empty.
* @param file the ts file path, can be relative or absolute path.
* @param sn the seq_no, the sequence number of ts in hls/m3u8.
* @param duration the segment duration in seconds.
*/
static
int
on_hls
(
std
::
string
url
,
SrsRequest
*
req
,
std
::
string
file
,
int
sn
);
static
int
on_hls
(
std
::
string
url
,
SrsRequest
*
req
,
std
::
string
file
,
int
sn
,
double
duration
);
private
:
static
int
do_post
(
std
::
string
url
,
std
::
string
req
,
int
&
code
,
std
::
string
&
res
);
};
...
...
请
注册
或
登录
后发表评论