mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
refine simple rtmp client for post flv stream.
This commit is contained in:
parent
adb8f243bf
commit
a9ad7b211b
3 changed files with 7 additions and 6 deletions
|
@ -183,7 +183,7 @@ int SrsDynamicHttpConn::do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec)
|
|||
while (!rr->eof()) {
|
||||
pprint->elapse();
|
||||
|
||||
if ((ret = sdk->connect(output)) != ERROR_SUCCESS) {
|
||||
if ((ret = sdk->connect(output, SRS_CONSTS_RTMP_RECV_TIMEOUT_US)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -206,6 +206,7 @@ int SrsDynamicHttpConn::do_proxy(ISrsHttpResponseReader* rr, SrsFlvDecoder* dec)
|
|||
return ret;
|
||||
}
|
||||
|
||||
// TODO: FIXME: for post flv, reconnect when error.
|
||||
if ((ret = sdk->rtmp_write_packet(type, time, data, size)) != ERROR_SUCCESS) {
|
||||
if (!srs_is_client_gracefully_close(ret)) {
|
||||
srs_error("flv: proxy rtmp packet failed. ret=%d", ret);
|
||||
|
|
|
@ -92,7 +92,7 @@ SrsSimpleRtmpClient::~SrsSimpleRtmpClient()
|
|||
srs_freep(transport);
|
||||
}
|
||||
|
||||
int SrsSimpleRtmpClient::connect(string url)
|
||||
int SrsSimpleRtmpClient::connect(string url, int64_t timeout)
|
||||
{
|
||||
int ret = ERROR_SUCCESS;
|
||||
|
||||
|
@ -110,15 +110,15 @@ int SrsSimpleRtmpClient::connect(string url)
|
|||
}
|
||||
|
||||
// connect host.
|
||||
if ((ret = transport->connect(req->host, req->port, ST_UTIME_NO_TIMEOUT)) != ERROR_SUCCESS) {
|
||||
if ((ret = transport->connect(req->host, req->port, timeout)) != ERROR_SUCCESS) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
srs_freep(client);
|
||||
client = new SrsRtmpClient(transport);
|
||||
|
||||
client->set_recv_timeout(SRS_CONSTS_RTMP_RECV_TIMEOUT_US);
|
||||
client->set_send_timeout(SRS_CONSTS_RTMP_SEND_TIMEOUT_US);
|
||||
client->set_recv_timeout(timeout);
|
||||
client->set_send_timeout(timeout);
|
||||
|
||||
// connect to vhost/app
|
||||
if ((ret = client->handshake()) != ERROR_SUCCESS) {
|
||||
|
|
|
@ -71,7 +71,7 @@ public:
|
|||
SrsSimpleRtmpClient();
|
||||
virtual ~SrsSimpleRtmpClient();
|
||||
public:
|
||||
virtual int connect(std::string url);
|
||||
virtual int connect(std::string url, int64_t timeout);
|
||||
virtual void close();
|
||||
public:
|
||||
virtual int rtmp_write_packet(char type, u_int32_t timestamp, char* data, int size);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue