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

for #742, refine the object live cycle. 3.0.15

This commit is contained in:
winlin 2017-01-17 10:44:13 +08:00
parent f4c0af8bfc
commit dca9749f37
19 changed files with 286 additions and 226 deletions

View file

@ -57,7 +57,7 @@ SrsForwarder::SrsForwarder(SrsSource* s)
req = NULL;
sh_video = sh_audio = NULL;
sdk = new SrsSimpleRtmpClient();
sdk = NULL;
pthread = new SrsReusableThread2("forward", this, SRS_FORWARDER_SLEEP_US);
queue = new SrsMessageQueue();
jitter = new SrsRtmpJitter();
@ -236,9 +236,12 @@ int SrsForwarder::cycle()
url = srs_generate_rtmp_url(server, port, req->vhost, req->app, req->stream);
}
srs_freep(sdk);
int64_t cto = SRS_FORWARDER_SLEEP_US;
int64_t sto = SRS_CONSTS_RTMP_TIMEOUT_US;
if ((ret = sdk->connect(url, cto, sto)) != ERROR_SUCCESS) {
sdk = new SrsSimpleRtmpClient(url, cto, sto);
if ((ret = sdk->connect()) != ERROR_SUCCESS) {
srs_warn("forward failed, url=%s, cto=%"PRId64", sto=%"PRId64". ret=%d", url.c_str(), cto, sto, ret);
return ret;
}