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-01-05 12:20:46 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
40ed2249e8e9453371c844e38e22d206913c8ae3
40ed2249
1 parent
4bb17f0c
refine code to use the one coding style.
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
34 行增加
和
32 行删除
trunk/src/app/srs_app_http_api.cpp
trunk/src/app/srs_app_statistic.cpp
trunk/src/app/srs_app_statistic.hpp
trunk/src/app/srs_app_http_api.cpp
查看文件 @
40ed224
...
...
@@ -525,8 +525,8 @@ int SrsApiVhosts::do_process_request(SrsStSocket* skt, SrsHttpMessage* req)
std
::
stringstream
ss
;
std
::
set
<
std
::
string
>
vhost_set
;
SrsStreamInfoMap
*
pool
=
SrsStatistic
::
instance
()
->
get_pool
();
SrsStreamInfoMap
::
iterator
it
;
std
::
map
<
void
*
,
SrsStreamInfo
*>*
pool
=
SrsStatistic
::
instance
()
->
get_pool
();
std
::
map
<
void
*
,
SrsStreamInfo
*>::
iterator
it
;
for
(
it
=
pool
->
begin
();
it
!=
pool
->
end
();
it
++
)
{
if
(
it
->
second
->
_req
==
NULL
)
continue
;
...
...
@@ -572,8 +572,8 @@ int SrsApiStreams::do_process_request(SrsStSocket* skt, SrsHttpMessage* req)
if
(
query_name
.
size
()
>
0
||
query_vhost
.
size
()
>
0
)
{
ss
<<
__SRS_JARRAY_START
;
bool
first
=
true
;
SrsStreamInfoMap
*
pool
=
SrsStatistic
::
instance
()
->
get_pool
();
SrsStreamInfoMap
::
iterator
it
;
std
::
map
<
void
*
,
SrsStreamInfo
*>*
pool
=
SrsStatistic
::
instance
()
->
get_pool
();
std
::
map
<
void
*
,
SrsStreamInfo
*>::
iterator
it
;
for
(
it
=
pool
->
begin
();
it
!=
pool
->
end
();
it
++
)
{
SrsRequest
*
reqinfo
=
it
->
second
->
_req
;
if
(
reqinfo
==
NULL
)
...
...
trunk/src/app/srs_app_statistic.cpp
查看文件 @
40ed224
...
...
@@ -32,44 +32,54 @@ SrsStreamInfo::SrsStreamInfo()
SrsStreamInfo
::~
SrsStreamInfo
()
{
if
(
_req
!=
NULL
)
delete
_req
;
srs_freep
(
_req
);
}
SrsStatistic
*
SrsStatistic
::
_instance
=
NULL
;
SrsStatistic
*
SrsStatistic
::
_instance
=
NULL
;
SrsStatistic
::
SrsStatistic
()
{
}
SrsStatistic
::~
SrsStatistic
()
{
SrsStreamInfoMap
::
iterator
it
;
std
::
map
<
void
*
,
SrsStreamInfo
*>
::
iterator
it
;
for
(
it
=
pool
.
begin
();
it
!=
pool
.
end
();
it
++
)
{
delete
it
->
second
;
SrsStreamInfo
*
si
=
it
->
second
;
srs_freep
(
si
);
}
}
SrsStatistic
*
SrsStatistic
::
instance
()
{
if
(
_instance
==
NULL
)
{
_instance
=
new
SrsStatistic
();
}
return
_instance
;
}
SrsStreamInfoMap
*
SrsStatistic
::
get_pool
()
std
::
map
<
void
*
,
SrsStreamInfo
*>
*
SrsStatistic
::
get_pool
()
{
return
&
pool
;
}
SrsStreamInfo
*
SrsStatistic
::
get
(
void
*
p
)
{
SrsStreamInfoMap
::
iterator
it
=
pool
.
find
(
p
);
std
::
map
<
void
*
,
SrsStreamInfo
*>
::
iterator
it
=
pool
.
find
(
p
);
if
(
it
==
pool
.
end
())
{
pool
[
p
]
=
new
SrsStreamInfo
();
return
pool
[
p
];
SrsStreamInfo
*
si
=
new
SrsStreamInfo
();
pool
[
p
]
=
si
;
return
si
;
}
else
{
return
it
->
second
;
SrsStreamInfo
*
si
=
it
->
second
;
return
si
;
}
}
void
SrsStatistic
::
add_request_info
(
void
*
p
,
SrsRequest
*
req
)
{
SrsStreamInfo
*
info
=
get
(
p
);
if
(
info
->
_req
==
NULL
)
SrsStreamInfo
*
info
=
get
(
p
);
if
(
info
->
_req
==
NULL
)
{
info
->
_req
=
req
->
copy
();
}
}
\ No newline at end of file
...
...
trunk/src/app/srs_app_statistic.hpp
查看文件 @
40ed224
...
...
@@ -39,32 +39,24 @@ class SrsStreamInfo
public
:
SrsStreamInfo
();
virtual
~
SrsStreamInfo
();
public
:
SrsRequest
*
_req
;
};
typedef
std
::
map
<
void
*
,
SrsStreamInfo
*>
SrsStreamInfoMap
;
class
SrsStatistic
{
public
:
static
SrsStatistic
*
instance
()
{
if
(
_instance
==
NULL
)
{
_instance
=
new
SrsStatistic
();
}
return
_instance
;
}
virtual
SrsStreamInfoMap
*
get_pool
();
static
SrsStatistic
*
instance
();
public
:
virtual
std
::
map
<
void
*
,
SrsStreamInfo
*>*
get_pool
();
virtual
void
add_request_info
(
void
*
p
,
SrsRequest
*
req
);
private
:
SrsStatistic
();
virtual
~
SrsStatistic
();
private
:
static
SrsStatistic
*
_instance
;
SrsStreamInfoMap
pool
;
std
::
map
<
void
*
,
SrsStreamInfo
*>
pool
;
private
:
virtual
SrsStreamInfo
*
get
(
void
*
p
);
};
...
...
请
注册
或
登录
后发表评论