winlin

merge from srs2, for kbps free io

@@ -207,6 +207,7 @@ Please select your language: @@ -207,6 +207,7 @@ Please select your language:
207 207
208 ### V2 changes 208 ### V2 changes
209 209
  210 +* v2.0, 2017-01-22, for [#752][bug #752] release the io then free it for kbps. 2.0.232
210 * v2.0, 2017-01-18, fix [#750][bug #750] use specific error code for dns resolve. 2.0.231 211 * v2.0, 2017-01-18, fix [#750][bug #750] use specific error code for dns resolve. 2.0.231
211 * <strong>v2.0, 2017-01-18, [2.0 beta4(2.0.230)][r2.0b4] released. 86334 lines.</strong> 212 * <strong>v2.0, 2017-01-18, [2.0 beta4(2.0.230)][r2.0b4] released. 86334 lines.</strong>
212 * v2.0, 2017-01-18, fix [#749][bug #749], timestamp overflow for ATC. 2.0.230 213 * v2.0, 2017-01-18, fix [#749][bug #749], timestamp overflow for ATC. 2.0.230
@@ -1370,6 +1371,7 @@ Winlin @@ -1370,6 +1371,7 @@ Winlin
1370 [bug #740]: https://github.com/ossrs/srs/issues/740 1371 [bug #740]: https://github.com/ossrs/srs/issues/740
1371 [bug #749]: https://github.com/ossrs/srs/issues/749 1372 [bug #749]: https://github.com/ossrs/srs/issues/749
1372 [bug #750]: https://github.com/ossrs/srs/issues/750 1373 [bug #750]: https://github.com/ossrs/srs/issues/750
  1374 +[bug #752]: https://github.com/ossrs/srs/issues/752
1373 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx 1375 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
1374 1376
1375 [bug #735]: https://github.com/ossrs/srs/issues/735 1377 [bug #735]: https://github.com/ossrs/srs/issues/735
@@ -483,7 +483,6 @@ void SrsEdgeForwarder::stop() @@ -483,7 +483,6 @@ void SrsEdgeForwarder::stop()
483 { 483 {
484 pthread->stop(); 484 pthread->stop();
485 queue->clear(); 485 queue->clear();
486 -  
487 srs_freep(sdk); 486 srs_freep(sdk);
488 } 487 }
489 488
@@ -138,9 +138,9 @@ int SrsSimpleRtmpClient::connect() @@ -138,9 +138,9 @@ int SrsSimpleRtmpClient::connect()
138 138
139 void SrsSimpleRtmpClient::close() 139 void SrsSimpleRtmpClient::close()
140 { 140 {
  141 + kbps->set_io(NULL, NULL);
141 srs_freep(client); 142 srs_freep(client);
142 srs_freep(transport); 143 srs_freep(transport);
143 - kbps->set_io(NULL, NULL);  
144 } 144 }
145 145
146 int SrsSimpleRtmpClient::connect_app() 146 int SrsSimpleRtmpClient::connect_app()
@@ -161,7 +161,7 @@ public: @@ -161,7 +161,7 @@ public:
161 * SrsKbps* kbps = ...; 161 * SrsKbps* kbps = ...;
162 * kbps->set_io(in, out); 162 * kbps->set_io(in, out);
163 * // both kbps->get_recv_bytes() and kbps->get_send_bytes() are available. 163 * // both kbps->get_recv_bytes() and kbps->get_send_bytes() are available.
164 -* // we can use the kbps as the data source of another kbps: 164 + * // we can use the kbps as the data source of another kbps:
165 * SrsKbps* user = ...; 165 * SrsKbps* user = ...;
166 * user->set_io(kbps, kbps); 166 * user->set_io(kbps, kbps);
167 * the server never know how many bytes already send/recv, for the connection maybe closed. 167 * the server never know how many bytes already send/recv, for the connection maybe closed.
@@ -176,14 +176,15 @@ public: @@ -176,14 +176,15 @@ public:
176 virtual ~SrsKbps(); 176 virtual ~SrsKbps();
177 public: 177 public:
178 /** 178 /**
179 - * set io to start new session.  
180 - * set the underlayer reader/writer,  
181 - * if the io destroied, for instance, the forwarder reconnect,  
182 - * user must set the io of SrsKbps to NULL to continue to use the kbps object.  
183 - * @param in the input stream statistic. can be NULL.  
184 - * @param out the output stream statistic. can be NULL.  
185 - * @remark if in/out is NULL, use the cached data for kbps.  
186 - */ 179 + * set io to start new session.
  180 + * set the underlayer reader/writer,
  181 + * if the io destroied, for instance, the forwarder reconnect,
  182 + * user must set the io of SrsKbps to NULL to continue to use the kbps object.
  183 + * @param in the input stream statistic. can be NULL.
  184 + * @param out the output stream statistic. can be NULL.
  185 + * @remark if in/out is NULL, use the cached data for kbps.
  186 + * @remark User must set_io(NULL, NULL) then free the in and out.
  187 + */
187 virtual void set_io(ISrsProtocolStatistic* in, ISrsProtocolStatistic* out); 188 virtual void set_io(ISrsProtocolStatistic* in, ISrsProtocolStatistic* out);
188 public: 189 public:
189 /** 190 /**