mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
rename the recv thread to queue recv thread for bug #237.
This commit is contained in:
parent
1847c5fef7
commit
22524f390a
4 changed files with 17 additions and 17 deletions
|
@ -26,13 +26,13 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#include <srs_protocol_rtmp.hpp>
|
#include <srs_protocol_rtmp.hpp>
|
||||||
#include <srs_protocol_stack.hpp>
|
#include <srs_protocol_stack.hpp>
|
||||||
|
|
||||||
SrsRecvThread::SrsRecvThread(SrsRtmpServer* rtmp_sdk)
|
SrsQueueRecvThread::SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk)
|
||||||
{
|
{
|
||||||
rtmp = rtmp_sdk;
|
rtmp = rtmp_sdk;
|
||||||
trd = new SrsThread(this, 0, true);
|
trd = new SrsThread(this, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsRecvThread::~SrsRecvThread()
|
SrsQueueRecvThread::~SrsQueueRecvThread()
|
||||||
{
|
{
|
||||||
// stop recv thread.
|
// stop recv thread.
|
||||||
stop();
|
stop();
|
||||||
|
@ -49,17 +49,17 @@ SrsRecvThread::~SrsRecvThread()
|
||||||
queue.clear();
|
queue.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SrsRecvThread::empty()
|
bool SrsQueueRecvThread::empty()
|
||||||
{
|
{
|
||||||
return queue.empty();
|
return queue.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SrsRecvThread::size()
|
int SrsQueueRecvThread::size()
|
||||||
{
|
{
|
||||||
return (int)queue.size();
|
return (int)queue.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
SrsMessage* SrsRecvThread::pump()
|
SrsMessage* SrsQueueRecvThread::pump()
|
||||||
{
|
{
|
||||||
srs_assert(!queue.empty());
|
srs_assert(!queue.empty());
|
||||||
|
|
||||||
|
@ -70,17 +70,17 @@ SrsMessage* SrsRecvThread::pump()
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SrsRecvThread::start()
|
int SrsQueueRecvThread::start()
|
||||||
{
|
{
|
||||||
return trd->start();
|
return trd->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsRecvThread::stop()
|
void SrsQueueRecvThread::stop()
|
||||||
{
|
{
|
||||||
trd->stop();
|
trd->stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
int SrsRecvThread::cycle()
|
int SrsQueueRecvThread::cycle()
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ int SrsRecvThread::cycle()
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsRecvThread::on_thread_start()
|
void SrsQueueRecvThread::on_thread_start()
|
||||||
{
|
{
|
||||||
// the multiple messages writev improve performance large,
|
// the multiple messages writev improve performance large,
|
||||||
// but the timeout recv will cause 33% sys call performance,
|
// but the timeout recv will cause 33% sys call performance,
|
||||||
|
@ -128,7 +128,7 @@ void SrsRecvThread::on_thread_start()
|
||||||
rtmp->set_auto_response(false);
|
rtmp->set_auto_response(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SrsRecvThread::on_thread_stop()
|
void SrsQueueRecvThread::on_thread_stop()
|
||||||
{
|
{
|
||||||
// enable the protocol auto response,
|
// enable the protocol auto response,
|
||||||
// for the isolate recv thread terminated.
|
// for the isolate recv thread terminated.
|
||||||
|
|
|
@ -43,15 +43,15 @@ class SrsMessage;
|
||||||
* @see: SrsRtmpConn::playing
|
* @see: SrsRtmpConn::playing
|
||||||
* @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
|
* @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
|
||||||
*/
|
*/
|
||||||
class SrsRecvThread : public ISrsThreadHandler
|
class SrsQueueRecvThread : public ISrsThreadHandler
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
SrsThread* trd;
|
SrsThread* trd;
|
||||||
SrsRtmpServer* rtmp;
|
SrsRtmpServer* rtmp;
|
||||||
std::vector<SrsMessage*> queue;
|
std::vector<SrsMessage*> queue;
|
||||||
public:
|
public:
|
||||||
SrsRecvThread(SrsRtmpServer* rtmp_sdk);
|
SrsQueueRecvThread(SrsRtmpServer* rtmp_sdk);
|
||||||
virtual ~SrsRecvThread();
|
virtual ~SrsQueueRecvThread();
|
||||||
public:
|
public:
|
||||||
virtual bool empty();
|
virtual bool empty();
|
||||||
virtual int size();
|
virtual int size();
|
||||||
|
|
|
@ -500,7 +500,7 @@ int SrsRtmpConn::playing(SrsSource* source)
|
||||||
|
|
||||||
// use isolate thread to recv,
|
// use isolate thread to recv,
|
||||||
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
|
// @see: https://github.com/winlinvip/simple-rtmp-server/issues/217
|
||||||
SrsRecvThread trd(rtmp);
|
SrsQueueRecvThread trd(rtmp);
|
||||||
|
|
||||||
// start isolate recv thread.
|
// start isolate recv thread.
|
||||||
if ((ret = trd.start()) != ERROR_SUCCESS) {
|
if ((ret = trd.start()) != ERROR_SUCCESS) {
|
||||||
|
@ -522,7 +522,7 @@ int SrsRtmpConn::playing(SrsSource* source)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int SrsRtmpConn::do_playing(SrsSource* source, SrsRecvThread* trd)
|
int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd)
|
||||||
{
|
{
|
||||||
int ret = ERROR_SUCCESS;
|
int ret = ERROR_SUCCESS;
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ class SrsBandwidth;
|
||||||
class SrsKbps;
|
class SrsKbps;
|
||||||
class SrsRtmpClient;
|
class SrsRtmpClient;
|
||||||
class SrsSharedPtrMessage;
|
class SrsSharedPtrMessage;
|
||||||
class SrsRecvThread;
|
class SrsQueueRecvThread;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the client provides the main logic control for RTMP clients.
|
* the client provides the main logic control for RTMP clients.
|
||||||
|
@ -89,7 +89,7 @@ private:
|
||||||
virtual int stream_service_cycle();
|
virtual int stream_service_cycle();
|
||||||
virtual int check_vhost();
|
virtual int check_vhost();
|
||||||
virtual int playing(SrsSource* source);
|
virtual int playing(SrsSource* source);
|
||||||
virtual int do_playing(SrsSource* source, SrsRecvThread* trd);
|
virtual int do_playing(SrsSource* source, SrsQueueRecvThread* trd);
|
||||||
virtual int fmle_publishing(SrsSource* source);
|
virtual int fmle_publishing(SrsSource* source);
|
||||||
virtual int do_fmle_publishing(SrsSource* source);
|
virtual int do_fmle_publishing(SrsSource* source);
|
||||||
virtual int flash_publishing(SrsSource* source);
|
virtual int flash_publishing(SrsSource* source);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue