winlin

refine code, remove the rtmp recv/send macro, use one macro.

@@ -235,8 +235,8 @@ int SrsForwarder::cycle() @@ -235,8 +235,8 @@ int SrsForwarder::cycle()
235 } 235 }
236 srs_assert(client); 236 srs_assert(client);
237 237
238 - client->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);  
239 - client->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US); 238 + client->set_recv_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
  239 + client->set_send_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
240 240
241 if ((ret = client->handshake()) != ERROR_SUCCESS) { 241 if ((ret = client->handshake()) != ERROR_SUCCESS) {
242 srs_error("handshake with server failed. ret=%d", ret); 242 srs_error("handshake with server failed. ret=%d", ret);
@@ -624,8 +624,8 @@ int SrsMpegtsOverUdp::connect() @@ -624,8 +624,8 @@ int SrsMpegtsOverUdp::connect()
624 srs_freep(client); 624 srs_freep(client);
625 client = new SrsRtmpClient(transport); 625 client = new SrsRtmpClient(transport);
626 626
627 - client->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);  
628 - client->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US); 627 + client->set_recv_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
  628 + client->set_send_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
629 629
630 // connect to vhost/app 630 // connect to vhost/app
631 if ((ret = client->handshake()) != ERROR_SUCCESS) { 631 if ((ret = client->handshake()) != ERROR_SUCCESS) {
@@ -362,8 +362,8 @@ int SrsRtmpConn::do_cycle() @@ -362,8 +362,8 @@ int SrsRtmpConn::do_cycle()
362 362
363 srs_trace("RTMP client ip=%s", ip.c_str()); 363 srs_trace("RTMP client ip=%s", ip.c_str());
364 364
365 - rtmp->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);  
366 - rtmp->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US); 365 + rtmp->set_recv_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
  366 + rtmp->set_send_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
367 367
368 if ((ret = rtmp->handshake()) != ERROR_SUCCESS) { 368 if ((ret = rtmp->handshake()) != ERROR_SUCCESS) {
369 srs_error("rtmp handshake failed. ret=%d", ret); 369 srs_error("rtmp handshake failed. ret=%d", ret);
@@ -690,8 +690,8 @@ int SrsRtmpConn::stream_service_cycle() @@ -690,8 +690,8 @@ int SrsRtmpConn::stream_service_cycle()
690 srs_info("security check ok"); 690 srs_info("security check ok");
691 691
692 // client is identified, set the timeout to service timeout. 692 // client is identified, set the timeout to service timeout.
693 - rtmp->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);  
694 - rtmp->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US); 693 + rtmp->set_recv_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
  694 + rtmp->set_send_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
695 695
696 // find a source to serve. 696 // find a source to serve.
697 SrsSource* source = SrsSource::fetch(req); 697 SrsSource* source = SrsSource::fetch(req);
@@ -1510,8 +1510,8 @@ int SrsRtmpConn::do_token_traverse_auth(SrsRtmpClient* client) @@ -1510,8 +1510,8 @@ int SrsRtmpConn::do_token_traverse_auth(SrsRtmpClient* client)
1510 1510
1511 srs_assert(client); 1511 srs_assert(client);
1512 1512
1513 - client->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);  
1514 - client->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US); 1513 + client->set_recv_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
  1514 + client->set_send_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
1515 1515
1516 if ((ret = client->handshake()) != ERROR_SUCCESS) { 1516 if ((ret = client->handshake()) != ERROR_SUCCESS) {
1517 srs_error("handshake with server failed. ret=%d", ret); 1517 srs_error("handshake with server failed. ret=%d", ret);
@@ -676,8 +676,8 @@ int SrsRtspConn::connect() @@ -676,8 +676,8 @@ int SrsRtspConn::connect()
676 srs_freep(client); 676 srs_freep(client);
677 client = new SrsRtmpClient(transport); 677 client = new SrsRtmpClient(transport);
678 678
679 - client->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);  
680 - client->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US); 679 + client->set_recv_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
  680 + client->set_send_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
681 681
682 // connect to vhost/app 682 // connect to vhost/app
683 if ((ret = client->handshake()) != ERROR_SUCCESS) { 683 if ((ret = client->handshake()) != ERROR_SUCCESS) {
@@ -71,14 +71,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -71,14 +71,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
71 // the common io timeout, for both recv and send. 71 // the common io timeout, for both recv and send.
72 #define SRS_CONSTS_RTMP_TIMEOUT_US (int64_t)(30*1000*1000LL) 72 #define SRS_CONSTS_RTMP_TIMEOUT_US (int64_t)(30*1000*1000LL)
73 73
74 -// TODO: FIXME: remove following two macros.  
75 -// the timeout to send data to client,  
76 -// if timeout, close the connection.  
77 -#define SRS_CONSTS_RTMP_SEND_TIMEOUT_US (int64_t)(30*1000*1000LL)  
78 -// the timeout to wait client data,  
79 -// if timeout, close the connection.  
80 -#define SRS_CONSTS_RTMP_RECV_TIMEOUT_US (int64_t)(30*1000*1000LL)  
81 -  
82 // the timeout to wait for client control message, 74 // the timeout to wait for client control message,
83 // if timeout, we generally ignore and send the data to client, 75 // if timeout, we generally ignore and send the data to client,
84 // generally, it's the pulse time for data seding. 76 // generally, it's the pulse time for data seding.
@@ -1242,8 +1242,8 @@ int SrsIngestSrsOutput::connect() @@ -1242,8 +1242,8 @@ int SrsIngestSrsOutput::connect()
1242 srs_freep(client); 1242 srs_freep(client);
1243 client = new SrsRtmpClient(transport); 1243 client = new SrsRtmpClient(transport);
1244 1244
1245 - client->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);  
1246 - client->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US); 1245 + client->set_recv_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
  1246 + client->set_send_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);
1247 1247
1248 // connect to vhost/app 1248 // connect to vhost/app
1249 if ((ret = client->handshake()) != ERROR_SUCCESS) { 1249 if ((ret = client->handshake()) != ERROR_SUCCESS) {