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 20:07:54 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
3b853a6dbd5192040e6d516c2ff6d66d85c685b4
3b853a6d
1 parent
53d9faf3
fix #293, support rtmp remux to http flv live stream.
隐藏空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
53 行增加
和
9 行删除
README.md
trunk/src/app/srs_app_http.cpp
trunk/src/app/srs_app_http.hpp
trunk/src/app/srs_app_http_conn.cpp
trunk/src/app/srs_app_http_conn.hpp
README.md
查看文件 @
3b853a6
...
...
@@ -476,7 +476,10 @@ Supported operating systems and hardware:
[
#179
](
https://github.com/winlinvip/simple-rtmp-server/issues/179
)
and
[
274
](
https://github.com/winlinvip/simple-rtmp-server/issues/274
)
.
1.
Support rtmp remux to http flv live stream, read
[
#293
](
https://github.com/winlinvip/simple-rtmp-server/issues/293
)
.
[
#293
](
https://github.com/winlinvip/simple-rtmp-server/issues/293
)(
[CN](https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DeliveryHttpFlvStream
)
,
[
EN
](
https://github.com/winlinvip/simple-rtmp-server/wiki/v2_CN_DeliveryHttpFlvStream
)
).
1.
[
no-plan
]
Support <500ms latency, FRSC(Fast RTMP-compatible Stream Channel tech).
1.
[
no-plan
]
Support RTMP 302 redirect
[
#92
](
https://github.com/winlinvip/simple-rtmp-server/issues/92
)
.
1.
[
no-plan
]
Support multiple processes, for both origin and edge
...
...
trunk/src/app/srs_app_http.cpp
查看文件 @
3b853a6
...
...
@@ -402,6 +402,7 @@ int SrsGoHttpFileServer::copy(ISrsGoHttpResponseWriter* w, SrsFileReader* fs, Sr
SrsGoHttpMuxEntry
::
SrsGoHttpMuxEntry
()
{
enabled
=
true
;
explicit_match
=
false
;
handler
=
NULL
;
}
...
...
@@ -572,6 +573,10 @@ int SrsGoHttpServeMux::match(SrsHttpMessage* r, ISrsGoHttpHandler** ph)
std
::
string
pattern
=
it
->
first
;
SrsGoHttpMuxEntry
*
entry
=
it
->
second
;
if
(
!
entry
->
enabled
)
{
continue
;
}
if
(
!
path_match
(
pattern
,
path
))
{
continue
;
}
...
...
trunk/src/app/srs_app_http.hpp
查看文件 @
3b853a6
...
...
@@ -230,6 +230,7 @@ public:
bool
explicit_match
;
ISrsGoHttpHandler
*
handler
;
std
::
string
pattern
;
bool
enabled
;
public
:
SrsGoHttpMuxEntry
();
virtual
~
SrsGoHttpMuxEntry
();
...
...
trunk/src/app/srs_app_http_conn.cpp
查看文件 @
3b853a6
...
...
@@ -282,12 +282,22 @@ int SrsLiveStream::send_messages(SrsFlvEncoder* enc, SrsSharedPtrMessage** msgs,
return
ret
;
}
SrsLiveEntry
::
SrsLiveEntry
()
{
stream
=
NULL
;
}
SrsHttpServer
::
SrsHttpServer
()
{
}
SrsHttpServer
::~
SrsHttpServer
()
{
std
::
map
<
std
::
string
,
SrsLiveEntry
*>::
iterator
it
;
for
(
it
=
flvs
.
begin
();
it
!=
flvs
.
end
();
++
it
)
{
SrsLiveEntry
*
entry
=
it
->
second
;
srs_freep
(
entry
);
}
flvs
.
clear
();
}
...
...
@@ -317,8 +327,16 @@ int SrsHttpServer::mount(SrsSource* s, SrsRequest* r)
srs_info
(
"ignore mount flv stream for disabled"
);
return
ret
;
}
SrsLiveEntry
*
entry
=
flvs
[
r
->
vhost
];
// TODO: FIXME: supports reload.
if
(
entry
->
stream
)
{
entry
->
stream
->
entry
->
enabled
=
true
;
return
ret
;
}
std
::
string
mount
=
flvs
[
r
->
vhost
]
;
std
::
string
mount
=
entry
->
mount
;
// replace the vhost variable
mount
=
srs_string_replace
(
mount
,
"[vhost]"
,
r
->
vhost
);
...
...
@@ -328,8 +346,10 @@ int SrsHttpServer::mount(SrsSource* s, SrsRequest* r)
// remove the default vhost mount
mount
=
srs_string_replace
(
mount
,
SRS_CONSTS_RTMP_DEFAULT_VHOST
"/"
,
"/"
);
entry
->
stream
=
new
SrsLiveStream
(
s
,
r
);
// mount the http flv stream.
if
((
ret
=
mux
.
handle
(
mount
,
new
SrsLiveStream
(
s
,
r
)
))
!=
ERROR_SUCCESS
)
{
if
((
ret
=
mux
.
handle
(
mount
,
entry
->
stream
))
!=
ERROR_SUCCESS
)
{
srs_error
(
"http: mount flv stream for vhost=%s failed. ret=%d"
,
r
->
vhost
.
c_str
(),
ret
);
return
ret
;
}
...
...
@@ -344,8 +364,9 @@ void SrsHttpServer::unmount(SrsSource* s, SrsRequest* r)
srs_info
(
"ignore unmount flv stream for disabled"
);
return
;
}
// TODO: FIXME: implements it.
SrsLiveEntry
*
entry
=
flvs
[
r
->
vhost
];
entry
->
stream
->
entry
->
enabled
=
false
;
}
int
SrsHttpServer
::
on_reload_vhost_http_updated
()
...
...
@@ -440,10 +461,12 @@ int SrsHttpServer::mount_flv_streaming()
continue
;
}
std
::
string
mount
=
_srs_config
->
get_vhost_http_flv_mount
(
vhost
);
flvs
[
vhost
]
=
mount
;
SrsLiveEntry
*
entry
=
new
SrsLiveEntry
();
entry
->
vhost
=
vhost
;
entry
->
mount
=
_srs_config
->
get_vhost_http_flv_mount
(
vhost
);
flvs
[
vhost
]
=
entry
;
srs_trace
(
"http flv live stream, vhost=%s, mount=%s"
,
vhost
.
c_str
(),
mount
.
c_str
());
vhost
.
c_str
(),
entry
->
mount
.
c_str
());
}
return
ret
;
...
...
trunk/src/app/srs_app_http_conn.hpp
查看文件 @
3b853a6
...
...
@@ -101,6 +101,18 @@ private:
};
/**
* the srs live entry
*/
struct
SrsLiveEntry
{
std
::
string
vhost
;
std
::
string
mount
;
SrsLiveStream
*
stream
;
SrsLiveEntry
();
};
/**
* the http server instance,
* serve http static file, flv vod stream and flv live stream.
*/
...
...
@@ -109,7 +121,7 @@ class SrsHttpServer : public ISrsReloadHandler
public
:
SrsGoHttpServeMux
mux
;
// the flv live streaming template.
std
::
map
<
std
::
string
,
std
::
string
>
flvs
;
std
::
map
<
std
::
string
,
SrsLiveEntry
*
>
flvs
;
public
:
SrsHttpServer
();
virtual
~
SrsHttpServer
();
...
...
请
注册
或
登录
后发表评论