fix #180: crash for multiple edge publishing the same stream. 0.9.220.
正在显示
5 个修改的文件
包含
24 行增加
和
6 行删除
@@ -208,6 +208,7 @@ Supported operating systems and hardware: | @@ -208,6 +208,7 @@ Supported operating systems and hardware: | ||
208 | * 2013-10-17, Created.<br/> | 208 | * 2013-10-17, Created.<br/> |
209 | 209 | ||
210 | ## History | 210 | ## History |
211 | +* v1.0, 2014-09-30, fix [#180](https://github.com/winlinvip/simple-rtmp-server/issues/180), crash for multiple edge publishing the same stream. 0.9.220. | ||
211 | * v1.0, 2014-09-26, fix hls bug, refine config and log, according to clion of jetbrains. 0.9.216. | 212 | * v1.0, 2014-09-26, fix hls bug, refine config and log, according to clion of jetbrains. 0.9.216. |
212 | * v1.0, 2014-09-25, fix [#177](https://github.com/winlinvip/simple-rtmp-server/issues/177), dvr segment add config dvr_wait_keyframe. 0.9.213. | 213 | * v1.0, 2014-09-25, fix [#177](https://github.com/winlinvip/simple-rtmp-server/issues/177), dvr segment add config dvr_wait_keyframe. 0.9.213. |
213 | * v1.0, 2014-08-28, fix [#167](https://github.com/winlinvip/simple-rtmp-server/issues/167), add openssl includes to utest. 0.9.209. | 214 | * v1.0, 2014-08-28, fix [#167](https://github.com/winlinvip/simple-rtmp-server/issues/167), add openssl includes to utest. 0.9.209. |
@@ -814,13 +814,25 @@ int SrsPublishEdge::on_client_publish() | @@ -814,13 +814,25 @@ int SrsPublishEdge::on_client_publish() | ||
814 | return ret; | 814 | return ret; |
815 | } | 815 | } |
816 | 816 | ||
817 | - if ((ret = forwarder->start()) != ERROR_SUCCESS) { | ||
818 | - return ret; | ||
819 | - } | ||
820 | - | 817 | + // @see https://github.com/winlinvip/simple-rtmp-server/issues/180 |
818 | + // to avoid multiple publish the same stream on the same edge, | ||
819 | + // directly enter the publish stage. | ||
820 | + if (true) { | ||
821 | SrsEdgeState pstate = state; | 821 | SrsEdgeState pstate = state; |
822 | state = SrsEdgeStatePublish; | 822 | state = SrsEdgeStatePublish; |
823 | srs_trace("edge change from %d to state %d (push).", pstate, state); | 823 | srs_trace("edge change from %d to state %d (push).", pstate, state); |
824 | + } | ||
825 | + | ||
826 | + // start to forward stream to origin. | ||
827 | + ret = forwarder->start(); | ||
828 | + | ||
829 | + // @see https://github.com/winlinvip/simple-rtmp-server/issues/180 | ||
830 | + // when failed, revert to init | ||
831 | + if (ret != ERROR_SUCCESS) { | ||
832 | + SrsEdgeState pstate = state; | ||
833 | + state = SrsEdgeStateInit; | ||
834 | + srs_trace("edge revert from %d to state %d (push). ret=%d", pstate, state, ret); | ||
835 | + } | ||
824 | 836 | ||
825 | return ret; | 837 | return ret; |
826 | } | 838 | } |
@@ -57,7 +57,7 @@ enum SrsEdgeState | @@ -57,7 +57,7 @@ enum SrsEdgeState | ||
57 | // for play edge | 57 | // for play edge |
58 | SrsEdgeStatePlay = 100, | 58 | SrsEdgeStatePlay = 100, |
59 | // play stream from origin, ingest stream | 59 | // play stream from origin, ingest stream |
60 | - SrsEdgeStateIngestConnected, | 60 | + SrsEdgeStateIngestConnected = 101, |
61 | 61 | ||
62 | // for publish edge | 62 | // for publish edge |
63 | SrsEdgeStatePublish = 200, | 63 | SrsEdgeStatePublish = 200, |
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
31 | // current release version | 31 | // current release version |
32 | #define VERSION_MAJOR "0" | 32 | #define VERSION_MAJOR "0" |
33 | #define VERSION_MINOR "9" | 33 | #define VERSION_MINOR "9" |
34 | -#define VERSION_REVISION "219" | 34 | +#define VERSION_REVISION "220" |
35 | #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION | 35 | #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION |
36 | // server info. | 36 | // server info. |
37 | #define RTMP_SIG_SRS_KEY "SRS" | 37 | #define RTMP_SIG_SRS_KEY "SRS" |
@@ -139,6 +139,11 @@ int main(int argc, char** argv) | @@ -139,6 +139,11 @@ int main(int argc, char** argv) | ||
139 | { | 139 | { |
140 | int ret = ERROR_SUCCESS; | 140 | int ret = ERROR_SUCCESS; |
141 | 141 | ||
142 | +// TODO: FIXME: remove following. | ||
143 | +char* ptr = new char[1024]; | ||
144 | +delete ptr; | ||
145 | +ptr[0] = 0; | ||
146 | + | ||
142 | // TODO: support both little and big endian. | 147 | // TODO: support both little and big endian. |
143 | srs_assert(srs_is_little_endian()); | 148 | srs_assert(srs_is_little_endian()); |
144 | 149 |
-
请 注册 或 登录 后发表评论