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-18 18:50:15 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
faaa9187f297c1efad6e575e6409803daa959929
faaa9187
1 parent
2698e6db
for #293, mount http flv stream when publish.
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
25 行增加
和
12 行删除
trunk/src/app/srs_app_http_conn.cpp
trunk/src/app/srs_app_http_conn.hpp
trunk/src/app/srs_app_http_conn.cpp
查看文件 @
faaa918
...
...
@@ -136,12 +136,15 @@ int SrsVodStream::serve_flv_stream(ISrsGoHttpResponseWriter* w, SrsHttpMessage*
return
ret
;
}
SrsLiveStream
::
SrsLiveStream
()
SrsLiveStream
::
SrsLiveStream
(
SrsSource
*
s
,
SrsRequest
*
r
)
{
source
=
s
;
req
=
r
->
copy
();
}
SrsLiveStream
::~
SrsLiveStream
()
{
srs_freep
(
req
);
}
int
SrsLiveStream
::
serve_http
(
ISrsGoHttpResponseWriter
*
w
,
SrsHttpMessage
*
r
)
...
...
@@ -182,27 +185,33 @@ int SrsHttpServer::mount(SrsSource* s, SrsRequest* r)
{
int
ret
=
ERROR_SUCCESS
;
if
(
flvs
.
empty
())
{
srs_info
(
"ignore mount, no flv stream configed."
);
if
(
flvs
.
find
(
r
->
vhost
)
==
flvs
.
end
())
{
srs_info
(
"ignore mount flv stream for disabled"
);
return
ret
;
}
std
::
string
mount
=
flvs
[
r
->
vhost
];
// replace the vhost variable
mount
=
srs_string_replace
(
mount
,
"[vhost]"
,
r
->
vhost
);
mount
=
srs_string_replace
(
mount
,
"[app]"
,
r
->
app
);
mount
=
srs_string_replace
(
mount
,
"[stream]"
,
r
->
stream
);
// remove the default vhost mount
mount
=
srs_string_replace
(
mount
,
SRS_CONSTS_RTMP_DEFAULT_VHOST
"/"
,
""
);
if
(
flvs
.
find
(
r
->
vhost
)
==
flvs
.
end
())
{
srs_info
(
"ignore mount flv stream for disabled"
);
// mount the http flv stream.
if
((
ret
=
mux
.
handle
(
mount
,
new
SrsLiveStream
(
s
,
r
)))
!=
ERROR_SUCCESS
)
{
srs_error
(
"http: mount flv stream for vhost=%s failed. ret=%d"
,
r
->
vhost
.
c_str
(),
ret
);
return
ret
;
}
srs_trace
(
"http: mount flv stream for vhost=%s, mount=%s"
,
r
->
vhost
.
c_str
(),
mount
.
c_str
());
// TODO: FIXME: implements it.
return
ret
;
}
void
SrsHttpServer
::
unmount
(
SrsSource
*
s
,
SrsRequest
*
r
)
{
if
(
flvs
.
empty
())
{
srs_info
(
"ignore unmount, no flv stream configed."
);
return
;
}
if
(
flvs
.
find
(
r
->
vhost
)
==
flvs
.
end
())
{
srs_info
(
"ignore unmount flv stream for disabled"
);
return
;
...
...
@@ -269,6 +278,7 @@ int SrsHttpServer::mount_static_file()
default_root_exists
=
true
;
srs_warn
(
"http: root mount to %s"
,
dir
.
c_str
());
}
srs_trace
(
"http: vhost=%s mount to %s"
,
vhost
.
c_str
(),
mount
.
c_str
());
}
if
(
!
default_root_exists
)
{
...
...
trunk/src/app/srs_app_http_conn.hpp
查看文件 @
faaa918
...
...
@@ -65,8 +65,11 @@ protected:
*/
class
SrsLiveStream
:
public
ISrsGoHttpHandler
{
private
:
SrsRequest
*
req
;
SrsSource
*
source
;
public
:
SrsLiveStream
();
SrsLiveStream
(
SrsSource
*
s
,
SrsRequest
*
r
);
virtual
~
SrsLiveStream
();
public
:
virtual
int
serve_http
(
ISrsGoHttpResponseWriter
*
w
,
SrsHttpMessage
*
r
);
...
...
请
注册
或
登录
后发表评论