winlin

refine #259, rename the on_dispose to wakeup. 2.0.73

... ... @@ -162,7 +162,6 @@ int SrsQueueRecvThread::start()
void SrsQueueRecvThread::stop()
{
_consumer = NULL;
trd.stop();
}
... ... @@ -208,7 +207,7 @@ int SrsQueueRecvThread::handle(SrsCommonMessage* msg)
queue.push_back(msg);
#ifdef SRS_PERF_QUEUE_COND_WAIT
if (_consumer) {
_consumer->on_dispose();
_consumer->wakeup();
}
#endif
return ERROR_SUCCESS;
... ... @@ -219,7 +218,7 @@ void SrsQueueRecvThread::on_recv_error(int ret)
recv_error_code = ret;
#ifdef SRS_PERF_QUEUE_COND_WAIT
if (_consumer) {
_consumer->on_dispose();
_consumer->wakeup();
}
#endif
}
... ...
... ... @@ -581,6 +581,7 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd)
srs_assert(consumer != NULL);
SrsAutoFree(SrsConsumer, consumer);
trd->set_consumer(consumer);
srs_verbose("consumer created success.");
// initialize other components
... ... @@ -595,7 +596,6 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd)
// when mw_sleep changed, resize the socket send buffer.
mw_enabled = true;
change_mw_sleep(_srs_config->get_mw_sleep_ms(req->vhost));
trd->set_consumer(consumer);
while (true) {
// to use isolate thread to recv, can improve about 33% performance.
... ...
... ... @@ -516,7 +516,7 @@ void SrsConsumer::wait(int nb_msgs, int duration)
st_cond_wait(mw_wait);
}
void SrsConsumer::on_dispose()
void SrsConsumer::wakeup()
{
if (mw_waiting) {
st_cond_signal(mw_wait);
... ... @@ -1635,7 +1635,7 @@ void SrsSource::on_unpublish()
_source_id = -1;
}
int SrsSource::create_consumer(SrsConsumer*& consumer)
int SrsSource::create_consumer(SrsConsumer*& consumer)
{
int ret = ERROR_SUCCESS;
... ...
... ... @@ -247,9 +247,11 @@ public:
*/
virtual void wait(int nb_msgs, int duration);
/**
* when waiting, a message incomming, we rouse it
* when the consumer(for player) got msg from recv thread,
* it must be processed for maybe it's a close msg, so the cond
* wait must be wakeup.
*/
virtual void on_dispose();
virtual void wakeup();
#endif
/**
* when client send the pause message.
... ...
... ... @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 72
#define VERSION_REVISION 73
// server info.
#define RTMP_SIG_SRS_KEY "SRS"
#define RTMP_SIG_SRS_ROLE "origin/edge server"
... ...