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-10 15:00:07 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
e5b8e0da01eee95eb06fa5b37459af274feded0f
e5b8e0da
1 parent
5d37e477
fix async call and hls_nb_notify bug.
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
31 行增加
和
28 行删除
trunk/src/app/srs_app_async_call.cpp
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/src/app/srs_app_http_hooks.cpp
trunk/src/app/srs_app_async_call.cpp
查看文件 @
e5b8e0d
...
...
@@ -87,7 +87,7 @@ int SrsDvrAsyncCallThread::cycle()
for
(
it
=
copies
.
begin
();
it
!=
copies
.
end
();
++
it
)
{
ISrsDvrAsyncCall
*
call
=
*
it
;
if
((
ret
=
call
->
call
())
!=
ERROR_SUCCESS
)
{
srs_warn
(
"
dvr: ignore
callback %s, ret=%d"
,
call
->
to_string
().
c_str
(),
ret
);
srs_warn
(
"
ignore async
callback %s, ret=%d"
,
call
->
to_string
().
c_str
(),
ret
);
}
srs_freep
(
call
);
}
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
e5b8e0d
...
...
@@ -2440,22 +2440,6 @@ SrsConfDirective* SrsConfig::get_vhost_on_hls_notify(string vhost)
return
conf
->
get
(
"on_hls_notify"
);
}
int
SrsConfig
::
get_vhost_hls_nb_notify
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost_http_hooks
(
vhost
);
if
(
!
conf
)
{
return
SRS_CONF_DEFAULT_HLS_NB_NOTIFY
;
}
conf
=
conf
->
get
(
"hls_nb_notify"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
SRS_CONF_DEFAULT_HLS_NB_NOTIFY
;
}
return
::
atoi
(
conf
->
arg0
().
c_str
());
}
bool
SrsConfig
::
get_bw_check_enabled
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_vhost
(
vhost
);
...
...
@@ -3434,6 +3418,22 @@ string SrsConfig::get_hls_vcodec(string vhost)
return
conf
->
arg0
();
}
int
SrsConfig
::
get_vhost_hls_nb_notify
(
string
vhost
)
{
SrsConfDirective
*
conf
=
get_hls
(
vhost
);
if
(
!
conf
)
{
return
SRS_CONF_DEFAULT_HLS_NB_NOTIFY
;
}
conf
=
conf
->
get
(
"hls_nb_notify"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
SRS_CONF_DEFAULT_HLS_NB_NOTIFY
;
}
return
::
atoi
(
conf
->
arg0
().
c_str
());
}
bool
SrsConfig
::
get_hls_cleanup
(
string
vhost
)
{
SrsConfDirective
*
hls
=
get_hls
(
vhost
);
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
e5b8e0d
...
...
@@ -652,11 +652,6 @@ public:
* @return the on_hls_notify callback directive, the args is the url to callback.
*/
virtual
SrsConfDirective
*
get_vhost_on_hls_notify
(
std
::
string
vhost
);
/**
* get the size of bytes to read from cdn network, for the on_hls_notify callback,
* that is, to read max bytes of the bytes from the callback, or timeout or error.
*/
virtual
int
get_vhost_hls_nb_notify
(
std
::
string
vhost
);
// bwct(bandwidth check tool) section
public:
/**
...
...
@@ -965,8 +960,12 @@ public:
* whether cleanup the old ts files.
*/
virtual
bool
get_hls_cleanup
(
std
::
string
vhost
);
// hds section
/**
* get the size of bytes to read from cdn network, for the on_hls_notify callback,
* that is, to read max bytes of the bytes from the callback, or timeout or error.
*/
virtual
int
get_vhost_hls_nb_notify
(
std
::
string
vhost
);
// hds section
private:
/**
* get the hds directive of vhost.
...
...
trunk/src/app/srs_app_http_hooks.cpp
查看文件 @
e5b8e0d
...
...
@@ -42,6 +42,7 @@ using namespace std;
#define SRS_HTTP_RESPONSE_OK SRS_XSTR(ERROR_SUCCESS)
#define SRS_HTTP_HEADER_BUFFER 1024
#define SRS_HTTP_READ_BUFFER 4096
#define SRS_HTTP_BODY_BUFFER 32 * 1024
// the timeout for hls notify, in us.
...
...
@@ -363,15 +364,18 @@ int SrsHttpHooks::on_hls_notify(std::string url, SrsRequest* req, std::string ts
}
SrsAutoFree
(
SrsHttpMessage
,
msg
);
int
nb_buf
=
srs_min
(
nb_notify
,
SRS_HTTP_READ_BUFFER
);
char
*
buf
=
new
char
[
nb_buf
];
SrsAutoFree
(
char
,
buf
);
int
nb_read
=
0
;
ISrsHttpResponseReader
*
br
=
msg
->
body_reader
();
while
(
nb_read
<
nb_notify
&&
!
br
->
eof
())
{
char
buf
[
64
];
// only read a little of bytes of ts.
int
nb_buf
=
64
;
if
((
ret
=
br
->
read
(
buf
,
nb_buf
,
&
nb_buf
))
!=
ERROR_SUCCESS
)
{
int
nb_bytes
=
0
;
if
((
ret
=
br
->
read
(
buf
,
nb_buf
,
&
nb_bytes
))
!=
ERROR_SUCCESS
)
{
break
;
}
nb_read
+=
nb_b
uf
;
nb_read
+=
nb_b
ytes
;
}
int
spenttime
=
(
int
)(
srs_update_system_time_ms
()
-
starttime
);
...
...
请
注册
或
登录
后发表评论