mirror of
https://github.com/ossrs/srs.git
synced 2025-02-12 11:21:52 +00:00
For #1634, always check status in thread loop. 3.0.126
This commit is contained in:
parent
6c55fd3e4b
commit
c1e07d6a96
8 changed files with 47 additions and 38 deletions
|
@ -146,6 +146,7 @@ For previous versions, please read:
|
||||||
|
|
||||||
## V3 changes
|
## V3 changes
|
||||||
|
|
||||||
|
* v3.0, 2020-03-12, For [#1634][bug #1634], always check status in thread loop. 3.0.126
|
||||||
* v3.0, 2020-03-11, For [#1634][bug #1634], refactor output with datetime for ingest/encoder/exec. 3.0.125
|
* v3.0, 2020-03-11, For [#1634][bug #1634], refactor output with datetime for ingest/encoder/exec. 3.0.125
|
||||||
* v3.0, 2020-03-11, For [#1634][bug #1634], fix quit by accident SIGTERM while killing FFMPEG. 3.0.124
|
* v3.0, 2020-03-11, For [#1634][bug #1634], fix quit by accident SIGTERM while killing FFMPEG. 3.0.124
|
||||||
* <strong>v3.0, 2020-03-05, [3.0 beta2(3.0.123)][r3.0b2] released. 122170 lines.</strong>
|
* <strong>v3.0, 2020-03-05, [3.0 beta2(3.0.123)][r3.0b2] released. 122170 lines.</strong>
|
||||||
|
|
|
@ -234,15 +234,17 @@ srs_error_t SrsEdgeIngester::cycle()
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
// We always check status first.
|
||||||
|
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
|
||||||
|
if ((err = trd->pull()) != srs_success) {
|
||||||
|
return srs_error_wrap(err, "edge ingester");
|
||||||
|
}
|
||||||
|
|
||||||
if ((err = do_cycle()) != srs_success) {
|
if ((err = do_cycle()) != srs_success) {
|
||||||
srs_warn("EdgeIngester: Ignore error, %s", srs_error_desc(err).c_str());
|
srs_warn("EdgeIngester: Ignore error, %s", srs_error_desc(err).c_str());
|
||||||
srs_freep(err);
|
srs_freep(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = trd->pull()) != srs_success) {
|
|
||||||
return srs_error_wrap(err, "edge ingester");
|
|
||||||
}
|
|
||||||
|
|
||||||
srs_usleep(SRS_EDGE_INGESTER_CIMS);
|
srs_usleep(SRS_EDGE_INGESTER_CIMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,7 +316,6 @@ srs_error_t SrsEdgeIngester::ingest(string& redirect)
|
||||||
redirect = "";
|
redirect = "";
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
srs_error_t err = srs_success;
|
|
||||||
if ((err = trd->pull()) != srs_success) {
|
if ((err = trd->pull()) != srs_success) {
|
||||||
return srs_error_wrap(err, "thread quit");
|
return srs_error_wrap(err, "thread quit");
|
||||||
}
|
}
|
||||||
|
@ -534,14 +535,16 @@ srs_error_t SrsEdgeForwarder::cycle()
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if ((err = do_cycle()) != srs_success) {
|
// We always check status first.
|
||||||
return srs_error_wrap(err, "do cycle");
|
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
|
||||||
}
|
|
||||||
|
|
||||||
if ((err = trd->pull()) != srs_success) {
|
if ((err = trd->pull()) != srs_success) {
|
||||||
return srs_error_wrap(err, "thread pull");
|
return srs_error_wrap(err, "thread pull");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((err = do_cycle()) != srs_success) {
|
||||||
|
return srs_error_wrap(err, "do cycle");
|
||||||
|
}
|
||||||
|
|
||||||
srs_usleep(SRS_EDGE_FORWARDER_CIMS);
|
srs_usleep(SRS_EDGE_FORWARDER_CIMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -181,15 +181,17 @@ srs_error_t SrsForwarder::cycle()
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
|
// We always check status first.
|
||||||
|
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
|
||||||
|
if ((err = trd->pull()) != srs_success) {
|
||||||
|
return srs_error_wrap(err, "forwarder");
|
||||||
|
}
|
||||||
|
|
||||||
if ((err = do_cycle()) != srs_success) {
|
if ((err = do_cycle()) != srs_success) {
|
||||||
srs_warn("Forwarder: Ignore error, %s", srs_error_desc(err).c_str());
|
srs_warn("Forwarder: Ignore error, %s", srs_error_desc(err).c_str());
|
||||||
srs_freep(err);
|
srs_freep(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = trd->pull()) != srs_success) {
|
|
||||||
return srs_error_wrap(err, "forwarder");
|
|
||||||
}
|
|
||||||
|
|
||||||
srs_usleep(SRS_FORWARDER_CIMS);
|
srs_usleep(SRS_FORWARDER_CIMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -646,13 +646,13 @@ srs_error_t SrsLiveStream::do_serve_http(ISrsHttpResponseWriter* w, ISrsHttpMess
|
||||||
// TODO: free and erase the disabled entry after all related connections is closed.
|
// TODO: free and erase the disabled entry after all related connections is closed.
|
||||||
// TODO: FXIME: Support timeout for player, quit infinite-loop.
|
// TODO: FXIME: Support timeout for player, quit infinite-loop.
|
||||||
while (entry->enabled) {
|
while (entry->enabled) {
|
||||||
pprint->elapse();
|
|
||||||
|
|
||||||
// Whether client closed the FD.
|
// Whether client closed the FD.
|
||||||
if ((err = trd->pull()) != srs_success) {
|
if ((err = trd->pull()) != srs_success) {
|
||||||
return srs_error_wrap(err, "recv thread");
|
return srs_error_wrap(err, "recv thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pprint->elapse();
|
||||||
|
|
||||||
// get messages from consumer.
|
// get messages from consumer.
|
||||||
// each msg in msgs.msgs must be free, for the SrsMessageArray never free them.
|
// each msg in msgs.msgs must be free, for the SrsMessageArray never free them.
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
|
@ -201,15 +201,17 @@ srs_error_t SrsIngester::cycle()
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
while (!disposed) {
|
while (!disposed) {
|
||||||
|
// We always check status first.
|
||||||
|
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
|
||||||
|
if ((err = trd->pull()) != srs_success) {
|
||||||
|
return srs_error_wrap(err, "ingester");
|
||||||
|
}
|
||||||
|
|
||||||
if ((err = do_cycle()) != srs_success) {
|
if ((err = do_cycle()) != srs_success) {
|
||||||
srs_warn("Ingester: Ignore error, %s", srs_error_desc(err).c_str());
|
srs_warn("Ingester: Ignore error, %s", srs_error_desc(err).c_str());
|
||||||
srs_freep(err);
|
srs_freep(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((err = trd->pull()) != srs_success) {
|
|
||||||
return srs_error_wrap(err, "ingester");
|
|
||||||
}
|
|
||||||
|
|
||||||
srs_usleep(SRS_AUTO_INGESTER_CIMS);
|
srs_usleep(SRS_AUTO_INGESTER_CIMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,16 +83,18 @@ srs_error_t SrsNgExec::cycle()
|
||||||
srs_error_t err = srs_success;
|
srs_error_t err = srs_success;
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
if ((err = do_cycle()) != srs_success) {
|
// We always check status first.
|
||||||
srs_warn("EXEC: Ignore error, %s", srs_error_desc(err).c_str());
|
// @see https://github.com/ossrs/srs/issues/1634#issuecomment-597571561
|
||||||
srs_freep(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((err = trd->pull()) != srs_success) {
|
if ((err = trd->pull()) != srs_success) {
|
||||||
err = srs_error_wrap(err, "ng exec cycle");
|
err = srs_error_wrap(err, "ng exec cycle");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((err = do_cycle()) != srs_success) {
|
||||||
|
srs_warn("EXEC: Ignore error, %s", srs_error_desc(err).c_str());
|
||||||
|
srs_freep(err);
|
||||||
|
}
|
||||||
|
|
||||||
srs_usleep(SRS_RTMP_EXEC_CIMS);
|
srs_usleep(SRS_RTMP_EXEC_CIMS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -381,7 +381,6 @@ srs_error_t SrsRtmpConn::service_cycle()
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
srs_error_t err = srs_success;
|
|
||||||
if ((err = trd->pull()) != srs_success) {
|
if ((err = trd->pull()) != srs_success) {
|
||||||
return srs_error_wrap(err, "rtmp: thread quit");
|
return srs_error_wrap(err, "rtmp: thread quit");
|
||||||
}
|
}
|
||||||
|
@ -704,14 +703,14 @@ srs_error_t SrsRtmpConn::do_playing(SrsSource* source, SrsConsumer* consumer, Sr
|
||||||
srsu2msi(send_min_interval), srsu2msi(mw_sleep), mw_enabled, realtime, tcp_nodelay);
|
srsu2msi(send_min_interval), srsu2msi(mw_sleep), mw_enabled, realtime, tcp_nodelay);
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
// collect elapse for pithy print.
|
|
||||||
pprint->elapse();
|
|
||||||
|
|
||||||
// when source is set to expired, disconnect it.
|
// when source is set to expired, disconnect it.
|
||||||
if ((err = trd->pull()) != srs_success) {
|
if ((err = trd->pull()) != srs_success) {
|
||||||
return srs_error_wrap(err, "rtmp: thread quit");
|
return srs_error_wrap(err, "rtmp: thread quit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// collect elapse for pithy print.
|
||||||
|
pprint->elapse();
|
||||||
|
|
||||||
// to use isolate thread to recv, can improve about 33% performance.
|
// to use isolate thread to recv, can improve about 33% performance.
|
||||||
// @see: https://github.com/ossrs/srs/issues/196
|
// @see: https://github.com/ossrs/srs/issues/196
|
||||||
// @see: https://github.com/ossrs/srs/issues/217
|
// @see: https://github.com/ossrs/srs/issues/217
|
||||||
|
@ -872,12 +871,12 @@ srs_error_t SrsRtmpConn::do_publishing(SrsSource* source, SrsPublishRecvThread*
|
||||||
int64_t nb_msgs = 0;
|
int64_t nb_msgs = 0;
|
||||||
uint64_t nb_frames = 0;
|
uint64_t nb_frames = 0;
|
||||||
while (true) {
|
while (true) {
|
||||||
pprint->elapse();
|
|
||||||
|
|
||||||
if ((err = trd->pull()) != srs_success) {
|
if ((err = trd->pull()) != srs_success) {
|
||||||
return srs_error_wrap(err, "rtmp: thread quit");
|
return srs_error_wrap(err, "rtmp: thread quit");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pprint->elapse();
|
||||||
|
|
||||||
// cond wait for timeout.
|
// cond wait for timeout.
|
||||||
if (nb_msgs == 0) {
|
if (nb_msgs == 0) {
|
||||||
// when not got msgs, wait for a larger timeout.
|
// when not got msgs, wait for a larger timeout.
|
||||||
|
|
|
@ -24,6 +24,6 @@
|
||||||
#ifndef SRS_CORE_VERSION3_HPP
|
#ifndef SRS_CORE_VERSION3_HPP
|
||||||
#define SRS_CORE_VERSION3_HPP
|
#define SRS_CORE_VERSION3_HPP
|
||||||
|
|
||||||
#define SRS_VERSION3_REVISION 125
|
#define SRS_VERSION3_REVISION 126
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue