diff --git a/README.md b/README.md index c257bf39b..8d65b2079 100755 --- a/README.md +++ b/README.md @@ -1289,6 +1289,7 @@ Winlin [bug #518]: https://github.com/ossrs/srs/issues/518 [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 #xxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxx [exo #828]: https://github.com/google/ExoPlayer/pull/828 diff --git a/trunk/src/protocol/srs_rtmp_handshake.cpp b/trunk/src/protocol/srs_rtmp_handshake.cpp index e240523e3..ca73af4e3 100644 --- a/trunk/src/protocol/srs_rtmp_handshake.cpp +++ b/trunk/src/protocol/srs_rtmp_handshake.cpp @@ -1164,6 +1164,11 @@ int SrsSimpleHandshake::handshake_with_server(SrsHandshakeBytes* hs_bytes, ISrsP if ((ret = hs_bytes->create_c2()) != ERROR_SUCCESS) { return ret; } + + // for simple handshake, copy s1 to c2. + // @see https://github.com/ossrs/srs/issues/418 + memcpy(hs_bytes->c2, hs_bytes->s0s1s2 + 1, 1536); + if ((ret = io->write(hs_bytes->c2, 1536, &nsize)) != ERROR_SUCCESS) { srs_warn("simple handshake write c2 failed. ret=%d", ret); return ret; diff --git a/trunk/src/protocol/srs_rtmp_stack.cpp b/trunk/src/protocol/srs_rtmp_stack.cpp index d9eb4ae46..0b0e88495 100644 --- a/trunk/src/protocol/srs_rtmp_stack.cpp +++ b/trunk/src/protocol/srs_rtmp_stack.cpp @@ -3300,9 +3300,24 @@ int SrsConnectAppResPacket::decode(SrsBuffer* stream) ret = ERROR_SUCCESS; } - if ((ret = props->read(stream)) != ERROR_SUCCESS) { - srs_error("amf0 decode connect props failed. ret=%d", ret); - return ret; + // for RED5(1.0.6), the props is NULL, we must ignore it. + // @see https://github.com/ossrs/srs/issues/418 + if (!stream->empty()) { + SrsAmf0Any* p = NULL; + if ((ret = srs_amf0_read_any(stream, &p)) != ERROR_SUCCESS) { + srs_error("amf0 decode connect props failed. ret=%d", ret); + return ret; + } + + // ignore when props is not amf0 object. + if (!p->is_object()) { + srs_warn("ignore connect response props marker=%#x.", (u_int8_t)p->marker); + srs_freep(p); + } else { + srs_freep(props); + props = p->to_object(); + srs_info("accept amf0 object connect response props"); + } } if ((ret = info->read(stream)) != ERROR_SUCCESS) {