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-07-16 18:42:27 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
99db2888e771500295293e12ca508650a479909c
99db2888
1 parent
c2ef7795
refine code for hstrs.
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
13 行增加
和
9 行删除
trunk/src/app/srs_app_http_stream.cpp
trunk/src/app/srs_app_http_stream.hpp
trunk/src/app/srs_app_http_stream.cpp
查看文件 @
99db288
...
...
@@ -63,6 +63,9 @@ SrsStreamCache::SrsStreamCache(SrsSource* s, SrsRequest* r)
source
=
s
;
queue
=
new
SrsMessageQueue
(
true
);
pthread
=
new
SrsEndlessThread
(
"http-stream"
,
this
);
// TODO: FIXME: support reload.
fast_cache
=
_srs_config
->
get_vhost_http_remux_fast_cache
(
req
->
vhost
);
}
SrsStreamCache
::~
SrsStreamCache
()
...
...
@@ -82,8 +85,6 @@ int SrsStreamCache::dump_cache(SrsConsumer* consumer, SrsRtmpJitterAlgorithm jit
{
int
ret
=
ERROR_SUCCESS
;
double
fast_cache
=
_srs_config
->
get_vhost_http_remux_fast_cache
(
req
->
vhost
);
if
(
fast_cache
<=
0
)
{
srs_info
(
"http: ignore dump fast cache."
);
return
ret
;
...
...
@@ -104,6 +105,13 @@ int SrsStreamCache::cycle()
{
int
ret
=
ERROR_SUCCESS
;
// TODO: FIXME: support reload.
if
(
fast_cache
<=
0
)
{
return
ret
;
}
// the stream cache will create consumer to cache stream,
// which will trigger to fetch stream from origin for edge.
SrsConsumer
*
consumer
=
NULL
;
if
((
ret
=
source
->
create_consumer
(
consumer
,
false
,
false
,
true
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"http: create consumer failed. ret=%d"
,
ret
);
...
...
@@ -116,11 +124,9 @@ int SrsStreamCache::cycle()
SrsMessageArray
msgs
(
SRS_PERF_MW_MSGS
);
// set the queue size, which used for max cache.
// TODO: FIXME: support reload.
double
fast_cache
=
_srs_config
->
get_vhost_http_remux_fast_cache
(
req
->
vhost
);
if
(
fast_cache
>
0
)
{
queue
->
set_queue_size
(
fast_cache
);
}
while
(
true
)
{
pprint
->
elapse
();
...
...
@@ -150,11 +156,7 @@ int SrsStreamCache::cycle()
// free the messages.
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
SrsSharedPtrMessage
*
msg
=
msgs
.
msgs
[
i
];
if
(
fast_cache
>
0
)
{
queue
->
enqueue
(
msg
);
}
else
{
srs_freep
(
msg
);
}
}
}
...
...
trunk/src/app/srs_app_http_stream.hpp
查看文件 @
99db288
...
...
@@ -42,6 +42,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class
SrsStreamCache
:
public
ISrsEndlessThreadHandler
{
private
:
double
fast_cache
;
private
:
SrsMessageQueue
*
queue
;
SrsSource
*
source
;
SrsRequest
*
req
;
...
...
请
注册
或
登录
后发表评论