merge from srs2

pull/556/head^2
winlin 9 years ago
commit 714c13d88d

@ -1290,6 +1290,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

@ -1992,11 +1992,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