winlin

Merge branch '2.0release' into develop

@@ -159,6 +159,7 @@ stream_caster { @@ -159,6 +159,7 @@ stream_caster {
159 # the caster type of stream, the casters: 159 # the caster type of stream, the casters:
160 # mpegts_over_udp, MPEG-TS over UDP caster. 160 # mpegts_over_udp, MPEG-TS over UDP caster.
161 # rtsp, Real Time Streaming Protocol (RTSP). 161 # rtsp, Real Time Streaming Protocol (RTSP).
  162 + # flv, FLV over HTTP POST.
162 caster mpegts_over_udp; 163 caster mpegts_over_udp;
163 # the output rtmp url. 164 # the output rtmp url.
164 # for mpegts_over_udp caster, the typically output url: 165 # for mpegts_over_udp caster, the typically output url:
@@ -195,6 +196,12 @@ stream_caster { @@ -195,6 +196,12 @@ stream_caster {
195 rtp_port_min 57200; 196 rtp_port_min 57200;
196 rtp_port_max 57300; 197 rtp_port_max 57300;
197 } 198 }
  199 +stream_caster {
  200 + enabled off;
  201 + caster flv;
  202 + output rtmp://127.0.0.1/[app]/[stream];
  203 + listen 8936;
  204 +}
198 205
199 ############################################################################################# 206 #############################################################################################
200 # RTMP/HTTP VHOST sections 207 # RTMP/HTTP VHOST sections
@@ -175,7 +175,8 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then @@ -175,7 +175,8 @@ if [ $SRS_EXPORT_LIBRTMP_PROJECT = NO ]; then
175 "srs_app_json" "srs_app_ingest" "srs_app_ffmpeg" "srs_app_utility" "srs_app_dvr" "srs_app_edge" 175 "srs_app_json" "srs_app_ingest" "srs_app_ffmpeg" "srs_app_utility" "srs_app_dvr" "srs_app_edge"
176 "srs_app_kbps" "srs_app_heartbeat" "srs_app_empty" "srs_app_http_client" 176 "srs_app_kbps" "srs_app_heartbeat" "srs_app_empty" "srs_app_http_client"
177 "srs_app_recv_thread" "srs_app_security" "srs_app_statistic" "srs_app_hds" 177 "srs_app_recv_thread" "srs_app_security" "srs_app_statistic" "srs_app_hds"
178 - "srs_app_mpegts_udp" "srs_app_rtsp" "srs_app_listener" "srs_app_async_call") 178 + "srs_app_mpegts_udp" "srs_app_rtsp" "srs_app_listener" "srs_app_async_call"
  179 + "srs_app_caster_flv")
179 DEFINES="" 180 DEFINES=""
180 # add each modules for app 181 # add each modules for app
181 for SRS_MODULE in ${SRS_MODULES[*]}; do 182 for SRS_MODULE in ${SRS_MODULES[*]}; do
@@ -69,6 +69,8 @@ file @@ -69,6 +69,8 @@ file
69 ../../src/app/srs_app_async_call.cpp, 69 ../../src/app/srs_app_async_call.cpp,
70 ../../src/app/srs_app_bandwidth.hpp, 70 ../../src/app/srs_app_bandwidth.hpp,
71 ../../src/app/srs_app_bandwidth.cpp, 71 ../../src/app/srs_app_bandwidth.cpp,
  72 + ../../src/app/srs_app_caster_flv.hpp,
  73 + ../../src/app/srs_app_caster_flv.cpp,
72 ../../src/app/srs_app_conn.hpp, 74 ../../src/app/srs_app_conn.hpp,
73 ../../src/app/srs_app_conn.cpp, 75 ../../src/app/srs_app_conn.cpp,
74 ../../src/app/srs_app_config.hpp, 76 ../../src/app/srs_app_config.hpp,
@@ -85,6 +85,7 @@ @@ -85,6 +85,7 @@
85 <ClInclude Include="..\..\src\app\srs_app_listener.hpp" /> 85 <ClInclude Include="..\..\src\app\srs_app_listener.hpp" />
86 <ClInclude Include="..\..\src\app\srs_app_log.hpp" /> 86 <ClInclude Include="..\..\src\app\srs_app_log.hpp" />
87 <ClInclude Include="..\..\src\app\srs_app_mpegts_udp.hpp" /> 87 <ClInclude Include="..\..\src\app\srs_app_mpegts_udp.hpp" />
  88 + <ClInclude Include="..\..\src\app\srs_app_caster_flv.hpp" />
88 <ClInclude Include="..\..\src\app\srs_app_pithy_print.hpp" /> 89 <ClInclude Include="..\..\src\app\srs_app_pithy_print.hpp" />
89 <ClInclude Include="..\..\src\app\srs_app_recv_thread.hpp" /> 90 <ClInclude Include="..\..\src\app\srs_app_recv_thread.hpp" />
90 <ClInclude Include="..\..\src\app\srs_app_refer.hpp" /> 91 <ClInclude Include="..\..\src\app\srs_app_refer.hpp" />
@@ -165,6 +166,7 @@ @@ -165,6 +166,7 @@
165 <ClCompile Include="..\..\src\app\srs_app_listener.cpp" /> 166 <ClCompile Include="..\..\src\app\srs_app_listener.cpp" />
166 <ClCompile Include="..\..\src\app\srs_app_log.cpp" /> 167 <ClCompile Include="..\..\src\app\srs_app_log.cpp" />
167 <ClCompile Include="..\..\src\app\srs_app_mpegts_udp.cpp" /> 168 <ClCompile Include="..\..\src\app\srs_app_mpegts_udp.cpp" />
  169 + <ClCompile Include="..\..\src\app\srs_app_caster_flv.cpp" />
168 <ClCompile Include="..\..\src\app\srs_app_pithy_print.cpp" /> 170 <ClCompile Include="..\..\src\app\srs_app_pithy_print.cpp" />
169 <ClCompile Include="..\..\src\app\srs_app_recv_thread.cpp" /> 171 <ClCompile Include="..\..\src\app\srs_app_recv_thread.cpp" />
170 <ClCompile Include="..\..\src\app\srs_app_refer.cpp" /> 172 <ClCompile Include="..\..\src\app\srs_app_refer.cpp" />
@@ -213,4 +215,4 @@ @@ -213,4 +215,4 @@
213 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> 215 <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
214 <ImportGroup Label="ExtensionTargets"> 216 <ImportGroup Label="ExtensionTargets">
215 </ImportGroup> 217 </ImportGroup>
216 -</Project>  
  218 +</Project>
@@ -75,6 +75,7 @@ @@ -75,6 +75,7 @@
75 3C1232ED1AAEA70F00CE8F6C /* libhttp_parser.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1232EC1AAEA70F00CE8F6C /* libhttp_parser.a */; }; 75 3C1232ED1AAEA70F00CE8F6C /* libhttp_parser.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3C1232EC1AAEA70F00CE8F6C /* libhttp_parser.a */; };
76 3C1EE6AE1AB1055800576EE9 /* srs_app_hds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6AC1AB1055800576EE9 /* srs_app_hds.cpp */; }; 76 3C1EE6AE1AB1055800576EE9 /* srs_app_hds.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6AC1AB1055800576EE9 /* srs_app_hds.cpp */; };
77 3C1EE6D71AB1367D00576EE9 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6D61AB1367D00576EE9 /* README.md */; }; 77 3C1EE6D71AB1367D00576EE9 /* README.md in Sources */ = {isa = PBXBuildFile; fileRef = 3C1EE6D61AB1367D00576EE9 /* README.md */; };
  78 + 3C28EDDF1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C28EDDD1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp */; };
78 3C36DB5B1ABD1CB90066CCAF /* srs_lib_bandwidth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C36DB551ABD1CB90066CCAF /* srs_lib_bandwidth.cpp */; }; 79 3C36DB5B1ABD1CB90066CCAF /* srs_lib_bandwidth.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C36DB551ABD1CB90066CCAF /* srs_lib_bandwidth.cpp */; };
79 3C36DB5C1ABD1CB90066CCAF /* srs_lib_simple_socket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C36DB571ABD1CB90066CCAF /* srs_lib_simple_socket.cpp */; }; 80 3C36DB5C1ABD1CB90066CCAF /* srs_lib_simple_socket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C36DB571ABD1CB90066CCAF /* srs_lib_simple_socket.cpp */; };
80 3C36DB5D1ABD1CB90066CCAF /* srs_librtmp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C36DB591ABD1CB90066CCAF /* srs_librtmp.cpp */; }; 81 3C36DB5D1ABD1CB90066CCAF /* srs_librtmp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3C36DB591ABD1CB90066CCAF /* srs_librtmp.cpp */; };
@@ -318,6 +319,8 @@ @@ -318,6 +319,8 @@
318 3C1EE6D41AB1367D00576EE9 /* DONATIONS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DONATIONS.txt; path = ../../../DONATIONS.txt; sourceTree = "<group>"; }; 319 3C1EE6D41AB1367D00576EE9 /* DONATIONS.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = DONATIONS.txt; path = ../../../DONATIONS.txt; sourceTree = "<group>"; };
319 3C1EE6D51AB1367D00576EE9 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../../../LICENSE; sourceTree = "<group>"; }; 320 3C1EE6D51AB1367D00576EE9 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = LICENSE; path = ../../../LICENSE; sourceTree = "<group>"; };
320 3C1EE6D61AB1367D00576EE9 /* README.md */ = {isa = PBXFileReference; explicitFileType = net.daringfireball.markdown; fileEncoding = 4; name = README.md; path = ../../../README.md; sourceTree = "<group>"; wrapsLines = 0; }; 321 3C1EE6D61AB1367D00576EE9 /* README.md */ = {isa = PBXFileReference; explicitFileType = net.daringfireball.markdown; fileEncoding = 4; name = README.md; path = ../../../README.md; sourceTree = "<group>"; wrapsLines = 0; };
  322 + 3C28EDDD1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_app_caster_flv.cpp; path = ../../../src/app/srs_app_caster_flv.cpp; sourceTree = "<group>"; };
  323 + 3C28EDDE1AF5C43F00A3AEAC /* srs_app_caster_flv.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_app_caster_flv.hpp; path = ../../../src/app/srs_app_caster_flv.hpp; sourceTree = "<group>"; };
321 3C36DB551ABD1CB90066CCAF /* srs_lib_bandwidth.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_lib_bandwidth.cpp; path = ../../../src/libs/srs_lib_bandwidth.cpp; sourceTree = "<group>"; }; 324 3C36DB551ABD1CB90066CCAF /* srs_lib_bandwidth.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_lib_bandwidth.cpp; path = ../../../src/libs/srs_lib_bandwidth.cpp; sourceTree = "<group>"; };
322 3C36DB561ABD1CB90066CCAF /* srs_lib_bandwidth.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_lib_bandwidth.hpp; path = ../../../src/libs/srs_lib_bandwidth.hpp; sourceTree = "<group>"; }; 325 3C36DB561ABD1CB90066CCAF /* srs_lib_bandwidth.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = srs_lib_bandwidth.hpp; path = ../../../src/libs/srs_lib_bandwidth.hpp; sourceTree = "<group>"; };
323 3C36DB571ABD1CB90066CCAF /* srs_lib_simple_socket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_lib_simple_socket.cpp; path = ../../../src/libs/srs_lib_simple_socket.cpp; sourceTree = "<group>"; }; 326 3C36DB571ABD1CB90066CCAF /* srs_lib_simple_socket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = srs_lib_simple_socket.cpp; path = ../../../src/libs/srs_lib_simple_socket.cpp; sourceTree = "<group>"; };
@@ -511,6 +514,8 @@ @@ -511,6 +514,8 @@
511 3C12324B1AAE81CE00CE8F6C /* app */ = { 514 3C12324B1AAE81CE00CE8F6C /* app */ = {
512 isa = PBXGroup; 515 isa = PBXGroup;
513 children = ( 516 children = (
  517 + 3C28EDDD1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp */,
  518 + 3C28EDDE1AF5C43F00A3AEAC /* srs_app_caster_flv.hpp */,
514 3CD88B3D1ACA9C58000359E0 /* srs_app_async_call.cpp */, 519 3CD88B3D1ACA9C58000359E0 /* srs_app_async_call.cpp */,
515 3CD88B3E1ACA9C58000359E0 /* srs_app_async_call.hpp */, 520 3CD88B3E1ACA9C58000359E0 /* srs_app_async_call.hpp */,
516 3C12324C1AAE81D900CE8F6C /* srs_app_bandwidth.cpp */, 521 3C12324C1AAE81D900CE8F6C /* srs_app_bandwidth.cpp */,
@@ -908,6 +913,7 @@ @@ -908,6 +913,7 @@
908 3C1232261AAE814D00CE8F6C /* srs_kernel_flv.cpp in Sources */, 913 3C1232261AAE814D00CE8F6C /* srs_kernel_flv.cpp in Sources */,
909 3C663F1A1AB0155100286D8B /* srs_rtmp_dump.c in Sources */, 914 3C663F1A1AB0155100286D8B /* srs_rtmp_dump.c in Sources */,
910 3CE6CD311AE4AFB800706E07 /* srs_main_ingest_hls.cpp in Sources */, 915 3CE6CD311AE4AFB800706E07 /* srs_main_ingest_hls.cpp in Sources */,
  916 + 3C28EDDF1AF5C43F00A3AEAC /* srs_app_caster_flv.cpp in Sources */,
911 3C1232241AAE814D00CE8F6C /* srs_kernel_error.cpp in Sources */, 917 3C1232241AAE814D00CE8F6C /* srs_kernel_error.cpp in Sources */,
912 3C1232441AAE81A400CE8F6C /* srs_rtmp_handshake.cpp in Sources */, 918 3C1232441AAE81A400CE8F6C /* srs_rtmp_handshake.cpp in Sources */,
913 3C1232291AAE814D00CE8F6C /* srs_kernel_stream.cpp in Sources */, 919 3C1232291AAE814D00CE8F6C /* srs_kernel_stream.cpp in Sources */,
  1 +/*
  2 +The MIT License (MIT)
  3 +
  4 +Copyright (c) 2013-2015 SRS(simple-rtmp-server)
  5 +
  6 +Permission is hereby granted, free of charge, to any person obtaining a copy of
  7 +this software and associated documentation files (the "Software"), to deal in
  8 +the Software without restriction, including without limitation the rights to
  9 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  10 +the Software, and to permit persons to whom the Software is furnished to do so,
  11 +subject to the following conditions:
  12 +
  13 +The above copyright notice and this permission notice shall be included in all
  14 +copies or substantial portions of the Software.
  15 +
  16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22 +*/
  23 +
  24 +#include <srs_app_caster_flv.hpp>
  25 +
  26 +#ifdef SRS_AUTO_STREAM_CASTER
  27 +
  28 +#include <algorithm>
  29 +using namespace std;
  30 +
  31 +#include <srs_app_config.hpp>
  32 +#include <srs_kernel_error.hpp>
  33 +#include <srs_kernel_log.hpp>
  34 +#include <srs_app_config.hpp>
  35 +#include <srs_app_pithy_print.hpp>
  36 +#include <srs_app_http.hpp>
  37 +#include <srs_app_http_conn.hpp>
  38 +#include <srs_core_autofree.hpp>
  39 +
  40 +SrsAppCasterFlv::SrsAppCasterFlv(SrsConfDirective* c)
  41 +{
  42 + http_mux = new SrsHttpServeMux();
  43 + output = _srs_config->get_stream_caster_output(c);
  44 +}
  45 +
  46 +SrsAppCasterFlv::~SrsAppCasterFlv()
  47 +{
  48 +}
  49 +
  50 +int SrsAppCasterFlv::initialize()
  51 +{
  52 + int ret = ERROR_SUCCESS;
  53 +
  54 + if ((ret = http_mux->handle("/", this)) != ERROR_SUCCESS) {
  55 + return ret;
  56 + }
  57 +
  58 + return ret;
  59 +}
  60 +
  61 +int SrsAppCasterFlv::on_tcp_client(st_netfd_t stfd)
  62 +{
  63 + int ret = ERROR_SUCCESS;
  64 +
  65 + SrsHttpConn* conn = new SrsHttpConn(this, stfd, http_mux);
  66 + conns.push_back(conn);
  67 +
  68 + if ((ret = conn->start()) != ERROR_SUCCESS) {
  69 + return ret;
  70 + }
  71 +
  72 + return ret;
  73 +}
  74 +
  75 +void SrsAppCasterFlv::remove(SrsConnection* c)
  76 +{
  77 + std::vector<SrsHttpConn*>::iterator it;
  78 + if ((it = std::find(conns.begin(), conns.end(), c)) != conns.end()) {
  79 + conns.erase(it);
  80 + }
  81 +}
  82 +#define SRS_HTTP_FLV_STREAM_BUFFER 4096
  83 +int SrsAppCasterFlv::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
  84 +{
  85 + int ret = ERROR_SUCCESS;
  86 +
  87 + srs_info("flv: handle request at %s", r->path().c_str());
  88 +
  89 + char* buffer = new char[SRS_HTTP_FLV_STREAM_BUFFER];
  90 + SrsAutoFree(char, buffer);
  91 +
  92 + ISrsHttpResponseReader* rr = r->body_reader();
  93 + while (!rr->eof()) {
  94 + int nb_read = 0;
  95 + if ((ret = rr->read(buffer, SRS_HTTP_FLV_STREAM_BUFFER, &nb_read)) != ERROR_SUCCESS) {
  96 + return ret;
  97 + }
  98 + srs_trace("flv: read %dB from %s", nb_read, r->path().c_str());
  99 + }
  100 +
  101 + return ret;
  102 +}
  103 +
  104 +#endif
  1 +/*
  2 +The MIT License (MIT)
  3 +
  4 +Copyright (c) 2013-2015 SRS(simple-rtmp-server)
  5 +
  6 +Permission is hereby granted, free of charge, to any person obtaining a copy of
  7 +this software and associated documentation files (the "Software"), to deal in
  8 +the Software without restriction, including without limitation the rights to
  9 +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
  10 +the Software, and to permit persons to whom the Software is furnished to do so,
  11 +subject to the following conditions:
  12 +
  13 +The above copyright notice and this permission notice shall be included in all
  14 +copies or substantial portions of the Software.
  15 +
  16 +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17 +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
  18 +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
  19 +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
  20 +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  21 +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  22 +*/
  23 +
  24 +#ifndef SRS_APP_CASTER_FLV_HPP
  25 +#define SRS_APP_CASTER_FLV_HPP
  26 +
  27 +/*
  28 +#include <srs_app_caster_flv.hpp>
  29 +*/
  30 +
  31 +#include <srs_core.hpp>
  32 +
  33 +#include <string>
  34 +#include <vector>
  35 +
  36 +#ifdef SRS_AUTO_STREAM_CASTER
  37 +
  38 +class SrsConfDirective;
  39 +class SrsHttpServeMux;
  40 +class SrsHttpConn;
  41 +
  42 +#include <srs_app_st.hpp>
  43 +#include <srs_app_listener.hpp>
  44 +#include <srs_app_conn.hpp>
  45 +#include <srs_app_http.hpp>
  46 +
  47 +class SrsAppCasterFlv : virtual public ISrsTcpHandler
  48 + , virtual public IConnectionManager, virtual public ISrsHttpHandler
  49 +{
  50 +private:
  51 + std::string output;
  52 + SrsHttpServeMux* http_mux;
  53 + std::vector<SrsHttpConn*> conns;
  54 +public:
  55 + SrsAppCasterFlv(SrsConfDirective* c);
  56 + virtual ~SrsAppCasterFlv();
  57 +public:
  58 + virtual int initialize();
  59 +// ISrsTcpHandler
  60 +public:
  61 + virtual int on_tcp_client(st_netfd_t stfd);
  62 +// IConnectionManager
  63 +public:
  64 + virtual void remove(SrsConnection* c);
  65 +// ISrsHttpHandler
  66 +public:
  67 + virtual int serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r);
  68 +};
  69 +
  70 +#endif
  71 +
  72 +#endif
@@ -100,6 +100,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -100,6 +100,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
100 #define SRS_CONF_DEFAULT_STREAM_CASTER_ENABLED false 100 #define SRS_CONF_DEFAULT_STREAM_CASTER_ENABLED false
101 #define SRS_CONF_DEFAULT_STREAM_CASTER_MPEGTS_OVER_UDP "mpegts_over_udp" 101 #define SRS_CONF_DEFAULT_STREAM_CASTER_MPEGTS_OVER_UDP "mpegts_over_udp"
102 #define SRS_CONF_DEFAULT_STREAM_CASTER_RTSP "rtsp" 102 #define SRS_CONF_DEFAULT_STREAM_CASTER_RTSP "rtsp"
  103 +#define SRS_CONF_DEFAULT_STREAM_CASTER_FLV "flv"
103 104
104 #define SRS_CONF_DEFAULT_STATS_NETWORK_DEVICE_INDEX 0 105 #define SRS_CONF_DEFAULT_STATS_NETWORK_DEVICE_INDEX 0
105 106
@@ -25,14 +25,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -25,14 +25,21 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 25
26 #include <srs_kernel_log.hpp> 26 #include <srs_kernel_log.hpp>
27 #include <srs_kernel_error.hpp> 27 #include <srs_kernel_error.hpp>
28 -#include <srs_app_server.hpp>  
29 #include <srs_app_utility.hpp> 28 #include <srs_app_utility.hpp>
30 29
31 -SrsConnection::SrsConnection(SrsServer* srs_server, st_netfd_t client_stfd) 30 +IConnectionManager::IConnectionManager()
  31 +{
  32 +}
  33 +
  34 +IConnectionManager::~IConnectionManager()
  35 +{
  36 +}
  37 +
  38 +SrsConnection::SrsConnection(IConnectionManager* cm, st_netfd_t c)
32 { 39 {
33 id = 0; 40 id = 0;
34 - server = srs_server;  
35 - stfd = client_stfd; 41 + manager = cm;
  42 + stfd = c;
36 43
37 // the client thread should reap itself, 44 // the client thread should reap itself,
38 // so we never use joinable. 45 // so we never use joinable.
@@ -86,7 +93,7 @@ int SrsConnection::cycle() @@ -86,7 +93,7 @@ int SrsConnection::cycle()
86 void SrsConnection::on_thread_stop() 93 void SrsConnection::on_thread_stop()
87 { 94 {
88 // TODO: FIXME: never remove itself, use isolate thread to do cleanup. 95 // TODO: FIXME: never remove itself, use isolate thread to do cleanup.
89 - server->remove(this); 96 + manager->remove(this);
90 } 97 }
91 98
92 int SrsConnection::srs_id() 99 int SrsConnection::srs_id()
@@ -36,7 +36,22 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -36,7 +36,22 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
36 #include <srs_app_thread.hpp> 36 #include <srs_app_thread.hpp>
37 #include <srs_app_kbps.hpp> 37 #include <srs_app_kbps.hpp>
38 38
39 -class SrsServer; 39 +class SrsConnection;
  40 +
  41 +/**
  42 + * the manager for connection.
  43 + */
  44 +class IConnectionManager
  45 +{
  46 +public:
  47 + IConnectionManager();
  48 + virtual ~IConnectionManager();
  49 +public:
  50 + /**
  51 + * remove the specified connection.
  52 + */
  53 + virtual void remove(SrsConnection* c) = 0;
  54 +};
40 55
41 /** 56 /**
42 * the basic connection of SRS, 57 * the basic connection of SRS,
@@ -57,9 +72,9 @@ private: @@ -57,9 +72,9 @@ private:
57 int id; 72 int id;
58 protected: 73 protected:
59 /** 74 /**
60 - * the server object to manage the connection. 75 + * the manager object to manage the connection.
61 */ 76 */
62 - SrsServer* server; 77 + IConnectionManager* manager;
63 /** 78 /**
64 * the underlayer st fd handler. 79 * the underlayer st fd handler.
65 */ 80 */
@@ -69,7 +84,7 @@ protected: @@ -69,7 +84,7 @@ protected:
69 */ 84 */
70 std::string ip; 85 std::string ip;
71 public: 86 public:
72 - SrsConnection(SrsServer* srs_server, st_netfd_t client_stfd); 87 + SrsConnection(IConnectionManager* cm, st_netfd_t c);
73 virtual ~SrsConnection(); 88 virtual ~SrsConnection();
74 public: 89 public:
75 /** 90 /**
@@ -473,8 +473,8 @@ int SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r) @@ -473,8 +473,8 @@ int SrsGoApiStreams::serve_http(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
473 return srs_go_http_response_json(w, ss.str()); 473 return srs_go_http_response_json(w, ss.str());
474 } 474 }
475 475
476 -SrsHttpApi::SrsHttpApi(SrsServer* svr, st_netfd_t fd, SrsHttpServeMux* m)  
477 - : SrsConnection(svr, fd) 476 +SrsHttpApi::SrsHttpApi(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m)
  477 + : SrsConnection(cm, fd)
478 { 478 {
479 mux = m; 479 mux = m;
480 parser = new SrsHttpParser(); 480 parser = new SrsHttpParser();
@@ -166,7 +166,7 @@ private: @@ -166,7 +166,7 @@ private:
166 SrsHttpServeMux* mux; 166 SrsHttpServeMux* mux;
167 bool crossdomain_required; 167 bool crossdomain_required;
168 public: 168 public:
169 - SrsHttpApi(SrsServer* svr, st_netfd_t fd, SrsHttpServeMux* m); 169 + SrsHttpApi(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m);
170 virtual ~SrsHttpApi(); 170 virtual ~SrsHttpApi();
171 // interface IKbpsDelta 171 // interface IKbpsDelta
172 public: 172 public:
@@ -1334,11 +1334,11 @@ int SrsHttpServer::initialize_hls_streaming() @@ -1334,11 +1334,11 @@ int SrsHttpServer::initialize_hls_streaming()
1334 return ret; 1334 return ret;
1335 } 1335 }
1336 1336
1337 -SrsHttpConn::SrsHttpConn(SrsServer* svr, st_netfd_t fd, SrsHttpServer* m)  
1338 - : SrsConnection(svr, fd) 1337 +SrsHttpConn::SrsHttpConn(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m)
  1338 + : SrsConnection(cm, fd)
1339 { 1339 {
1340 parser = new SrsHttpParser(); 1340 parser = new SrsHttpParser();
1341 - http_server = m; 1341 + http_mux = m;
1342 } 1342 }
1343 1343
1344 SrsHttpConn::~SrsHttpConn() 1344 SrsHttpConn::~SrsHttpConn()
@@ -1424,7 +1424,7 @@ int SrsHttpConn::process_request(ISrsHttpResponseWriter* w, SrsHttpMessage* r) @@ -1424,7 +1424,7 @@ int SrsHttpConn::process_request(ISrsHttpResponseWriter* w, SrsHttpMessage* r)
1424 r->method_str().c_str(), r->url().c_str(), r->content_length()); 1424 r->method_str().c_str(), r->url().c_str(), r->content_length());
1425 1425
1426 // use default server mux to serve http request. 1426 // use default server mux to serve http request.
1427 - if ((ret = http_server->mux.serve_http(w, r)) != ERROR_SUCCESS) { 1427 + if ((ret = http_mux->serve_http(w, r)) != ERROR_SUCCESS) {
1428 if (!srs_is_client_gracefully_close(ret)) { 1428 if (!srs_is_client_gracefully_close(ret)) {
1429 srs_error("serve http msg failed. ret=%d", ret); 1429 srs_error("serve http msg failed. ret=%d", ret);
1430 } 1430 }
@@ -39,6 +39,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -39,6 +39,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
39 #include <srs_kernel_file.hpp> 39 #include <srs_kernel_file.hpp>
40 #include <srs_app_thread.hpp> 40 #include <srs_app_thread.hpp>
41 41
  42 +class SrsServer;
42 class SrsSource; 43 class SrsSource;
43 class SrsRequest; 44 class SrsRequest;
44 class SrsConsumer; 45 class SrsConsumer;
@@ -375,9 +376,9 @@ class SrsHttpConn : public SrsConnection @@ -375,9 +376,9 @@ class SrsHttpConn : public SrsConnection
375 { 376 {
376 private: 377 private:
377 SrsHttpParser* parser; 378 SrsHttpParser* parser;
378 - SrsHttpServer* http_server; 379 + SrsHttpServeMux* http_mux;
379 public: 380 public:
380 - SrsHttpConn(SrsServer* svr, st_netfd_t fd, SrsHttpServer* m); 381 + SrsHttpConn(IConnectionManager* cm, st_netfd_t fd, SrsHttpServeMux* m);
381 virtual ~SrsHttpConn(); 382 virtual ~SrsHttpConn();
382 // interface IKbpsDelta 383 // interface IKbpsDelta
383 public: 384 public:
@@ -75,12 +75,13 @@ using namespace std; @@ -75,12 +75,13 @@ using namespace std;
75 // when edge timeout, retry next. 75 // when edge timeout, retry next.
76 #define SRS_EDGE_TOKEN_TRAVERSE_TIMEOUT_US (int64_t)(3*1000*1000LL) 76 #define SRS_EDGE_TOKEN_TRAVERSE_TIMEOUT_US (int64_t)(3*1000*1000LL)
77 77
78 -SrsRtmpConn::SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd)  
79 - : SrsConnection(srs_server, client_stfd) 78 +SrsRtmpConn::SrsRtmpConn(SrsServer* svr, st_netfd_t c)
  79 + : SrsConnection(svr, c)
80 { 80 {
  81 + server = svr;
81 req = new SrsRequest(); 82 req = new SrsRequest();
82 res = new SrsResponse(); 83 res = new SrsResponse();
83 - skt = new SrsStSocket(client_stfd); 84 + skt = new SrsStSocket(c);
84 rtmp = new SrsRtmpServer(skt); 85 rtmp = new SrsRtmpServer(skt);
85 refer = new SrsRefer(); 86 refer = new SrsRefer();
86 bandwidth = new SrsBandwidth(); 87 bandwidth = new SrsBandwidth();
@@ -34,6 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -34,6 +34,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
34 #include <srs_app_conn.hpp> 34 #include <srs_app_conn.hpp>
35 #include <srs_app_reload.hpp> 35 #include <srs_app_reload.hpp>
36 36
  37 +class SrsServer;
37 class SrsRtmpServer; 38 class SrsRtmpServer;
38 class SrsRequest; 39 class SrsRequest;
39 class SrsResponse; 40 class SrsResponse;
@@ -61,6 +62,7 @@ class SrsRtmpConn : public virtual SrsConnection, public virtual ISrsReloadHandl @@ -61,6 +62,7 @@ class SrsRtmpConn : public virtual SrsConnection, public virtual ISrsReloadHandl
61 // for the thread to directly access any field of connection. 62 // for the thread to directly access any field of connection.
62 friend class SrsPublishRecvThread; 63 friend class SrsPublishRecvThread;
63 private: 64 private:
  65 + SrsServer* server;
64 SrsRequest* req; 66 SrsRequest* req;
65 SrsResponse* res; 67 SrsResponse* res;
66 SrsStSocket* skt; 68 SrsStSocket* skt;
@@ -81,7 +83,7 @@ private: @@ -81,7 +83,7 @@ private:
81 // @see https://github.com/simple-rtmp-server/srs/issues/257 83 // @see https://github.com/simple-rtmp-server/srs/issues/257
82 bool realtime; 84 bool realtime;
83 public: 85 public:
84 - SrsRtmpConn(SrsServer* srs_server, st_netfd_t client_stfd); 86 + SrsRtmpConn(SrsServer* svr, st_netfd_t c);
85 virtual ~SrsRtmpConn(); 87 virtual ~SrsRtmpConn();
86 protected: 88 protected:
87 virtual int do_cycle(); 89 virtual int do_cycle();
@@ -46,6 +46,7 @@ using namespace std; @@ -46,6 +46,7 @@ using namespace std;
46 #include <srs_app_mpegts_udp.hpp> 46 #include <srs_app_mpegts_udp.hpp>
47 #include <srs_app_rtsp.hpp> 47 #include <srs_app_rtsp.hpp>
48 #include <srs_app_statistic.hpp> 48 #include <srs_app_statistic.hpp>
  49 +#include <srs_app_caster_flv.hpp>
49 50
50 // signal defines. 51 // signal defines.
51 #define SIGNAL_RELOAD SIGHUP 52 #define SIGNAL_RELOAD SIGHUP
@@ -105,6 +106,8 @@ std::string srs_listener_type2string(SrsListenerType type) @@ -105,6 +106,8 @@ std::string srs_listener_type2string(SrsListenerType type)
105 return "MPEG-TS over UDP"; 106 return "MPEG-TS over UDP";
106 case SrsListenerRtsp: 107 case SrsListenerRtsp:
107 return "RTSP"; 108 return "RTSP";
  109 + case SrsListenerFlv:
  110 + return "HTTP-FLV";
108 default: 111 default:
109 return "UNKONWN"; 112 return "UNKONWN";
110 } 113 }
@@ -206,7 +209,7 @@ int SrsRtspListener::listen(string ip, int port) @@ -206,7 +209,7 @@ int SrsRtspListener::listen(string ip, int port)
206 listener = new SrsTcpListener(this, ip, port); 209 listener = new SrsTcpListener(this, ip, port);
207 210
208 if ((ret = listener->listen()) != ERROR_SUCCESS) { 211 if ((ret = listener->listen()) != ERROR_SUCCESS) {
209 - srs_error("udp caster listen failed. ret=%d", ret); 212 + srs_error("rtsp caster listen failed. ret=%d", ret);
210 return ret; 213 return ret;
211 } 214 }
212 215
@@ -231,6 +234,68 @@ int SrsRtspListener::on_tcp_client(st_netfd_t stfd) @@ -231,6 +234,68 @@ int SrsRtspListener::on_tcp_client(st_netfd_t stfd)
231 return ret; 234 return ret;
232 } 235 }
233 236
  237 +SrsHttpFlvListener::SrsHttpFlvListener(SrsServer* server, SrsListenerType type, SrsConfDirective* c) : SrsListener(server, type)
  238 +{
  239 + listener = NULL;
  240 +
  241 + // the caller already ensure the type is ok,
  242 + // we just assert here for unknown stream caster.
  243 + srs_assert(_type == SrsListenerFlv);
  244 + if (_type == SrsListenerFlv) {
  245 + caster = new SrsAppCasterFlv(c);
  246 + }
  247 +}
  248 +
  249 +SrsHttpFlvListener::~SrsHttpFlvListener()
  250 +{
  251 + srs_freep(caster);
  252 + srs_freep(listener);
  253 +}
  254 +
  255 +int SrsHttpFlvListener::listen(string ip, int port)
  256 +{
  257 + int ret = ERROR_SUCCESS;
  258 +
  259 + // the caller already ensure the type is ok,
  260 + // we just assert here for unknown stream caster.
  261 + srs_assert(_type == SrsListenerFlv);
  262 +
  263 + _ip = ip;
  264 + _port = port;
  265 +
  266 + if ((ret = caster->initialize()) != ERROR_SUCCESS) {
  267 + return ret;
  268 + }
  269 +
  270 + srs_freep(listener);
  271 + listener = new SrsTcpListener(this, ip, port);
  272 +
  273 + if ((ret = listener->listen()) != ERROR_SUCCESS) {
  274 + srs_error("flv caster listen failed. ret=%d", ret);
  275 + return ret;
  276 + }
  277 +
  278 + srs_info("listen thread cid=%d, current_cid=%d, "
  279 + "listen at port=%d, type=%d, fd=%d started success, ep=%s:%d",
  280 + pthread->cid(), _srs_context->get_id(), _port, _type, fd, ip.c_str(), port);
  281 +
  282 + srs_trace("%s listen at tcp://%s:%d, fd=%d", srs_listener_type2string(_type).c_str(), ip.c_str(), _port, listener->fd());
  283 +
  284 + return ret;
  285 +}
  286 +
  287 +int SrsHttpFlvListener::on_tcp_client(st_netfd_t stfd)
  288 +{
  289 + int ret = ERROR_SUCCESS;
  290 +
  291 + if ((ret = caster->on_tcp_client(stfd)) != ERROR_SUCCESS) {
  292 + srs_warn("accept client error. ret=%d", ret);
  293 + return ret;
  294 + }
  295 +
  296 + return ret;
  297 +}
  298 +
234 SrsUdpCasterListener::SrsUdpCasterListener(SrsServer* server, SrsListenerType type, SrsConfDirective* c) : SrsListener(server, type) 299 SrsUdpCasterListener::SrsUdpCasterListener(SrsServer* server, SrsListenerType type, SrsConfDirective* c) : SrsListener(server, type)
235 { 300 {
236 _type = type; 301 _type = type;
@@ -1003,6 +1068,8 @@ int SrsServer::listen_stream_caster() @@ -1003,6 +1068,8 @@ int SrsServer::listen_stream_caster()
1003 listener = new SrsUdpCasterListener(this, SrsListenerMpegTsOverUdp, stream_caster); 1068 listener = new SrsUdpCasterListener(this, SrsListenerMpegTsOverUdp, stream_caster);
1004 } else if (caster == SRS_CONF_DEFAULT_STREAM_CASTER_RTSP) { 1069 } else if (caster == SRS_CONF_DEFAULT_STREAM_CASTER_RTSP) {
1005 listener = new SrsRtspListener(this, SrsListenerRtsp, stream_caster); 1070 listener = new SrsRtspListener(this, SrsListenerRtsp, stream_caster);
  1071 + } else if (caster == SRS_CONF_DEFAULT_STREAM_CASTER_FLV) {
  1072 + listener = new SrsHttpFlvListener(this, SrsListenerFlv, stream_caster);
1006 } else { 1073 } else {
1007 ret = ERROR_STREAM_CASTER_ENGINE; 1074 ret = ERROR_STREAM_CASTER_ENGINE;
1008 srs_error("unsupported stream caster %s. ret=%d", caster.c_str(), ret); 1075 srs_error("unsupported stream caster %s. ret=%d", caster.c_str(), ret);
@@ -1096,7 +1163,7 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd) @@ -1096,7 +1163,7 @@ int SrsServer::accept_client(SrsListenerType type, st_netfd_t client_stfd)
1096 #endif 1163 #endif
1097 } else if (type == SrsListenerHttpStream) { 1164 } else if (type == SrsListenerHttpStream) {
1098 #ifdef SRS_AUTO_HTTP_SERVER 1165 #ifdef SRS_AUTO_HTTP_SERVER
1099 - conn = new SrsHttpConn(this, client_stfd, http_stream_mux); 1166 + conn = new SrsHttpConn(this, client_stfd, &http_stream_mux->mux);
1100 #else 1167 #else
1101 srs_warn("close http client for server not support http-server"); 1168 srs_warn("close http client for server not support http-server");
1102 srs_close_stfd(client_stfd); 1169 srs_close_stfd(client_stfd);
@@ -38,6 +38,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -38,6 +38,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38 #include <srs_app_source.hpp> 38 #include <srs_app_source.hpp>
39 #include <srs_app_hls.hpp> 39 #include <srs_app_hls.hpp>
40 #include <srs_app_listener.hpp> 40 #include <srs_app_listener.hpp>
  41 +#include <srs_app_conn.hpp>
41 42
42 class SrsServer; 43 class SrsServer;
43 class SrsConnection; 44 class SrsConnection;
@@ -51,6 +52,9 @@ class ISrsTcpHandler; @@ -51,6 +52,9 @@ class ISrsTcpHandler;
51 class ISrsUdpHandler; 52 class ISrsUdpHandler;
52 class SrsUdpListener; 53 class SrsUdpListener;
53 class SrsTcpListener; 54 class SrsTcpListener;
  55 +#ifdef SRS_AUTO_STREAM_CASTER
  56 +class SrsAppCasterFlv;
  57 +#endif
54 58
55 // listener type for server to identify the connection, 59 // listener type for server to identify the connection,
56 // that is, use different type to process the connection. 60 // that is, use different type to process the connection.
@@ -66,6 +70,8 @@ enum SrsListenerType @@ -66,6 +70,8 @@ enum SrsListenerType
66 SrsListenerMpegTsOverUdp = 3, 70 SrsListenerMpegTsOverUdp = 3,
67 // TCP stream, RTSP stream. 71 // TCP stream, RTSP stream.
68 SrsListenerRtsp = 4, 72 SrsListenerRtsp = 4,
  73 + // TCP stream, FLV stream over HTTP.
  74 + SrsListenerFlv = 5,
69 }; 75 };
70 76
71 /** 77 /**
@@ -124,6 +130,24 @@ public: @@ -124,6 +130,24 @@ public:
124 }; 130 };
125 131
126 /** 132 /**
  133 + * the tcp listener, for flv stream server.
  134 + */
  135 +class SrsHttpFlvListener : virtual public SrsListener, virtual public ISrsTcpHandler
  136 +{
  137 +private:
  138 + SrsTcpListener* listener;
  139 + SrsAppCasterFlv* caster;
  140 +public:
  141 + SrsHttpFlvListener(SrsServer* server, SrsListenerType type, SrsConfDirective* c);
  142 + virtual ~SrsHttpFlvListener();
  143 +public:
  144 + virtual int listen(std::string ip, int port);
  145 +// ISrsTcpHandler
  146 +public:
  147 + virtual int on_tcp_client(st_netfd_t stfd);
  148 +};
  149 +
  150 +/**
127 * the udp listener, for udp server. 151 * the udp listener, for udp server.
128 */ 152 */
129 class SrsUdpCasterListener : public SrsListener 153 class SrsUdpCasterListener : public SrsListener
@@ -195,6 +219,7 @@ public: @@ -195,6 +219,7 @@ public:
195 */ 219 */
196 class SrsServer : virtual public ISrsReloadHandler 220 class SrsServer : virtual public ISrsReloadHandler
197 , virtual public ISrsSourceHandler, virtual public ISrsHlsHandler 221 , virtual public ISrsSourceHandler, virtual public ISrsHlsHandler
  222 + , virtual public IConnectionManager
198 { 223 {
199 private: 224 private:
200 #ifdef SRS_AUTO_HTTP_API 225 #ifdef SRS_AUTO_HTTP_API
@@ -259,7 +284,7 @@ public: @@ -259,7 +284,7 @@ public:
259 virtual int http_handle(); 284 virtual int http_handle();
260 virtual int ingest(); 285 virtual int ingest();
261 virtual int cycle(); 286 virtual int cycle();
262 -// server utility 287 +// IConnectionManager
263 public: 288 public:
264 /** 289 /**
265 * callback for connection to remove itself. 290 * callback for connection to remove itself.
@@ -267,6 +292,8 @@ public: @@ -267,6 +292,8 @@ public:
267 * @see SrsConnection.on_thread_stop(). 292 * @see SrsConnection.on_thread_stop().
268 */ 293 */
269 virtual void remove(SrsConnection* conn); 294 virtual void remove(SrsConnection* conn);
  295 +// server utilities.
  296 +public:
270 /** 297 /**
271 * callback for signal manager got a signal. 298 * callback for signal manager got a signal.
272 * the signal manager convert signal to io message, 299 * the signal manager convert signal to io message,