diff --git a/trunk/src/app/srs_app_rtc_conn.cpp b/trunk/src/app/srs_app_rtc_conn.cpp index 24c19663c..a2d7c9c7a 100644 --- a/trunk/src/app/srs_app_rtc_conn.cpp +++ b/trunk/src/app/srs_app_rtc_conn.cpp @@ -701,22 +701,25 @@ srs_error_t SrsRtcSenderThread::cycle() return srs_error_wrap(err, "rtc sender thread"); } +#ifdef SRS_PERF_QUEUE_COND_WAIT + // Wait for amount of messages or a duration. + 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 + + // Try to read some messages. int msg_count = 0; if ((err = consumer->dump_packets(&msgs, msg_count)) != srs_success) { continue; } - // For RTC, we always try to read messages, only wait when no message. if (msg_count <= 0) { -#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 +#ifndef SRS_PERF_QUEUE_COND_WAIT srs_usleep(mw_sleep); #endif continue;