winlin

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

... ... @@ -208,6 +208,7 @@ Supported operating systems and hardware:
* 2013-10-17, Created.<br/>
## 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-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.
... ...
... ... @@ -814,13 +814,25 @@ int SrsPublishEdge::on_client_publish()
return ret;
}
if ((ret = forwarder->start()) != ERROR_SUCCESS) {
return ret;
// @see https://github.com/winlinvip/simple-rtmp-server/issues/180
// 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;
state = SrsEdgeStatePublish;
srs_trace("edge change from %d to state %d (push).", pstate, state);
// start to forward stream to origin.
ret = forwarder->start();
// @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;
}
... ...
... ... @@ -57,7 +57,7 @@ enum SrsEdgeState
// for play edge
SrsEdgeStatePlay = 100,
// play stream from origin, ingest stream
SrsEdgeStateIngestConnected,
SrsEdgeStateIngestConnected = 101,
// for publish edge
SrsEdgeStatePublish = 200,
... ...
... ... @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR "0"
#define VERSION_MINOR "9"
#define VERSION_REVISION "219"
#define VERSION_REVISION "220"
#define RTMP_SIG_SRS_VERSION VERSION_MAJOR"."VERSION_MINOR"."VERSION_REVISION
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
... ...
... ... @@ -138,6 +138,11 @@ void show_macro_features()
int main(int argc, char** argv)
{
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.
srs_assert(srs_is_little_endian());
... ...