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

for bug #237, when recv thread failed, quit the cycle. 2.0.44

This commit is contained in:
winlin 2014-12-02 15:21:08 +08:00
parent b28dc7364e
commit 757cffbabf
4 changed files with 48 additions and 9 deletions

View file

@ -49,16 +49,20 @@ public:
virtual ~ISrsMessageHandler();
public:
/**
* whether the handler can handle,
* for example, when queue recv handler got an message,
* it wait the user to process it, then the recv thread
* never recv message util the handler is ok.
*/
* whether the handler can handle,
* for example, when queue recv handler got an message,
* it wait the user to process it, then the recv thread
* never recv message util the handler is ok.
*/
virtual bool can_handle() = 0;
/**
* process the received message.
*/
* process the received message.
*/
virtual int handle(SrsMessage* msg) = 0;
/**
* when recv message error.
*/
virtual void on_recv_error(int ret) = 0;
};
/**
@ -95,6 +99,8 @@ class SrsQueueRecvThread : public ISrsMessageHandler
private:
std::vector<SrsMessage*> queue;
SrsRecvThread trd;
// the recv thread error code.
int recv_error_code;
public:
SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk, int timeout_ms);
virtual ~SrsQueueRecvThread();
@ -105,9 +111,11 @@ public:
virtual bool empty();
virtual int size();
virtual SrsMessage* pump();
virtual int error_code();
public:
virtual bool can_handle();
virtual int handle(SrsMessage* msg);
virtual void on_recv_error(int ret);
};
/**
@ -139,6 +147,7 @@ public:
public:
virtual bool can_handle();
virtual int handle(SrsMessage* msg);
virtual void on_recv_error(int ret);
};
#endif