winlin

refine code, replace all rtmp connect by simple rtmp client.

@@ -42,6 +42,7 @@ using namespace std; @@ -42,6 +42,7 @@ using namespace std;
42 #include <srs_raw_avc.hpp> 42 #include <srs_raw_avc.hpp>
43 #include <srs_kernel_codec.hpp> 43 #include <srs_kernel_codec.hpp>
44 #include <srs_app_pithy_print.hpp> 44 #include <srs_app_pithy_print.hpp>
  45 +#include <srs_app_rtmp_conn.hpp>
45 46
46 #ifdef SRS_AUTO_STREAM_CASTER 47 #ifdef SRS_AUTO_STREAM_CASTER
47 48
@@ -167,7 +168,7 @@ int SrsRtspJitter::correct(int64_t& ts) @@ -167,7 +168,7 @@ int SrsRtspJitter::correct(int64_t& ts)
167 previous_timestamp = ts; 168 previous_timestamp = ts;
168 } 169 }
169 170
170 - delta = srs_max(0, ts - previous_timestamp); 171 + delta = srs_max(0, (int)(ts - previous_timestamp));
171 if (delta > 90000) { 172 if (delta > 90000) {
172 delta = 0; 173 delta = 0;
173 } 174 }
@@ -195,9 +196,7 @@ SrsRtspConn::SrsRtspConn(SrsRtspCaster* c, st_netfd_t fd, std::string o) @@ -195,9 +196,7 @@ SrsRtspConn::SrsRtspConn(SrsRtspCaster* c, st_netfd_t fd, std::string o)
195 trd = new SrsOneCycleThread("rtsp", this); 196 trd = new SrsOneCycleThread("rtsp", this);
196 197
197 req = NULL; 198 req = NULL;
198 - client = NULL;  
199 - transport = new SrsTcpClient();  
200 - stream_id = 0; 199 + sdk = new SrsSimpleRtmpClient();
201 vjitter = new SrsRtspJitter(); 200 vjitter = new SrsRtspJitter();
202 ajitter = new SrsRtspJitter(); 201 ajitter = new SrsRtspJitter();
203 202
@@ -218,8 +217,7 @@ SrsRtspConn::~SrsRtspConn() @@ -218,8 +217,7 @@ SrsRtspConn::~SrsRtspConn()
218 srs_freep(skt); 217 srs_freep(skt);
219 srs_freep(rtsp); 218 srs_freep(rtsp);
220 219
221 - srs_freep(client);  
222 - srs_freep(transport); 220 + srs_freep(sdk);
223 srs_freep(req); 221 srs_freep(req);
224 222
225 srs_freep(vjitter); 223 srs_freep(vjitter);
@@ -626,14 +624,14 @@ int SrsRtspConn::rtmp_write_packet(char type, u_int32_t timestamp, char* data, i @@ -626,14 +624,14 @@ int SrsRtspConn::rtmp_write_packet(char type, u_int32_t timestamp, char* data, i
626 624
627 SrsSharedPtrMessage* msg = NULL; 625 SrsSharedPtrMessage* msg = NULL;
628 626
629 - if ((ret = srs_rtmp_create_msg(type, timestamp, data, size, stream_id, &msg)) != ERROR_SUCCESS) { 627 + if ((ret = sdk->rtmp_create_msg(type, timestamp, data, size, &msg)) != ERROR_SUCCESS) {
630 srs_error("rtsp: create shared ptr msg failed. ret=%d", ret); 628 srs_error("rtsp: create shared ptr msg failed. ret=%d", ret);
631 return ret; 629 return ret;
632 } 630 }
633 srs_assert(msg); 631 srs_assert(msg);
634 632
635 // send out encoded msg. 633 // send out encoded msg.
636 - if ((ret = client->send_and_free_message(msg, stream_id)) != ERROR_SUCCESS) { 634 + if ((ret = sdk->send_and_free_message(msg)) != ERROR_SUCCESS) {
637 return ret; 635 return ret;
638 } 636 }
639 637
@@ -647,11 +645,12 @@ int SrsRtspConn::connect() @@ -647,11 +645,12 @@ int SrsRtspConn::connect()
647 645
648 // when ok, ignore. 646 // when ok, ignore.
649 // TODO: FIXME: support reconnect. 647 // TODO: FIXME: support reconnect.
650 - if (transport->connected()) { 648 + if (sdk->connected()) {
651 return ret; 649 return ret;
652 } 650 }
653 651
654 - // parse uri 652 + // generate rtmp url to connect to.
  653 + std::string url;
655 if (!req) { 654 if (!req) {
656 std::string schema, host, vhost, app, param; 655 std::string schema, host, vhost, app, param;
657 int port; 656 int port;
@@ -661,99 +660,25 @@ int SrsRtspConn::connect() @@ -661,99 +660,25 @@ int SrsRtspConn::connect()
661 std::string output = output_template; 660 std::string output = output_template;
662 output = srs_string_replace(output, "[app]", app); 661 output = srs_string_replace(output, "[app]", app);
663 output = srs_string_replace(output, "[stream]", rtsp_stream); 662 output = srs_string_replace(output, "[stream]", rtsp_stream);
664 -  
665 - req = new SrsRequest();  
666 - srs_parse_rtmp_url(output, req->tcUrl, req->stream);  
667 - srs_discovery_tc_url(req->tcUrl, req->schema, req->host, req->vhost, req->app, req->port, req->param);  
668 } 663 }
669 664
670 // connect host. 665 // connect host.
671 - if ((ret = transport->connect(req->host, req->port, ST_UTIME_NO_TIMEOUT)) != ERROR_SUCCESS) {  
672 - srs_error("rtsp: connect server %s:%d failed. ret=%d", req->host.c_str(), req->port, ret);  
673 - return ret;  
674 - }  
675 -  
676 - srs_freep(client);  
677 - client = new SrsRtmpClient(transport);  
678 -  
679 - client->set_recv_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);  
680 - client->set_send_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);  
681 -  
682 - // connect to vhost/app  
683 - if ((ret = client->handshake()) != ERROR_SUCCESS) {  
684 - srs_error("rtsp: handshake with server failed. ret=%d", ret);  
685 - return ret;  
686 - }  
687 - if ((ret = connect_app(req->host, req->port)) != ERROR_SUCCESS) {  
688 - srs_error("rtsp: connect with server failed. ret=%d", ret);  
689 - return ret;  
690 - }  
691 - if ((ret = client->create_stream(stream_id)) != ERROR_SUCCESS) {  
692 - srs_error("rtsp: connect with server failed, stream_id=%d. ret=%d", stream_id, ret); 666 + int64_t cto = SRS_CONSTS_RTMP_TIMEOUT_US;
  667 + int64_t sto = SRS_CONSTS_RTMP_PULSE_TIMEOUT_US;
  668 + if ((ret = sdk->connect(url, cto, sto)) != ERROR_SUCCESS) {
  669 + srs_error("rtsp: connect %s failed, cto=%"PRId64", sto=%"PRId64". ret=%d", url.c_str(), cto, sto, ret);
693 return ret; 670 return ret;
694 } 671 }
695 672
696 // publish. 673 // publish.
697 - if ((ret = client->publish(req->stream, stream_id)) != ERROR_SUCCESS) {  
698 - srs_error("rtsp: publish failed, stream=%s, stream_id=%d. ret=%d",  
699 - req->stream.c_str(), stream_id, ret); 674 + if ((ret = sdk->publish()) != ERROR_SUCCESS) {
  675 + srs_error("rtsp: publish %s failed. ret=%d", url.c_str(), ret);
700 return ret; 676 return ret;
701 } 677 }
702 678
703 return write_sequence_header(); 679 return write_sequence_header();
704 } 680 }
705 681
706 -// TODO: FIXME: refine the connect_app.  
707 -int SrsRtspConn::connect_app(string ep_server, int ep_port)  
708 -{  
709 - int ret = ERROR_SUCCESS;  
710 -  
711 - // args of request takes the srs info.  
712 - if (req->args == NULL) {  
713 - req->args = SrsAmf0Any::object();  
714 - }  
715 -  
716 - // notify server the edge identity,  
717 - // @see https://github.com/simple-rtmp-server/srs/issues/147  
718 - SrsAmf0Object* data = req->args;  
719 - data->set("srs_sig", SrsAmf0Any::str(RTMP_SIG_SRS_KEY));  
720 - data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")"));  
721 - data->set("srs_license", SrsAmf0Any::str(RTMP_SIG_SRS_LICENSE));  
722 - data->set("srs_role", SrsAmf0Any::str(RTMP_SIG_SRS_ROLE));  
723 - data->set("srs_url", SrsAmf0Any::str(RTMP_SIG_SRS_URL));  
724 - data->set("srs_version", SrsAmf0Any::str(RTMP_SIG_SRS_VERSION));  
725 - data->set("srs_site", SrsAmf0Any::str(RTMP_SIG_SRS_WEB));  
726 - data->set("srs_email", SrsAmf0Any::str(RTMP_SIG_SRS_EMAIL));  
727 - data->set("srs_copyright", SrsAmf0Any::str(RTMP_SIG_SRS_COPYRIGHT));  
728 - data->set("srs_primary", SrsAmf0Any::str(RTMP_SIG_SRS_PRIMARY));  
729 - data->set("srs_authors", SrsAmf0Any::str(RTMP_SIG_SRS_AUTHROS));  
730 - // for edge to directly get the id of client.  
731 - data->set("srs_pid", SrsAmf0Any::number(getpid()));  
732 - data->set("srs_id", SrsAmf0Any::number(_srs_context->get_id()));  
733 -  
734 - // local ip of edge  
735 - std::vector<std::string> ips = srs_get_local_ipv4_ips();  
736 - assert(_srs_config->get_stats_network() < (int)ips.size());  
737 - std::string local_ip = ips[_srs_config->get_stats_network()];  
738 - data->set("srs_server_ip", SrsAmf0Any::str(local_ip.c_str()));  
739 -  
740 - // generate the tcUrl  
741 - std::string param = "";  
742 - std::string tc_url = srs_generate_tc_url(ep_server, req->vhost, req->app, ep_port, param);  
743 -  
744 - // upnode server identity will show in the connect_app of client.  
745 - // @see https://github.com/simple-rtmp-server/srs/issues/160  
746 - // the debug_srs_upnode is config in vhost and default to true.  
747 - bool debug_srs_upnode = _srs_config->get_debug_srs_upnode(req->vhost);  
748 - if ((ret = client->connect_app(req->app, tc_url, req, debug_srs_upnode)) != ERROR_SUCCESS) {  
749 - srs_error("rtsp: connect with server failed, tcUrl=%s, dsu=%d. ret=%d",  
750 - tc_url.c_str(), debug_srs_upnode, ret);  
751 - return ret;  
752 - }  
753 -  
754 - return ret;  
755 -}  
756 -  
757 SrsRtspCaster::SrsRtspCaster(SrsConfDirective* c) 682 SrsRtspCaster::SrsRtspCaster(SrsConfDirective* c)
758 { 683 {
759 // TODO: FIXME: support reload. 684 // TODO: FIXME: support reload.
@@ -56,6 +56,7 @@ class SrsSharedPtrMessage; @@ -56,6 +56,7 @@ class SrsSharedPtrMessage;
56 class SrsCodecSample; 56 class SrsCodecSample;
57 class SrsSimpleStream; 57 class SrsSimpleStream;
58 class SrsPithyPrint; 58 class SrsPithyPrint;
  59 +class SrsSimpleRtmpClient;
59 60
60 /** 61 /**
61 * a rtp connection which transport a stream. 62 * a rtp connection which transport a stream.
@@ -139,11 +140,9 @@ private: @@ -139,11 +140,9 @@ private:
139 SrsOneCycleThread* trd; 140 SrsOneCycleThread* trd;
140 private: 141 private:
141 SrsRequest* req; 142 SrsRequest* req;
142 - SrsTcpClient* transport;  
143 - SrsRtmpClient* client; 143 + SrsSimpleRtmpClient* sdk;
144 SrsRtspJitter* vjitter; 144 SrsRtspJitter* vjitter;
145 SrsRtspJitter* ajitter; 145 SrsRtspJitter* ajitter;
146 - int stream_id;  
147 private: 146 private:
148 SrsRawH264Stream* avc; 147 SrsRawH264Stream* avc;
149 std::string h264_sps; 148 std::string h264_sps;
@@ -181,7 +180,6 @@ private: @@ -181,7 +180,6 @@ private:
181 // connect to rtmp output url. 180 // connect to rtmp output url.
182 // @remark ignore when not connected, reconnect when disconnected. 181 // @remark ignore when not connected, reconnect when disconnected.
183 virtual int connect(); 182 virtual int connect();
184 - virtual int connect_app(std::string ep_server, int ep_port);  
185 }; 183 };
186 184
187 /** 185 /**
@@ -47,6 +47,7 @@ using namespace std; @@ -47,6 +47,7 @@ using namespace std;
47 #include <srs_protocol_amf0.hpp> 47 #include <srs_protocol_amf0.hpp>
48 #include <srs_raw_avc.hpp> 48 #include <srs_raw_avc.hpp>
49 #include <srs_app_http_conn.hpp> 49 #include <srs_app_http_conn.hpp>
  50 +#include <srs_app_rtmp_conn.hpp>
50 51
51 // pre-declare 52 // pre-declare
52 int proxy_hls2rtmp(std::string hls, std::string rtmp); 53 int proxy_hls2rtmp(std::string hls, std::string rtmp);
@@ -637,9 +638,7 @@ private: @@ -637,9 +638,7 @@ private:
637 int64_t raw_aac_dts; 638 int64_t raw_aac_dts;
638 private: 639 private:
639 SrsRequest* req; 640 SrsRequest* req;
640 - SrsTcpClient* transport;  
641 - SrsRtmpClient* client;  
642 - int stream_id; 641 + SrsSimpleRtmpClient* sdk;
643 private: 642 private:
644 SrsRawH264Stream* avc; 643 SrsRawH264Stream* avc;
645 std::string h264_sps; 644 std::string h264_sps;
@@ -657,9 +656,7 @@ public: @@ -657,9 +656,7 @@ public:
657 raw_aac_dts = srs_update_system_time_ms(); 656 raw_aac_dts = srs_update_system_time_ms();
658 657
659 req = NULL; 658 req = NULL;
660 - client = NULL;  
661 - transport = new SrsTcpClient();  
662 - stream_id = 0; 659 + sdk = new SrsSimpleRtmpClient();
663 660
664 avc = new SrsRawH264Stream(); 661 avc = new SrsRawH264Stream();
665 aac = new SrsRawAacStream(); 662 aac = new SrsRawAacStream();
@@ -670,7 +667,7 @@ public: @@ -670,7 +667,7 @@ public:
670 virtual ~SrsIngestSrsOutput() { 667 virtual ~SrsIngestSrsOutput() {
671 close(); 668 close();
672 669
673 - srs_freep(transport); 670 + srs_freep(sdk);
674 srs_freep(avc); 671 srs_freep(avc);
675 srs_freep(aac); 672 srs_freep(aac);
676 673
@@ -707,7 +704,6 @@ public: @@ -707,7 +704,6 @@ public:
707 */ 704 */
708 virtual int flush_message_queue(); 705 virtual int flush_message_queue();
709 private: 706 private:
710 - virtual int connect_app(std::string ep_server, int ep_port);  
711 // close the connected io and rtmp to ready to be re-connect. 707 // close the connected io and rtmp to ready to be re-connect.
712 virtual void close(); 708 virtual void close();
713 }; 709 };
@@ -1187,7 +1183,7 @@ int SrsIngestSrsOutput::rtmp_write_packet(char type, u_int32_t timestamp, char* @@ -1187,7 +1183,7 @@ int SrsIngestSrsOutput::rtmp_write_packet(char type, u_int32_t timestamp, char*
1187 1183
1188 SrsSharedPtrMessage* msg = NULL; 1184 SrsSharedPtrMessage* msg = NULL;
1189 1185
1190 - if ((ret = srs_rtmp_create_msg(type, timestamp, data, size, stream_id, &msg)) != ERROR_SUCCESS) { 1186 + if ((ret = sdk->rtmp_create_msg(type, timestamp, data, size, &msg)) != ERROR_SUCCESS) {
1191 srs_error("mpegts: create shared ptr msg failed. ret=%d", ret); 1187 srs_error("mpegts: create shared ptr msg failed. ret=%d", ret);
1192 return ret; 1188 return ret;
1193 } 1189 }
@@ -1196,7 +1192,7 @@ int SrsIngestSrsOutput::rtmp_write_packet(char type, u_int32_t timestamp, char* @@ -1196,7 +1192,7 @@ int SrsIngestSrsOutput::rtmp_write_packet(char type, u_int32_t timestamp, char*
1196 srs_info("RTMP type=%d, dts=%d, size=%d", type, timestamp, size); 1192 srs_info("RTMP type=%d, dts=%d, size=%d", type, timestamp, size);
1197 1193
1198 // send out encoded msg. 1194 // send out encoded msg.
1199 - if ((ret = client->send_and_free_message(msg, stream_id)) != ERROR_SUCCESS) { 1195 + if ((ret = sdk->send_and_free_message(msg)) != ERROR_SUCCESS) {
1200 srs_error("send RTMP type=%d, dts=%d, size=%d failed. ret=%d", type, timestamp, size, ret); 1196 srs_error("send RTMP type=%d, dts=%d, size=%d failed. ret=%d", type, timestamp, size, ret);
1201 return ret; 1197 return ret;
1202 } 1198 }
@@ -1210,110 +1206,24 @@ int SrsIngestSrsOutput::connect() @@ -1210,110 +1206,24 @@ int SrsIngestSrsOutput::connect()
1210 1206
1211 // when ok, ignore. 1207 // when ok, ignore.
1212 // TODO: FIXME: should reconnect when disconnected. 1208 // TODO: FIXME: should reconnect when disconnected.
1213 - if (transport->connected()) { 1209 + if (sdk->connected()) {
1214 return ret; 1210 return ret;
1215 } 1211 }
1216 1212
1217 - srs_trace("connect output=%s", out_rtmp->get_url().c_str());  
1218 -  
1219 - // parse uri  
1220 - if (!req) {  
1221 - req = new SrsRequest();  
1222 -  
1223 - string uri = req->tcUrl = out_rtmp->get_url();  
1224 -  
1225 - // tcUrl, stream  
1226 - if (srs_string_contains(uri, "/")) {  
1227 - req->stream = srs_path_basename(uri);  
1228 - req->tcUrl = uri = srs_path_dirname(uri);  
1229 - }  
1230 -  
1231 - srs_discovery_tc_url(req->tcUrl,  
1232 - req->schema, req->host, req->vhost, req->app, req->port,  
1233 - req->param);  
1234 - } 1213 + std::string url = out_rtmp->get_url();
  1214 + srs_trace("connect output=%s", url.c_str());
1235 1215
1236 // connect host. 1216 // connect host.
1237 - if ((ret = transport->connect(req->host, req->port, ST_UTIME_NO_TIMEOUT)) != ERROR_SUCCESS) {  
1238 - srs_error("mpegts: connect server %s:%d failed. ret=%d", req->host.c_str(), req->port, ret);  
1239 - return ret;  
1240 - }  
1241 -  
1242 - srs_freep(client);  
1243 - client = new SrsRtmpClient(transport);  
1244 -  
1245 - client->set_recv_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);  
1246 - client->set_send_timeout(SRS_CONSTS_RTMP_TIMEOUT_US);  
1247 -  
1248 - // connect to vhost/app  
1249 - if ((ret = client->handshake()) != ERROR_SUCCESS) {  
1250 - srs_error("mpegts: handshake with server failed. ret=%d", ret);  
1251 - return ret;  
1252 - }  
1253 - if ((ret = connect_app(req->host, req->port)) != ERROR_SUCCESS) {  
1254 - srs_error("mpegts: connect with server failed. ret=%d", ret);  
1255 - return ret;  
1256 - }  
1257 - if ((ret = client->create_stream(stream_id)) != ERROR_SUCCESS) {  
1258 - srs_error("mpegts: connect with server failed, stream_id=%d. ret=%d", stream_id, ret); 1217 + int64_t cto = SRS_CONSTS_RTMP_TIMEOUT_US;
  1218 + int64_t sto = SRS_CONSTS_RTMP_PULSE_TIMEOUT_US;
  1219 + if ((ret = sdk->connect(url, cto, sto)) != ERROR_SUCCESS) {
  1220 + srs_error("mpegts: connect %s failed, cto=%"PRId64", sto=%"PRId64". ret=%d", url.c_str(), cto, sto, ret);
1259 return ret; 1221 return ret;
1260 } 1222 }
1261 1223
1262 // publish. 1224 // publish.
1263 - if ((ret = client->publish(req->stream, stream_id)) != ERROR_SUCCESS) {  
1264 - srs_error("mpegts: publish failed, stream=%s, stream_id=%d. ret=%d",  
1265 - req->stream.c_str(), stream_id, ret);  
1266 - return ret;  
1267 - }  
1268 -  
1269 - return ret;  
1270 -}  
1271 -  
1272 -// TODO: FIXME: refine the connect_app.  
1273 -int SrsIngestSrsOutput::connect_app(string ep_server, int ep_port)  
1274 -{  
1275 - int ret = ERROR_SUCCESS;  
1276 -  
1277 - // args of request takes the srs info.  
1278 - if (req->args == NULL) {  
1279 - req->args = SrsAmf0Any::object();  
1280 - }  
1281 -  
1282 - // notify server the edge identity,  
1283 - // @see https://github.com/simple-rtmp-server/srs/issues/147  
1284 - SrsAmf0Object* data = req->args;  
1285 - data->set("srs_sig", SrsAmf0Any::str(RTMP_SIG_SRS_KEY));  
1286 - data->set("srs_server", SrsAmf0Any::str(RTMP_SIG_SRS_KEY" "RTMP_SIG_SRS_VERSION" ("RTMP_SIG_SRS_URL_SHORT")"));  
1287 - data->set("srs_license", SrsAmf0Any::str(RTMP_SIG_SRS_LICENSE));  
1288 - data->set("srs_role", SrsAmf0Any::str(RTMP_SIG_SRS_ROLE));  
1289 - data->set("srs_url", SrsAmf0Any::str(RTMP_SIG_SRS_URL));  
1290 - data->set("srs_version", SrsAmf0Any::str(RTMP_SIG_SRS_VERSION));  
1291 - data->set("srs_site", SrsAmf0Any::str(RTMP_SIG_SRS_WEB));  
1292 - data->set("srs_email", SrsAmf0Any::str(RTMP_SIG_SRS_EMAIL));  
1293 - data->set("srs_copyright", SrsAmf0Any::str(RTMP_SIG_SRS_COPYRIGHT));  
1294 - data->set("srs_primary", SrsAmf0Any::str(RTMP_SIG_SRS_PRIMARY));  
1295 - data->set("srs_authors", SrsAmf0Any::str(RTMP_SIG_SRS_AUTHROS));  
1296 - // for edge to directly get the id of client.  
1297 - data->set("srs_pid", SrsAmf0Any::number(getpid()));  
1298 - data->set("srs_id", SrsAmf0Any::number(_srs_context->get_id()));  
1299 -  
1300 - // local ip of edge  
1301 - std::vector<std::string> ips = srs_get_local_ipv4_ips();  
1302 - assert(0 < (int)ips.size());  
1303 - std::string local_ip = ips[0];  
1304 - data->set("srs_server_ip", SrsAmf0Any::str(local_ip.c_str()));  
1305 -  
1306 - // generate the tcUrl  
1307 - std::string param = "";  
1308 - std::string tc_url = srs_generate_tc_url(ep_server, req->vhost, req->app, ep_port, param);  
1309 -  
1310 - // upnode server identity will show in the connect_app of client.  
1311 - // @see https://github.com/simple-rtmp-server/srs/issues/160  
1312 - // the debug_srs_upnode is config in vhost and default to true.  
1313 - bool debug_srs_upnode = true;  
1314 - if ((ret = client->connect_app(req->app, tc_url, req, debug_srs_upnode)) != ERROR_SUCCESS) {  
1315 - srs_error("mpegts: connect with server failed, tcUrl=%s, dsu=%d. ret=%d",  
1316 - tc_url.c_str(), debug_srs_upnode, ret); 1225 + if ((ret = sdk->publish()) != ERROR_SUCCESS) {
  1226 + srs_error("mpegts: publish %s failed. ret=%d", url.c_str(), ret);
1317 return ret; 1227 return ret;
1318 } 1228 }
1319 1229
@@ -1325,10 +1235,8 @@ void SrsIngestSrsOutput::close() @@ -1325,10 +1235,8 @@ void SrsIngestSrsOutput::close()
1325 srs_trace("close output=%s", out_rtmp->get_url().c_str()); 1235 srs_trace("close output=%s", out_rtmp->get_url().c_str());
1326 h264_sps_pps_sent = false; 1236 h264_sps_pps_sent = false;
1327 1237
1328 - srs_freep(client);  
1329 srs_freep(req); 1238 srs_freep(req);
1330 -  
1331 - transport->close(); 1239 + sdk->close();
1332 } 1240 }
1333 1241
1334 // the context for ingest hls stream. 1242 // the context for ingest hls stream.