winlin

rename the recv thread to queue recv thread for bug #237.

@@ -26,13 +26,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -26,13 +26,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26 #include <srs_protocol_rtmp.hpp> 26 #include <srs_protocol_rtmp.hpp>
27 #include <srs_protocol_stack.hpp> 27 #include <srs_protocol_stack.hpp>
28 28
29 -SrsRecvThread::SrsRecvThread(SrsRtmpServer* rtmp_sdk) 29 +SrsQueueRecvThread::SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk)
30 { 30 {
31 rtmp = rtmp_sdk; 31 rtmp = rtmp_sdk;
32 trd = new SrsThread(this, 0, true); 32 trd = new SrsThread(this, 0, true);
33 } 33 }
34 34
35 -SrsRecvThread::~SrsRecvThread() 35 +SrsQueueRecvThread::~SrsQueueRecvThread()
36 { 36 {
37 // stop recv thread. 37 // stop recv thread.
38 stop(); 38 stop();
@@ -49,17 +49,17 @@ SrsRecvThread::~SrsRecvThread() @@ -49,17 +49,17 @@ SrsRecvThread::~SrsRecvThread()
49 queue.clear(); 49 queue.clear();
50 } 50 }
51 51
52 -bool SrsRecvThread::empty() 52 +bool SrsQueueRecvThread::empty()
53 { 53 {
54 return queue.empty(); 54 return queue.empty();
55 } 55 }
56 56
57 -int SrsRecvThread::size() 57 +int SrsQueueRecvThread::size()
58 { 58 {
59 return (int)queue.size(); 59 return (int)queue.size();
60 } 60 }
61 61
62 -SrsMessage* SrsRecvThread::pump() 62 +SrsMessage* SrsQueueRecvThread::pump()
63 { 63 {
64 srs_assert(!queue.empty()); 64 srs_assert(!queue.empty());
65 65
@@ -70,17 +70,17 @@ SrsMessage* SrsRecvThread::pump() @@ -70,17 +70,17 @@ SrsMessage* SrsRecvThread::pump()
70 return msg; 70 return msg;
71 } 71 }
72 72
73 -int SrsRecvThread::start() 73 +int SrsQueueRecvThread::start()
74 { 74 {
75 return trd->start(); 75 return trd->start();
76 } 76 }
77 77
78 -void SrsRecvThread::stop() 78 +void SrsQueueRecvThread::stop()
79 { 79 {
80 trd->stop(); 80 trd->stop();
81 } 81 }
82 82
83 -int SrsRecvThread::cycle() 83 +int SrsQueueRecvThread::cycle()
84 { 84 {
85 int ret = ERROR_SUCCESS; 85 int ret = ERROR_SUCCESS;
86 86
@@ -114,7 +114,7 @@ int SrsRecvThread::cycle() @@ -114,7 +114,7 @@ int SrsRecvThread::cycle()
114 return ret; 114 return ret;
115 } 115 }
116 116
117 -void SrsRecvThread::on_thread_start() 117 +void SrsQueueRecvThread::on_thread_start()
118 { 118 {
119 // the multiple messages writev improve performance large, 119 // the multiple messages writev improve performance large,
120 // but the timeout recv will cause 33% sys call performance, 120 // but the timeout recv will cause 33% sys call performance,
@@ -128,7 +128,7 @@ void SrsRecvThread::on_thread_start() @@ -128,7 +128,7 @@ void SrsRecvThread::on_thread_start()
128 rtmp->set_auto_response(false); 128 rtmp->set_auto_response(false);
129 } 129 }
130 130
131 -void SrsRecvThread::on_thread_stop() 131 +void SrsQueueRecvThread::on_thread_stop()
132 { 132 {
133 // enable the protocol auto response, 133 // enable the protocol auto response,
134 // for the isolate recv thread terminated. 134 // for the isolate recv thread terminated.
@@ -43,15 +43,15 @@ class SrsMessage; @@ -43,15 +43,15 @@ class SrsMessage;
43 * @see: SrsRtmpConn::playing 43 * @see: SrsRtmpConn::playing
44 * @see: https://github.com/winlinvip/simple-rtmp-server/issues/217 44 * @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
45 */ 45 */
46 -class SrsRecvThread : public ISrsThreadHandler 46 +class SrsQueueRecvThread : public ISrsThreadHandler
47 { 47 {
48 private: 48 private:
49 SrsThread* trd; 49 SrsThread* trd;
50 SrsRtmpServer* rtmp; 50 SrsRtmpServer* rtmp;
51 std::vector<SrsMessage*> queue; 51 std::vector<SrsMessage*> queue;
52 public: 52 public:
53 - SrsRecvThread(SrsRtmpServer* rtmp_sdk);  
54 - virtual ~SrsRecvThread(); 53 + SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk);
  54 + virtual ~SrsQueueRecvThread();
55 public: 55 public:
56 virtual bool empty(); 56 virtual bool empty();
57 virtual int size(); 57 virtual int size();
@@ -500,7 +500,7 @@ int SrsRtmpConn::playing(SrsSource* source) @@ -500,7 +500,7 @@ int SrsRtmpConn::playing(SrsSource* source)
500 500
501 // use isolate thread to recv, 501 // use isolate thread to recv,
502 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/217 502 // @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
503 - SrsRecvThread trd(rtmp); 503 + SrsQueueRecvThread trd(rtmp);
504 504
505 // start isolate recv thread. 505 // start isolate recv thread.
506 if ((ret = trd.start()) != ERROR_SUCCESS) { 506 if ((ret = trd.start()) != ERROR_SUCCESS) {
@@ -522,7 +522,7 @@ int SrsRtmpConn::playing(SrsSource* source) @@ -522,7 +522,7 @@ int SrsRtmpConn::playing(SrsSource* source)
522 return ret; 522 return ret;
523 } 523 }
524 524
525 -int SrsRtmpConn::do_playing(SrsSource* source, SrsRecvThread* trd) 525 +int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd)
526 { 526 {
527 int ret = ERROR_SUCCESS; 527 int ret = ERROR_SUCCESS;
528 528
@@ -49,7 +49,7 @@ class SrsBandwidth; @@ -49,7 +49,7 @@ class SrsBandwidth;
49 class SrsKbps; 49 class SrsKbps;
50 class SrsRtmpClient; 50 class SrsRtmpClient;
51 class SrsSharedPtrMessage; 51 class SrsSharedPtrMessage;
52 -class SrsRecvThread; 52 +class SrsQueueRecvThread;
53 53
54 /** 54 /**
55 * the client provides the main logic control for RTMP clients. 55 * the client provides the main logic control for RTMP clients.
@@ -89,7 +89,7 @@ private: @@ -89,7 +89,7 @@ private:
89 virtual int stream_service_cycle(); 89 virtual int stream_service_cycle();
90 virtual int check_vhost(); 90 virtual int check_vhost();
91 virtual int playing(SrsSource* source); 91 virtual int playing(SrsSource* source);
92 - virtual int do_playing(SrsSource* source, SrsRecvThread* trd); 92 + virtual int do_playing(SrsSource* source, SrsQueueRecvThread* trd);
93 virtual int fmle_publishing(SrsSource* source); 93 virtual int fmle_publishing(SrsSource* source);
94 virtual int do_fmle_publishing(SrsSource* source); 94 virtual int do_fmle_publishing(SrsSource* source);
95 virtual int flash_publishing(SrsSource* source); 95 virtual int flash_publishing(SrsSource* source);