zhengfl

fix #437

edge模式,重新从源站拉流时,导致forwarders异常
@@ -94,6 +94,13 @@ int SrsEdgeIngester::initialize(SrsSource* source, SrsPlayEdge* edge, SrsRequest @@ -94,6 +94,13 @@ int SrsEdgeIngester::initialize(SrsSource* source, SrsPlayEdge* edge, SrsRequest
94 94
95 int SrsEdgeIngester::start() 95 int SrsEdgeIngester::start()
96 { 96 {
  97 + int ret = ERROR_SUCCESS;
  98 +
  99 + if ((ret = _source->on_publish()) != ERROR_SUCCESS) {
  100 + srs_error("edge pull stream then publish to edge failed. ret=%d", ret);
  101 + return ret;
  102 + }
  103 +
97 return pthread->start(); 104 return pthread->start();
98 } 105 }
99 106
@@ -114,7 +121,8 @@ void SrsEdgeIngester::stop() @@ -114,7 +121,8 @@ void SrsEdgeIngester::stop()
114 int SrsEdgeIngester::cycle() 121 int SrsEdgeIngester::cycle()
115 { 122 {
116 int ret = ERROR_SUCCESS; 123 int ret = ERROR_SUCCESS;
117 - 124 + _source->on_source_id_changed(_srs_context->get_id());
  125 +
118 std::string ep_server, ep_port; 126 std::string ep_server, ep_port;
119 if ((ret = connect_server(ep_server, ep_port)) != ERROR_SUCCESS) { 127 if ((ret = connect_server(ep_server, ep_port)) != ERROR_SUCCESS) {
120 return ret; 128 return ret;
@@ -144,11 +152,6 @@ int SrsEdgeIngester::cycle() @@ -144,11 +152,6 @@ int SrsEdgeIngester::cycle()
144 return ret; 152 return ret;
145 } 153 }
146 154
147 - if ((ret = _source->on_publish()) != ERROR_SUCCESS) {  
148 - srs_error("edge pull stream then publish to edge failed. ret=%d", ret);  
149 - return ret;  
150 - }  
151 -  
152 if ((ret = _edge->on_ingest_play()) != ERROR_SUCCESS) { 155 if ((ret = _edge->on_ingest_play()) != ERROR_SUCCESS) {
153 return ret; 156 return ret;
154 } 157 }