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

For #1634, always check status in thread loop. 3.0.126

This commit is contained in:
winlin 2020-03-12 08:59:13 +08:00
parent 6c55fd3e4b
commit c1e07d6a96
8 changed files with 47 additions and 38 deletions

View file

@ -381,7 +381,6 @@ srs_error_t SrsRtmpConn::service_cycle()
}
while (true) {
srs_error_t err = srs_success;
if ((err = trd->pull()) != srs_success) {
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);
while (true) {
// collect elapse for pithy print.
pprint->elapse();
// when source is set to expired, disconnect it.
if ((err = trd->pull()) != srs_success) {
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.
// @see: https://github.com/ossrs/srs/issues/196
// @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;
uint64_t nb_frames = 0;
while (true) {
pprint->elapse();
if ((err = trd->pull()) != srs_success) {
return srs_error_wrap(err, "rtmp: thread quit");
}
pprint->elapse();
// cond wait for timeout.
if (nb_msgs == 0) {
// when not got msgs, wait for a larger timeout.