1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

fix #180: crash for multiple edge publishing the same stream. 0.9.220.

This commit is contained in:
winlin 2014-09-30 11:21:46 +08:00
parent bc6616bd1f
commit f3002144fc
5 changed files with 25 additions and 7 deletions

View file

@ -208,6 +208,7 @@ Supported operating systems and hardware:
* 2013-10-17, Created.<br/> * 2013-10-17, Created.<br/>
## History ## History
* 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.
* v1.0, 2014-09-26, fix hls bug, refine config and log, according to clion of jetbrains. 0.9.216. * v1.0, 2014-09-26, fix hls bug, refine config and log, according to clion of jetbrains. 0.9.216.
* 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. * 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.
* v1.0, 2014-08-28, fix [#167](https://github.com/winlinvip/simple-rtmp-server/issues/167), add openssl includes to utest. 0.9.209. * v1.0, 2014-08-28, fix [#167](https://github.com/winlinvip/simple-rtmp-server/issues/167), add openssl includes to utest. 0.9.209.

View file

@ -814,13 +814,25 @@ int SrsPublishEdge::on_client_publish()
return ret; return ret;
} }
if ((ret = forwarder->start()) != ERROR_SUCCESS) { // @see https://github.com/winlinvip/simple-rtmp-server/issues/180
return ret; // to avoid multiple publish the same stream on the same edge,
// directly enter the publish stage.
if (true) {
SrsEdgeState pstate = state;
state = SrsEdgeStatePublish;
srs_trace("edge change from %d to state %d (push).", pstate, state);
} }
SrsEdgeState pstate = state; // start to forward stream to origin.
state = SrsEdgeStatePublish; ret = forwarder->start();
srs_trace("edge change from %d to state %d (push).", pstate, state);
// @see https://github.com/winlinvip/simple-rtmp-server/issues/180
// when failed, revert to init
if (ret != ERROR_SUCCESS) {
SrsEdgeState pstate = state;
state = SrsEdgeStateInit;
srs_trace("edge revert from %d to state %d (push). ret=%d", pstate, state, ret);
}
return ret; return ret;
} }

View file

@ -57,7 +57,7 @@ enum SrsEdgeState
// for play edge // for play edge
SrsEdgeStatePlay = 100, SrsEdgeStatePlay = 100,
// play stream from origin, ingest stream // play stream from origin, ingest stream
SrsEdgeStateIngestConnected, SrsEdgeStateIngestConnected = 101,
// for publish edge // for publish edge
SrsEdgeStatePublish = 200, SrsEdgeStatePublish = 200,

View file

@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version // current release version
#define VERSION_MAJOR "0" #define VERSION_MAJOR "0"
#define VERSION_MINOR "9" #define VERSION_MINOR "9"
#define VERSION_REVISION "219" #define VERSION_REVISION "220"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION #define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info. // server info.
#define RTMP_SIG_SRS_KEY "SRS" #define RTMP_SIG_SRS_KEY "SRS"

View file

@ -139,6 +139,11 @@ int main(int argc, char** argv)
{ {
int ret = ERROR_SUCCESS; int ret = ERROR_SUCCESS;
// TODO: FIXME: remove following.
char* ptr = new char[1024];
delete ptr;
ptr[0] = 0;
// TODO: support both little and big endian. // TODO: support both little and big endian.
srs_assert(srs_is_little_endian()); srs_assert(srs_is_little_endian());