winlin

for bug #235, refine the queue recv thread.

... ... @@ -114,13 +114,13 @@ void SrsRecvThread::on_thread_stop()
}
SrsQueueRecvThread::SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk, int timeout_ms)
: SrsRecvThread(this, rtmp_sdk, timeout_ms)
: trd(this, rtmp_sdk, timeout_ms)
{
}
SrsQueueRecvThread::~SrsQueueRecvThread()
{
stop();
trd.stop();
// clear all messages.
std::vector<SrsMessage*>::iterator it;
... ... @@ -131,6 +131,16 @@ SrsQueueRecvThread::~SrsQueueRecvThread()
queue.clear();
}
int SrsQueueRecvThread::start()
{
return trd.start();
}
void SrsQueueRecvThread::stop()
{
trd.stop();
}
bool SrsQueueRecvThread::empty()
{
return queue.empty();
... ...
... ... @@ -87,14 +87,18 @@ public:
* @see: SrsRtmpConn::playing
* @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
*/
class SrsQueueRecvThread : virtual public ISrsMessageHandler, virtual public SrsRecvThread
class SrsQueueRecvThread : virtual public ISrsMessageHandler
{
private:
std::vector<SrsMessage*> queue;
SrsRecvThread trd;
public:
SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk, int timeout_ms);
virtual ~SrsQueueRecvThread();
public:
virtual int start();
virtual void stop();
public:
virtual bool empty();
virtual int size();
virtual SrsMessage* pump();
... ...