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

for #474, always release publish for source.

This commit is contained in:
winlin 2015-09-14 15:10:34 +08:00
parent 0d57ef9373
commit a994191ddc
4 changed files with 13 additions and 2 deletions

View file

@ -834,9 +834,13 @@ int SrsRtmpConn::publishing(SrsSource* source)
// stop isolate recv thread
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();
@ -944,10 +948,12 @@ int SrsRtmpConn::acquire_publish(SrsSource* source, bool is_edge)
if (is_edge) {
if ((ret = source->on_edge_start_publish()) != ERROR_SUCCESS) {
srs_error("notice edge start publish stream failed. ret=%d", ret);
return ret;
}
} else {
if ((ret = source->on_publish()) != ERROR_SUCCESS) {
srs_error("notify publish failed. ret=%d", ret);
return ret;
}
}

View file

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

View file

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