Revert "for bug#194, open pipe for each connection."
This reverts commit ade81bb2.
正在显示
2 个修改的文件
包含
2 行增加
和
28 行删除
| @@ -81,7 +81,7 @@ int SrsPipe::active() | @@ -81,7 +81,7 @@ int SrsPipe::active() | ||
| 81 | int ret = ERROR_SUCCESS; | 81 | int ret = ERROR_SUCCESS; |
| 82 | 82 | ||
| 83 | int v = 0; | 83 | int v = 0; |
| 84 | - if (st_write(write_stfd, &v, sizeof(int), ST_UTIME_NO_TIMEOUT) != sizeof(int)) { | 84 | + if (st_write(read_stfd, &v, sizeof(int), ST_UTIME_NO_TIMEOUT) != sizeof(int)) { |
| 85 | ret = ERROR_SYSTEM_WRITE_PIPE; | 85 | ret = ERROR_SYSTEM_WRITE_PIPE; |
| 86 | srs_error("write pipe failed. ret=%d", ret); | 86 | srs_error("write pipe failed. ret=%d", ret); |
| 87 | return ret; | 87 | return ret; |
| @@ -516,12 +516,7 @@ int SrsRtmpConn::playing(SrsSource* source) | @@ -516,12 +516,7 @@ int SrsRtmpConn::playing(SrsSource* source) | ||
| 516 | SrsAutoFree(SrsConsumer, consumer); | 516 | SrsAutoFree(SrsConsumer, consumer); |
| 517 | srs_verbose("consumer created success."); | 517 | srs_verbose("consumer created success."); |
| 518 | 518 | ||
| 519 | - // TODO: FIXME: remove it. | ||
| 520 | rtmp->set_recv_timeout(SRS_CONSTS_RTMP_PULSE_TIMEOUT_US); | 519 | rtmp->set_recv_timeout(SRS_CONSTS_RTMP_PULSE_TIMEOUT_US); |
| 521 | - // disable the timeout. | ||
| 522 | - // TODO: FIXME: maybe can use larger timeout? | ||
| 523 | - rtmp->set_recv_timeout(ST_UTIME_NO_TIMEOUT); | ||
| 524 | - rtmp->set_send_timeout(ST_UTIME_NO_TIMEOUT); | ||
| 525 | 520 | ||
| 526 | SrsPithyPrint pithy_print(SRS_CONSTS_STAGE_PLAY_USER); | 521 | SrsPithyPrint pithy_print(SRS_CONSTS_STAGE_PLAY_USER); |
| 527 | 522 | ||
| @@ -530,30 +525,12 @@ int SrsRtmpConn::playing(SrsSource* source) | @@ -530,30 +525,12 @@ int SrsRtmpConn::playing(SrsSource* source) | ||
| 530 | bool user_specified_duration_to_stop = (req->duration > 0); | 525 | bool user_specified_duration_to_stop = (req->duration > 0); |
| 531 | int64_t starttime = -1; | 526 | int64_t starttime = -1; |
| 532 | 527 | ||
| 533 | - pollfd pds[2]; | ||
| 534 | - // poll the client incoming fd. | ||
| 535 | - pds[0].fd = st_netfd_fileno(stfd); | ||
| 536 | - pds[0].events = POLLIN; | ||
| 537 | - // poll the consumer queue pipe. | ||
| 538 | - pds[1].fd = st_netfd_fileno(consumer->pipe_fd()); | ||
| 539 | - pds[1].events = POLLIN; | ||
| 540 | - | ||
| 541 | while (true) { | 528 | while (true) { |
| 542 | // collect elapse for pithy print. | 529 | // collect elapse for pithy print. |
| 543 | pithy_print.elapse(); | 530 | pithy_print.elapse(); |
| 544 | 531 | ||
| 545 | - pds[0].revents = 0; | ||
| 546 | - pds[1].revents = 0; | ||
| 547 | - | ||
| 548 | - // wait for packet incoming or data outgoing. | ||
| 549 | - if (st_poll(pds, 2, ST_UTIME_NO_TIMEOUT) <= 0) { | ||
| 550 | - srs_error("st_poll failed."); | ||
| 551 | - break; | ||
| 552 | - } | ||
| 553 | - | ||
| 554 | - // packet incoming, read from RTMP. | ||
| 555 | // read from client. | 532 | // read from client. |
| 556 | - if (pds[0].revents & POLLIN) { | 533 | + if (true) { |
| 557 | SrsMessage* msg = NULL; | 534 | SrsMessage* msg = NULL; |
| 558 | ret = rtmp->recv_message(&msg); | 535 | ret = rtmp->recv_message(&msg); |
| 559 | srs_verbose("play loop recv message. ret=%d", ret); | 536 | srs_verbose("play loop recv message. ret=%d", ret); |
| @@ -576,8 +553,6 @@ int SrsRtmpConn::playing(SrsSource* source) | @@ -576,8 +553,6 @@ int SrsRtmpConn::playing(SrsSource* source) | ||
| 576 | } | 553 | } |
| 577 | } | 554 | } |
| 578 | 555 | ||
| 579 | - // data outgoing, sendout packets. | ||
| 580 | - if (pds[1].revents & POLLIN) { | ||
| 581 | // get messages from consumer. | 556 | // get messages from consumer. |
| 582 | int count = 0; | 557 | int count = 0; |
| 583 | if ((ret = consumer->dump_packets(msgs.size, msgs.msgs, count)) != ERROR_SUCCESS) { | 558 | if ((ret = consumer->dump_packets(msgs.size, msgs.msgs, count)) != ERROR_SUCCESS) { |
| @@ -623,7 +598,6 @@ int SrsRtmpConn::playing(SrsSource* source) | @@ -623,7 +598,6 @@ int SrsRtmpConn::playing(SrsSource* source) | ||
| 623 | return ret; | 598 | return ret; |
| 624 | } | 599 | } |
| 625 | } | 600 | } |
| 626 | - } | ||
| 627 | 601 | ||
| 628 | // if duration specified, and exceed it, stop play live. | 602 | // if duration specified, and exceed it, stop play live. |
| 629 | // @see: https://github.com/winlinvip/simple-rtmp-server/issues/45 | 603 | // @see: https://github.com/winlinvip/simple-rtmp-server/issues/45 |
-
请 注册 或 登录 后发表评论