Skip to content

Commit 0d6b910

Browse files
committed
fix #257, refine latency, send when got one+ msgs, 2.0.72
1 parent bacbec6 commit 0d6b910

File tree

4 files changed

+16
-13
lines changed

4 files changed

+16
-13
lines changed

trunk/src/app/srs_app_rtmp_conn.cpp

+8-1
Original file line numberDiff line numberDiff line change
@@ -629,7 +629,14 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd)
629629

630630
// wait for message to incoming.
631631
// @see https://github.com/winlinvip/simple-rtmp-server/issues/251
632-
consumer->wait(SRS_PERF_MW_MIN_MSGS, mw_sleep, realtime);
632+
// @see https://github.com/winlinvip/simple-rtmp-server/issues/257
633+
if (realtime) {
634+
// for realtime, min required msgs is 0, send when got one+ msgs.
635+
consumer->wait(0, mw_sleep);
636+
} else {
637+
// for no-realtime, got some msgs then send.
638+
consumer->wait(SRS_PERF_MW_MIN_MSGS, mw_sleep);
639+
}
633640

634641
// for send wait time debug
635642
srs_verbose("send thread now=%"PRId64"us wakeup", srs_update_system_time_ms());

trunk/src/app/srs_app_source.cpp

+6-9
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,9 @@ int SrsConsumer::enqueue(SrsSharedPtrMessage* __msg, bool atc, int tba, int tbv,
452452
}
453453

454454
#ifdef SRS_PERF_QUEUE_COND_WAIT
455+
srs_verbose("enqueue msg, time=%"PRId64", size=%d, duration=%d, waiting=%d, min_msg=%d",
456+
msg->timestamp, msg->size, queue->duration(), mw_waiting, mw_min_msgs);
457+
455458
// fire the mw when msgs is enough.
456459
if (mw_waiting) {
457460
int duration_ms = queue->duration();
@@ -493,7 +496,7 @@ int SrsConsumer::dump_packets(SrsMessageArray* msgs, int& count)
493496
}
494497

495498
#ifdef SRS_PERF_QUEUE_COND_WAIT
496-
void SrsConsumer::wait(int nb_msgs, int duration, bool realtime)
499+
void SrsConsumer::wait(int nb_msgs, int duration)
497500
{
498501
mw_min_msgs = nb_msgs;
499502
mw_duration = duration;
@@ -509,14 +512,8 @@ void SrsConsumer::wait(int nb_msgs, int duration, bool realtime)
509512
// the enqueue will notify this cond.
510513
mw_waiting = true;
511514

512-
// use timeout wait for realtime mode.
513-
// @see https://github.com/winlinvip/simple-rtmp-server/issues/257
514-
if (realtime) {
515-
st_cond_timedwait(mw_wait, duration * 1000);
516-
} else {
517-
// use cond block wait for high performance mode.
518-
st_cond_wait(mw_wait);
519-
}
515+
// use cond block wait for high performance mode.
516+
st_cond_wait(mw_wait);
520517
}
521518
#endif
522519

trunk/src/app/srs_app_source.hpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,8 @@ class SrsConsumer
244244
* wait for messages incomming, atleast nb_msgs and in duration.
245245
* @param nb_msgs the messages count to wait.
246246
* @param duration the messgae duration to wait.
247-
* @param realtime whether use realtime mode.
248247
*/
249-
virtual void wait(int nb_msgs, int duration, bool realtime);
248+
virtual void wait(int nb_msgs, int duration);
250249
#endif
251250
/**
252251
* when client send the pause message.

trunk/src/core/srs_core.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3131
// current release version
3232
#define VERSION_MAJOR 2
3333
#define VERSION_MINOR 0
34-
#define VERSION_REVISION 71
34+
#define VERSION_REVISION 72
3535
// server info.
3636
#define RTMP_SIG_SRS_KEY "SRS"
3737
#define RTMP_SIG_SRS_ROLE "origin/edge server"

0 commit comments

Comments
 (0)