正在显示
5 个修改的文件
包含
10 行增加
和
9 行删除
@@ -162,7 +162,6 @@ int SrsQueueRecvThread::start() | @@ -162,7 +162,6 @@ int SrsQueueRecvThread::start() | ||
162 | 162 | ||
163 | void SrsQueueRecvThread::stop() | 163 | void SrsQueueRecvThread::stop() |
164 | { | 164 | { |
165 | - _consumer = NULL; | ||
166 | trd.stop(); | 165 | trd.stop(); |
167 | } | 166 | } |
168 | 167 | ||
@@ -208,7 +207,7 @@ int SrsQueueRecvThread::handle(SrsCommonMessage* msg) | @@ -208,7 +207,7 @@ int SrsQueueRecvThread::handle(SrsCommonMessage* msg) | ||
208 | queue.push_back(msg); | 207 | queue.push_back(msg); |
209 | #ifdef SRS_PERF_QUEUE_COND_WAIT | 208 | #ifdef SRS_PERF_QUEUE_COND_WAIT |
210 | if (_consumer) { | 209 | if (_consumer) { |
211 | - _consumer->on_dispose(); | 210 | + _consumer->wakeup(); |
212 | } | 211 | } |
213 | #endif | 212 | #endif |
214 | return ERROR_SUCCESS; | 213 | return ERROR_SUCCESS; |
@@ -219,7 +218,7 @@ void SrsQueueRecvThread::on_recv_error(int ret) | @@ -219,7 +218,7 @@ void SrsQueueRecvThread::on_recv_error(int ret) | ||
219 | recv_error_code = ret; | 218 | recv_error_code = ret; |
220 | #ifdef SRS_PERF_QUEUE_COND_WAIT | 219 | #ifdef SRS_PERF_QUEUE_COND_WAIT |
221 | if (_consumer) { | 220 | if (_consumer) { |
222 | - _consumer->on_dispose(); | 221 | + _consumer->wakeup(); |
223 | } | 222 | } |
224 | #endif | 223 | #endif |
225 | } | 224 | } |
@@ -581,6 +581,7 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd) | @@ -581,6 +581,7 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd) | ||
581 | 581 | ||
582 | srs_assert(consumer != NULL); | 582 | srs_assert(consumer != NULL); |
583 | SrsAutoFree(SrsConsumer, consumer); | 583 | SrsAutoFree(SrsConsumer, consumer); |
584 | + trd->set_consumer(consumer); | ||
584 | srs_verbose("consumer created success."); | 585 | srs_verbose("consumer created success."); |
585 | 586 | ||
586 | // initialize other components | 587 | // initialize other components |
@@ -595,7 +596,6 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd) | @@ -595,7 +596,6 @@ int SrsRtmpConn::do_playing(SrsSource* source, SrsQueueRecvThread* trd) | ||
595 | // when mw_sleep changed, resize the socket send buffer. | 596 | // when mw_sleep changed, resize the socket send buffer. |
596 | mw_enabled = true; | 597 | mw_enabled = true; |
597 | change_mw_sleep(_srs_config->get_mw_sleep_ms(req->vhost)); | 598 | change_mw_sleep(_srs_config->get_mw_sleep_ms(req->vhost)); |
598 | - trd->set_consumer(consumer); | ||
599 | 599 | ||
600 | while (true) { | 600 | while (true) { |
601 | // to use isolate thread to recv, can improve about 33% performance. | 601 | // to use isolate thread to recv, can improve about 33% performance. |
@@ -516,7 +516,7 @@ void SrsConsumer::wait(int nb_msgs, int duration) | @@ -516,7 +516,7 @@ void SrsConsumer::wait(int nb_msgs, int duration) | ||
516 | st_cond_wait(mw_wait); | 516 | st_cond_wait(mw_wait); |
517 | } | 517 | } |
518 | 518 | ||
519 | -void SrsConsumer::on_dispose() | 519 | +void SrsConsumer::wakeup() |
520 | { | 520 | { |
521 | if (mw_waiting) { | 521 | if (mw_waiting) { |
522 | st_cond_signal(mw_wait); | 522 | st_cond_signal(mw_wait); |
@@ -1635,7 +1635,7 @@ void SrsSource::on_unpublish() | @@ -1635,7 +1635,7 @@ void SrsSource::on_unpublish() | ||
1635 | _source_id = -1; | 1635 | _source_id = -1; |
1636 | } | 1636 | } |
1637 | 1637 | ||
1638 | - int SrsSource::create_consumer(SrsConsumer*& consumer) | 1638 | +int SrsSource::create_consumer(SrsConsumer*& consumer) |
1639 | { | 1639 | { |
1640 | int ret = ERROR_SUCCESS; | 1640 | int ret = ERROR_SUCCESS; |
1641 | 1641 |
@@ -247,9 +247,11 @@ public: | @@ -247,9 +247,11 @@ public: | ||
247 | */ | 247 | */ |
248 | virtual void wait(int nb_msgs, int duration); | 248 | virtual void wait(int nb_msgs, int duration); |
249 | /** | 249 | /** |
250 | - * when waiting, a message incomming, we rouse it | 250 | + * when the consumer(for player) got msg from recv thread, |
251 | + * it must be processed for maybe it's a close msg, so the cond | ||
252 | + * wait must be wakeup. | ||
251 | */ | 253 | */ |
252 | - virtual void on_dispose(); | 254 | + virtual void wakeup(); |
253 | #endif | 255 | #endif |
254 | /** | 256 | /** |
255 | * when client send the pause message. | 257 | * when client send the pause message. |
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
31 | // current release version | 31 | // current release version |
32 | #define VERSION_MAJOR 2 | 32 | #define VERSION_MAJOR 2 |
33 | #define VERSION_MINOR 0 | 33 | #define VERSION_MINOR 0 |
34 | -#define VERSION_REVISION 72 | 34 | +#define VERSION_REVISION 73 |
35 | // server info. | 35 | // server info. |
36 | #define RTMP_SIG_SRS_KEY "SRS" | 36 | #define RTMP_SIG_SRS_KEY "SRS" |
37 | #define RTMP_SIG_SRS_ROLE "origin/edge server" | 37 | #define RTMP_SIG_SRS_ROLE "origin/edge server" |
-
请 注册 或 登录 后发表评论