fix , always alloc big object at heap. 2.0.205

pull/555/head^2
winlin
parent 8b24319ffb
commit 5d3a183f43

@ -337,6 +337,7 @@ Remark:
## History
* v2.0, 2015-12-22, for [#509][bug #509] always alloc big object at heap. 2.0.205
* v2.0, 2015-12-22, for [#418][bug #418] ignore null connect props to make RED5 happy. 2.0.204
* v2.0, 2015-12-22, for [#546][bug #546] thread terminate normally dispose bug. 2.0.203
* v2.0, 2015-12-22, for [#541][bug #541] failed when chunk size too small. 2.0.202
@ -1213,6 +1214,7 @@ Winlin
[bug #541]: https://github.com/ossrs/srs/issues/541
[bug #546]: https://github.com/ossrs/srs/issues/546
[bug #418]: https://github.com/ossrs/srs/issues/418
[bug #509]: https://github.com/ossrs/srs/issues/509
[bug #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx
[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.
// current release version
#define VERSION_MAJOR 2
#define VERSION_MINOR 0
#define VERSION_REVISION 204
#define VERSION_REVISION 205
// server info.
#define RTMP_SIG_SRS_KEY "SRS"

@ -1981,11 +1981,19 @@ int SrsRtmpClient::handshake()
srs_assert(hs_bytes);
SrsComplexHandshake complex_hs;
if ((ret = complex_hs.handshake_with_server(hs_bytes, io)) != ERROR_SUCCESS) {
// maybe st has problem when alloc object on stack, always alloc object at heap.
// @see https://github.com/ossrs/srs/issues/509
SrsComplexHandshake* complex_hs = new SrsComplexHandshake();
SrsAutoFree(SrsComplexHandshake, complex_hs);
if ((ret = complex_hs->handshake_with_server(hs_bytes, io)) != ERROR_SUCCESS) {
if (ret == ERROR_RTMP_TRY_SIMPLE_HS) {
SrsSimpleHandshake simple_hs;
if ((ret = simple_hs.handshake_with_server(hs_bytes, io)) != ERROR_SUCCESS) {
// always alloc object at heap.
// @see https://github.com/ossrs/srs/issues/509
SrsSimpleHandshake* simple_hs = new SrsSimpleHandshake();
SrsAutoFree(SrsSimpleHandshake, simple_hs);
if ((ret = simple_hs->handshake_with_server(hs_bytes, io)) != ERROR_SUCCESS) {
return ret;
}
}

Loading…
Cancel
Save