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

fix #257, refine latency, send when got one+ msgs, 2.0.72

This commit is contained in:
winlin 2014-12-16 09:26:22 +08:00
parent bacbec6647
commit 0d6b91039d
4 changed files with 16 additions and 13 deletions

View file

@ -452,6 +452,9 @@ int SrsConsumer::enqueue(SrsSharedPtrMessage* __msg, bool atc, int tba, int tbv,
}
#ifdef SRS_PERF_QUEUE_COND_WAIT
srs_verbose("enqueue msg, time=%"PRId64", size=%d, duration=%d, waiting=%d, min_msg=%d",
msg->timestamp, msg->size, queue->duration(), mw_waiting, mw_min_msgs);
// fire the mw when msgs is enough.
if (mw_waiting) {
int duration_ms = queue->duration();
@ -493,7 +496,7 @@ int SrsConsumer::dump_packets(SrsMessageArray* msgs, int& count)
}
#ifdef SRS_PERF_QUEUE_COND_WAIT
void SrsConsumer::wait(int nb_msgs, int duration, bool realtime)
void SrsConsumer::wait(int nb_msgs, int duration)
{
mw_min_msgs = nb_msgs;
mw_duration = duration;
@ -509,14 +512,8 @@ void SrsConsumer::wait(int nb_msgs, int duration, bool realtime)
// the enqueue will notify this cond.
mw_waiting = true;
// use timeout wait for realtime mode.
// @see https://github.com/winlinvip/simple-rtmp-server/issues/257
if (realtime) {
st_cond_timedwait(mw_wait, duration * 1000);
} else {
// use cond block wait for high performance mode.
st_cond_wait(mw_wait);
}
// use cond block wait for high performance mode.
st_cond_wait(mw_wait);
}
#endif