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

for bug #237, use isolate thread to recv message. 2.0.41

This commit is contained in:
winlin 2014-12-01 23:38:51 +08:00
parent 0e7836868c
commit 472b1742a2
5 changed files with 209 additions and 122 deletions

View file

@ -36,6 +36,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
class SrsRtmpServer;
class SrsMessage;
class SrsRtmpConn;
class SrsSource;
/**
* for the recv thread to handle the message.
@ -76,6 +78,7 @@ public:
virtual int start();
virtual void stop();
virtual int cycle();
virtual void stop_loop();
public:
virtual void on_thread_start();
virtual void on_thread_stop();
@ -87,7 +90,7 @@ public:
* @see: SrsRtmpConn::playing
* @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
*/
class SrsQueueRecvThread : virtual public ISrsMessageHandler
class SrsQueueRecvThread : public ISrsMessageHandler
{
private:
std::vector<SrsMessage*> queue;
@ -107,5 +110,36 @@ public:
virtual int handle(SrsMessage* msg);
};
/**
* the publish recv thread got message and callback the source method to process message.
* @see: https://github.com/winlinvip/simple-rtmp-server/issues/237
*/
class SrsPublishRecvThread : public ISrsMessageHandler
{
private:
SrsRecvThread trd;
// the msgs already got.
int64_t _nb_msgs;
// the recv thread error code.
int recv_error_code;
SrsRtmpConn* _conn;
SrsSource* _source;
bool _is_fmle;
bool _is_edge;
public:
SrsPublishRecvThread(SrsRtmpServer* rtmp_sdk, int timeout_ms,
SrsRtmpConn* conn, SrsSource* source, bool is_fmle, bool is_edge);
virtual ~SrsPublishRecvThread();
public:
virtual int64_t nb_msgs();
virtual int error_code();
public:
virtual int start();
virtual void stop();
public:
virtual bool can_handle();
virtual int handle(SrsMessage* msg);
};
#endif