winlin

for bug #235, refine the queue recv thread.

@@ -114,13 +114,13 @@ void SrsRecvThread::on_thread_stop() @@ -114,13 +114,13 @@ void SrsRecvThread::on_thread_stop()
114 } 114 }
115 115
116 SrsQueueRecvThread::SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk, int timeout_ms) 116 SrsQueueRecvThread::SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk, int timeout_ms)
117 - : SrsRecvThread(this, rtmp_sdk, timeout_ms) 117 + : trd(this, rtmp_sdk, timeout_ms)
118 { 118 {
119 } 119 }
120 120
121 SrsQueueRecvThread::~SrsQueueRecvThread() 121 SrsQueueRecvThread::~SrsQueueRecvThread()
122 { 122 {
123 - stop(); 123 + trd.stop();
124 124
125 // clear all messages. 125 // clear all messages.
126 std::vector<SrsMessage*>::iterator it; 126 std::vector<SrsMessage*>::iterator it;
@@ -131,6 +131,16 @@ SrsQueueRecvThread::~SrsQueueRecvThread() @@ -131,6 +131,16 @@ SrsQueueRecvThread::~SrsQueueRecvThread()
131 queue.clear(); 131 queue.clear();
132 } 132 }
133 133
  134 +int SrsQueueRecvThread::start()
  135 +{
  136 + return trd.start();
  137 +}
  138 +
  139 +void SrsQueueRecvThread::stop()
  140 +{
  141 + trd.stop();
  142 +}
  143 +
134 bool SrsQueueRecvThread::empty() 144 bool SrsQueueRecvThread::empty()
135 { 145 {
136 return queue.empty(); 146 return queue.empty();
@@ -87,14 +87,18 @@ public: @@ -87,14 +87,18 @@ public:
87 * @see: SrsRtmpConn::playing 87 * @see: SrsRtmpConn::playing
88 * @see: https://github.com/winlinvip/simple-rtmp-server/issues/217 88 * @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
89 */ 89 */
90 -class SrsQueueRecvThread : virtual public ISrsMessageHandler, virtual public SrsRecvThread 90 +class SrsQueueRecvThread : virtual public ISrsMessageHandler
91 { 91 {
92 private: 92 private:
93 std::vector<SrsMessage*> queue; 93 std::vector<SrsMessage*> queue;
  94 + SrsRecvThread trd;
94 public: 95 public:
95 SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk, int timeout_ms); 96 SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk, int timeout_ms);
96 virtual ~SrsQueueRecvThread(); 97 virtual ~SrsQueueRecvThread();
97 public: 98 public:
  99 + virtual int start();
  100 + virtual void stop();
  101 +public:
98 virtual bool empty(); 102 virtual bool empty();
99 virtual int size(); 103 virtual int size();
100 virtual SrsMessage* pump(); 104 virtual SrsMessage* pump();