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
2016-12-13 17:58:42 +0800
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
9ba4bed6480cc9f49c3452593da10b3866b76d9f
9ba4bed6
2 parents
439c6701
cb1d47bf
merge srs2
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
19 行增加
和
32 行删除
README.md
trunk/src/app/srs_app_http_stream.cpp
trunk/src/app/srs_app_rtmp_conn.cpp
trunk/src/app/srs_app_source.cpp
trunk/src/app/srs_app_source.hpp
README.md
查看文件 @
9ba4bed
...
...
@@ -390,6 +390,7 @@ Remark:
*
v3.0, 2015-08-31, fix
[
#319
][
bug #319
]
, http raw api support query global and vhost.
*
v3.0, 2015-08-28, fix
[
#471
][
bug #471
]
, api response the width and height. 3.0.2
*
v3.0, 2015-08-25, fix
[
#367
][
bug #367
]
, support nginx-rtmp exec. 3.0.1
*
<strong>
v2.0, 2016-11-09,
[
2.0 beta2(2.0.221)
][
r2.0b2
]
released. 86691 lines.
</strong>
*
<strong>
v2.0, 2016-09-09,
[
2.0 beta1(2.0.215)
][
r2.0b1
]
released. 89941 lines.
</strong>
*
<strong>
v2.0, 2016-08-06,
[
2.0 beta0(2.0.210)
][
r2.0b0
]
released. 89704 lines.
</strong>
*
<strong>
v2.0, 2015-12-23,
[
2.0 alpha3(2.0.205)
][
r2.0a3
]
released. 89544 lines.
</strong>
...
...
trunk/src/app/srs_app_http_stream.cpp
查看文件 @
9ba4bed
...
...
@@ -1232,11 +1232,9 @@ int SrsHttpStreamServer::hijack(ISrsHttpMessage* request, ISrsHttpHandler** ph)
}
}
SrsSource
*
s
=
SrsSource
::
fetch
(
r
);
if
(
!
s
)
{
if
((
ret
=
SrsSource
::
create
(
r
,
server
,
server
,
&
s
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
SrsSource
*
s
=
NULL
;
if
((
ret
=
SrsSource
::
fetch_or_create
(
r
,
server
,
server
,
&
s
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
srs_assert
(
s
!=
NULL
);
...
...
trunk/src/app/srs_app_rtmp_conn.cpp
查看文件 @
9ba4bed
...
...
@@ -709,11 +709,9 @@ int SrsRtmpConn::stream_service_cycle()
rtmp
->
set_send_timeout
(
SRS_CONSTS_RTMP_TIMEOUT_US
);
// find a source to serve.
SrsSource
*
source
=
SrsSource
::
fetch
(
req
);
if
(
!
source
)
{
if
((
ret
=
SrsSource
::
create
(
req
,
server
,
server
,
&
source
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
SrsSource
*
source
=
NULL
;
if
((
ret
=
SrsSource
::
fetch_or_create
(
req
,
server
,
server
,
&
source
))
!=
ERROR_SUCCESS
)
{
return
ret
;
}
srs_assert
(
source
!=
NULL
);
...
...
trunk/src/app/srs_app_source.cpp
查看文件 @
9ba4bed
...
...
@@ -737,17 +737,23 @@ ISrsSourceHandler::~ISrsSourceHandler()
std
::
map
<
std
::
string
,
SrsSource
*>
SrsSource
::
pool
;
int
SrsSource
::
create
(
SrsRequest
*
r
,
ISrsSourceHandler
*
h
,
ISrsHlsHandler
*
hh
,
SrsSource
**
pps
)
int
SrsSource
::
fetch_or_
create
(
SrsRequest
*
r
,
ISrsSourceHandler
*
h
,
ISrsHlsHandler
*
hh
,
SrsSource
**
pps
)
{
int
ret
=
ERROR_SUCCESS
;
SrsSource
*
source
=
NULL
;
if
((
source
=
fetch
(
r
))
!=
NULL
)
{
*
pps
=
source
;
return
ret
;
}
string
stream_url
=
r
->
get_stream_url
();
string
vhost
=
r
->
vhost
;
// should always not exists for create a source.
srs_assert
(
pool
.
find
(
stream_url
)
==
pool
.
end
());
SrsSource
*
source
=
new
SrsSource
();
source
=
new
SrsSource
();
if
((
ret
=
source
->
initialize
(
r
,
h
,
hh
))
!=
ERROR_SUCCESS
)
{
srs_freep
(
source
);
return
ret
;
...
...
@@ -780,20 +786,6 @@ SrsSource* SrsSource::fetch(SrsRequest* r)
return
source
;
}
SrsSource
*
SrsSource
::
fetch
(
std
::
string
vhost
,
std
::
string
app
,
std
::
string
stream
)
{
SrsSource
*
source
=
NULL
;
string
stream_url
=
srs_generate_stream_url
(
vhost
,
app
,
stream
);
if
(
pool
.
find
(
stream_url
)
==
pool
.
end
())
{
return
NULL
;
}
source
=
pool
[
stream_url
];
return
source
;
}
void
SrsSource
::
dispose_all
()
{
std
::
map
<
std
::
string
,
SrsSource
*>::
iterator
it
;
...
...
trunk/src/app/srs_app_source.hpp
查看文件 @
9ba4bed
...
...
@@ -420,22 +420,20 @@ private:
static
std
::
map
<
std
::
string
,
SrsSource
*>
pool
;
public
:
/**
*
find stream by vhost/app/stream
.
*
create source when fetch from cache failed
.
* @param r the client request.
* @param h the event handler for source.
* @param hh the event handler for hls.
* @param pps the matched source, if success never be NULL.
*/
static
int
create
(
SrsRequest
*
r
,
ISrsSourceHandler
*
h
,
ISrsHlsHandler
*
hh
,
SrsSource
**
pps
);
static
int
fetch_or_create
(
SrsRequest
*
r
,
ISrsSourceHandler
*
h
,
ISrsHlsHandler
*
hh
,
SrsSource
**
pps
);
private
:
/**
* get the exists source, NULL when not exists.
* update the request and return the exists source.
*/
static
SrsSource
*
fetch
(
SrsRequest
*
r
);
/**
* get the exists source by stream info(vhost, app, stream), NULL when not exists.
*/
static
SrsSource
*
fetch
(
std
::
string
vhost
,
std
::
string
app
,
std
::
string
stream
);
public
:
/**
* dispose and cycle all sources.
*/
...
...
请
注册
或
登录
后发表评论