for #474, always release publish for source.

pull/483/head
winlin 10 years ago
parent 0d57ef9373
commit a994191ddc

@ -343,6 +343,7 @@ Remark:
## History ## History
* v2.0, 2015-09-14, for [#474][bug #474] always release publish for source.
* v2.0, 2015-09-14, for [#458][bug #458] http hooks use source thread cid. 2.0.188 * v2.0, 2015-09-14, for [#458][bug #458] http hooks use source thread cid. 2.0.188
* v2.0, 2015-09-14, for [#475][bug #475] fix http hooks crash for st context switch. 2.0.187 * v2.0, 2015-09-14, for [#475][bug #475] fix http hooks crash for st context switch. 2.0.187
* v2.0, 2015-09-09, support reload utc_time. 2.0.186 * v2.0, 2015-09-09, support reload utc_time. 2.0.186
@ -1026,6 +1027,7 @@ Winlin
[bug #133]: https://github.com/simple-rtmp-server/srs/issues/133 [bug #133]: https://github.com/simple-rtmp-server/srs/issues/133
[bug #92]: https://github.com/simple-rtmp-server/srs/issues/92 [bug #92]: https://github.com/simple-rtmp-server/srs/issues/92
[bug #380]: https://github.com/simple-rtmp-server/srs/issues/380 [bug #380]: https://github.com/simple-rtmp-server/srs/issues/380
[bug #474]: https://github.com/simple-rtmp-server/srs/issues/474
[bug #475]: https://github.com/simple-rtmp-server/srs/issues/475 [bug #475]: https://github.com/simple-rtmp-server/srs/issues/475
[bug #458]: https://github.com/simple-rtmp-server/srs/issues/458 [bug #458]: https://github.com/simple-rtmp-server/srs/issues/458
[bug #454]: https://github.com/simple-rtmp-server/srs/issues/454 [bug #454]: https://github.com/simple-rtmp-server/srs/issues/454

@ -834,10 +834,14 @@ int SrsRtmpConn::publishing(SrsSource* source)
// stop isolate recv thread // stop isolate recv thread
trd.stop(); trd.stop();
release_publish(source, vhost_is_edge);
} }
// whatever the acquire publish, always release publish.
// when the acquire error in the midlle-way, the publish state changed,
// but failed, so we must cleanup it.
// @see https://github.com/simple-rtmp-server/srs/issues/474
release_publish(source, vhost_is_edge);
http_hooks_on_unpublish(); http_hooks_on_unpublish();
return ret; return ret;
@ -944,10 +948,12 @@ int SrsRtmpConn::acquire_publish(SrsSource* source, bool is_edge)
if (is_edge) { if (is_edge) {
if ((ret = source->on_edge_start_publish()) != ERROR_SUCCESS) { if ((ret = source->on_edge_start_publish()) != ERROR_SUCCESS) {
srs_error("notice edge start publish stream failed. ret=%d", ret); srs_error("notice edge start publish stream failed. ret=%d", ret);
return ret;
} }
} else { } else {
if ((ret = source->on_publish()) != ERROR_SUCCESS) { if ((ret = source->on_publish()) != ERROR_SUCCESS) {
srs_error("notify publish failed. ret=%d", ret); srs_error("notify publish failed. ret=%d", ret);
return ret;
} }
} }

@ -2066,6 +2066,7 @@ int SrsSource::on_publish()
} }
SrsStatistic* stat = SrsStatistic::instance(); SrsStatistic* stat = SrsStatistic::instance();
stat->on_stream_publish(_req, _source_id); stat->on_stream_publish(_req, _source_id);
return ret; return ret;
} }

@ -217,6 +217,8 @@ namespace internal {
handler->on_thread_stop(); handler->on_thread_stop();
srs_info("thread %s cycle finished", _name); srs_info("thread %s cycle finished", _name);
// TODO: FIXME: when thread terminated normally, set the tid to NULL.
} }
void* SrsThread::thread_fun(void* arg) void* SrsThread::thread_fun(void* arg)

Loading…
Cancel
Save