mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For RTC, always try to read message first, to improve performance
This commit is contained in:
parent
1a6e055f7f
commit
32f43a9920
1 changed files with 11 additions and 13 deletions
|
@ -694,26 +694,24 @@ srs_error_t SrsRtcSenderThread::cycle()
|
||||||
return srs_error_wrap(err, "rtc sender thread");
|
return srs_error_wrap(err, "rtc sender thread");
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SRS_PERF_QUEUE_COND_WAIT
|
|
||||||
if (realtime) {
|
|
||||||
// for realtime, min required msgs is 0, send when got one+ msgs.
|
|
||||||
consumer->wait(SRS_PERF_MW_MIN_MSGS_FOR_RTC_REALTIME, mw_sleep);
|
|
||||||
} else {
|
|
||||||
// for no-realtime, got some msgs then send.
|
|
||||||
consumer->wait(SRS_PERF_MW_MIN_MSGS_FOR_RTC, mw_sleep);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int msg_count = 0;
|
int msg_count = 0;
|
||||||
if ((err = consumer->dump_packets(&msgs, msg_count)) != srs_success) {
|
if ((err = consumer->dump_packets(&msgs, msg_count)) != srs_success) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For RTC, we always try to read messages, only wait when no message.
|
||||||
if (msg_count <= 0) {
|
if (msg_count <= 0) {
|
||||||
#ifndef SRS_PERF_QUEUE_COND_WAIT
|
#ifdef SRS_PERF_QUEUE_COND_WAIT
|
||||||
|
if (realtime) {
|
||||||
|
// for realtime, min required msgs is 0, send when got one+ msgs.
|
||||||
|
consumer->wait(SRS_PERF_MW_MIN_MSGS_FOR_RTC_REALTIME, mw_sleep);
|
||||||
|
} else {
|
||||||
|
// for no-realtime, got some msgs then send.
|
||||||
|
consumer->wait(SRS_PERF_MW_MIN_MSGS_FOR_RTC, mw_sleep);
|
||||||
|
}
|
||||||
|
#else
|
||||||
srs_usleep(mw_sleep);
|
srs_usleep(mw_sleep);
|
||||||
#endif
|
#endif
|
||||||
// ignore when nothing got.
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue