正在显示
3 个修改的文件
包含
7 行增加
和
6 行删除
| @@ -183,7 +183,7 @@ int SrsDynamicHttpConn::do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec) | @@ -183,7 +183,7 @@ int SrsDynamicHttpConn::do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec) | ||
| 183 | while (!rr->eof()) { | 183 | while (!rr->eof()) { |
| 184 | pprint->elapse(); | 184 | pprint->elapse(); |
| 185 | 185 | ||
| 186 | - if ((ret = sdk->connect(output)) != ERROR_SUCCESS) { | 186 | + if ((ret = sdk->connect(output, SRS_CONSTS_RTMP_RECV_TIMEOUT_US)) != ERROR_SUCCESS) { |
| 187 | return ret; | 187 | return ret; |
| 188 | } | 188 | } |
| 189 | 189 | ||
| @@ -206,6 +206,7 @@ int SrsDynamicHttpConn::do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec) | @@ -206,6 +206,7 @@ int SrsDynamicHttpConn::do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec) | ||
| 206 | return ret; | 206 | return ret; |
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | + // TODO: FIXME: for post flv, reconnect when error. | ||
| 209 | if ((ret = sdk->rtmp_write_packet(type, time, data, size)) != ERROR_SUCCESS) { | 210 | if ((ret = sdk->rtmp_write_packet(type, time, data, size)) != ERROR_SUCCESS) { |
| 210 | if (!srs_is_client_gracefully_close(ret)) { | 211 | if (!srs_is_client_gracefully_close(ret)) { |
| 211 | srs_error("flv: proxy rtmp packet failed. ret=%d", ret); | 212 | srs_error("flv: proxy rtmp packet failed. ret=%d", ret); |
| @@ -92,7 +92,7 @@ SrsSimpleRtmpClient::~SrsSimpleRtmpClient() | @@ -92,7 +92,7 @@ SrsSimpleRtmpClient::~SrsSimpleRtmpClient() | ||
| 92 | srs_freep(transport); | 92 | srs_freep(transport); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | -int SrsSimpleRtmpClient::connect(string url) | 95 | +int SrsSimpleRtmpClient::connect(string url, int64_t timeout) |
| 96 | { | 96 | { |
| 97 | int ret = ERROR_SUCCESS; | 97 | int ret = ERROR_SUCCESS; |
| 98 | 98 | ||
| @@ -110,15 +110,15 @@ int SrsSimpleRtmpClient::connect(string url) | @@ -110,15 +110,15 @@ int SrsSimpleRtmpClient::connect(string url) | ||
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | // connect host. | 112 | // connect host. |
| 113 | - if ((ret = transport->connect(req->host, req->port, ST_UTIME_NO_TIMEOUT)) != ERROR_SUCCESS) { | 113 | + if ((ret = transport->connect(req->host, req->port, timeout)) != ERROR_SUCCESS) { |
| 114 | return ret; | 114 | return ret; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | srs_freep(client); | 117 | srs_freep(client); |
| 118 | client = new SrsRtmpClient(transport); | 118 | client = new SrsRtmpClient(transport); |
| 119 | 119 | ||
| 120 | - client->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US); | ||
| 121 | - client->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US); | 120 | + client->set_recv_timeout(timeout); |
| 121 | + client->set_send_timeout(timeout); | ||
| 122 | 122 | ||
| 123 | // connect to vhost/app | 123 | // connect to vhost/app |
| 124 | if ((ret = client->handshake()) != ERROR_SUCCESS) { | 124 | if ((ret = client->handshake()) != ERROR_SUCCESS) { |
| @@ -71,7 +71,7 @@ public: | @@ -71,7 +71,7 @@ public: | ||
| 71 | SrsSimpleRtmpClient(); | 71 | SrsSimpleRtmpClient(); |
| 72 | virtual ~SrsSimpleRtmpClient(); | 72 | virtual ~SrsSimpleRtmpClient(); |
| 73 | public: | 73 | public: |
| 74 | - virtual int connect(std::string url); | 74 | + virtual int connect(std::string url, int64_t timeout); |
| 75 | virtual void close(); | 75 | virtual void close(); |
| 76 | public: | 76 | public: |
| 77 | virtual int rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size); | 77 | virtual int rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size); |
-
请 注册 或 登录 后发表评论