Skip to content

Commit

Permalink
for #474, always release publish for source.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Sep 14, 2015
1 parent 0d57ef9 commit a994191
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ Remark:

## 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 [#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
Expand Down Expand Up @@ -1026,6 +1027,7 @@ Winlin
[bug #133]: https://github.com/simple-rtmp-server/srs/issues/133
[bug #92]: https://github.com/simple-rtmp-server/srs/issues/92
[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 #458]: https://github.com/simple-rtmp-server/srs/issues/458
[bug #454]: https://github.com/simple-rtmp-server/srs/issues/454
Expand Down
10 changes: 8 additions & 2 deletions trunk/src/app/srs_app_rtmp_conn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down Expand Up @@ -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;
}
}

Expand Down
1 change: 1 addition & 0 deletions trunk/src/app/srs_app_source.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2066,6 +2066,7 @@ int SrsSource::on_publish()
}
SrsStatistic* stat = SrsStatistic::instance();
stat->on_stream_publish(_req, _source_id);

return ret;
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/src/app/srs_app_thread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit a994191

Please sign in to comment.