winlin

fix #509, always alloc big object at heap. 2.0.205

@@ -337,6 +337,7 @@ Remark: @@ -337,6 +337,7 @@ Remark:
337 337
338 ## History 338 ## History
339 339
  340 +* v2.0, 2015-12-22, for [#509][bug #509] always alloc big object at heap. 2.0.205
340 * v2.0, 2015-12-22, for [#418][bug #418] ignore null connect props to make RED5 happy. 2.0.204 341 * v2.0, 2015-12-22, for [#418][bug #418] ignore null connect props to make RED5 happy. 2.0.204
341 * v2.0, 2015-12-22, for [#546][bug #546] thread terminate normally dispose bug. 2.0.203 342 * v2.0, 2015-12-22, for [#546][bug #546] thread terminate normally dispose bug. 2.0.203
342 * v2.0, 2015-12-22, for [#541][bug #541] failed when chunk size too small. 2.0.202 343 * v2.0, 2015-12-22, for [#541][bug #541] failed when chunk size too small. 2.0.202
@@ -1213,6 +1214,7 @@ Winlin @@ -1213,6 +1214,7 @@ Winlin
1213 [bug #541]: https://github.com/ossrs/srs/issues/541 1214 [bug #541]: https://github.com/ossrs/srs/issues/541
1214 [bug #546]: https://github.com/ossrs/srs/issues/546 1215 [bug #546]: https://github.com/ossrs/srs/issues/546
1215 [bug #418]: https://github.com/ossrs/srs/issues/418 1216 [bug #418]: https://github.com/ossrs/srs/issues/418
  1217 +[bug #509]: https://github.com/ossrs/srs/issues/509
1216 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx 1218 [bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
1217 1219
1218 [exo #828]: https://github.com/google/ExoPlayer/pull/828 1220 [exo #828]: https://github.com/google/ExoPlayer/pull/828
@@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. @@ -31,7 +31,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 // current release version 31 // current release version
32 #define VERSION_MAJOR 2 32 #define VERSION_MAJOR 2
33 #define VERSION_MINOR 0 33 #define VERSION_MINOR 0
34 -#define VERSION_REVISION 204 34 +#define VERSION_REVISION 205
35 35
36 // server info. 36 // server info.
37 #define RTMP_SIG_SRS_KEY "SRS" 37 #define RTMP_SIG_SRS_KEY "SRS"
@@ -1981,11 +1981,19 @@ int SrsRtmpClient::handshake() @@ -1981,11 +1981,19 @@ int SrsRtmpClient::handshake()
1981 1981
1982 srs_assert(hs_bytes); 1982 srs_assert(hs_bytes);
1983 1983
1984 - SrsComplexHandshake complex_hs;  
1985 - if ((ret = complex_hs.handshake_with_server(hs_bytes, io)) != ERROR_SUCCESS) { 1984 + // maybe st has problem when alloc object on stack, always alloc object at heap.
  1985 + // @see https://github.com/ossrs/srs/issues/509
  1986 + SrsComplexHandshake* complex_hs = new SrsComplexHandshake();
  1987 + SrsAutoFree(SrsComplexHandshake, complex_hs);
  1988 +
  1989 + if ((ret = complex_hs->handshake_with_server(hs_bytes, io)) != ERROR_SUCCESS) {
1986 if (ret == ERROR_RTMP_TRY_SIMPLE_HS) { 1990 if (ret == ERROR_RTMP_TRY_SIMPLE_HS) {
1987 - SrsSimpleHandshake simple_hs;  
1988 - if ((ret = simple_hs.handshake_with_server(hs_bytes, io)) != ERROR_SUCCESS) { 1991 + // always alloc object at heap.
  1992 + // @see https://github.com/ossrs/srs/issues/509
  1993 + SrsSimpleHandshake* simple_hs = new SrsSimpleHandshake();
  1994 + SrsAutoFree(SrsSimpleHandshake, simple_hs);
  1995 +
  1996 + if ((ret = simple_hs->handshake_with_server(hs_bytes, io)) != ERROR_SUCCESS) {
1989 return ret; 1997 return ret;
1990 } 1998 }
1991 } 1999 }