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

for bug #251, refine the send use cond wait.

This commit is contained in:
winlin 2014-12-05 14:38:43 +08:00
parent 4c1d5c0d1e
commit dde05c6315
5 changed files with 71 additions and 7 deletions

View file

@ -115,6 +115,14 @@ public:
SrsMessageQueue();
virtual ~SrsMessageQueue();
public:
/**
* get the count of queue.
*/
virtual int count();
/**
* get duration of queue.
*/
virtual int duration();
/**
* set the queue size
* @param queue_size the queue size in seconds.
@ -154,6 +162,12 @@ private:
bool paused;
// when source id changed, notice all consumers
bool should_update_source_id;
// the cond wait for mw.
// @see https://github.com/winlinvip/simple-rtmp-server/issues/251
st_cond_t mw_wait;
bool mw_waiting;
int mw_min_msgs;
int mw_duration;
public:
SrsConsumer(SrsSource* _source);
virtual ~SrsConsumer();
@ -189,6 +203,12 @@ public:
*/
virtual int dump_packets(int max_count, SrsMessage** pmsgs, int& count);
/**
* wait for messages incomming, atleast nb_msgs and in duration.
* @param nb_msgs the messages count to wait.
* @param duration the messgae duration to wait.
*/
virtual void wait(int nb_msgs, int duration);
/**
* when client send the pause message.
*/
virtual int on_play_client_pause(bool is_pause);