diff --git a/trunk/src/core/srs_core_protocol.cpp b/trunk/src/core/srs_core_protocol.cpp index 1160711bd..d07c9ff57 100755 --- a/trunk/src/core/srs_core_protocol.cpp +++ b/trunk/src/core/srs_core_protocol.cpp @@ -1,7 +1,7 @@ /* The MIT License (MIT) -Copyright (c) 2013 winlin +Copyright (c) 2013-2014 winlin Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in @@ -282,8 +282,6 @@ messages. /**************************************************************************** ***************************************************************************** ****************************************************************************/ -// when got a messae header, increase recv timeout to got an entire message. -#define SRS_MIN_RECV_TIMEOUT_US 3000 SrsProtocol::AckWindowSize::AckWindowSize() { @@ -2399,12 +2397,35 @@ int SrsPlayPacket::decode(SrsStream* stream) srs_error("amf0 decode play duration failed. ret=%d", ret); return ret; } - if (!stream->empty() && (ret = srs_amf0_read_boolean(stream, reset)) != ERROR_SUCCESS) { - srs_error("amf0 decode play reset failed. ret=%d", ret); - return ret; - } - - srs_info("amf0 decode play packet success"); + + SrsAmf0Any* any_value = NULL; + if (!stream->empty()) { + if ((ret = srs_amf0_read_any(stream, any_value)) != ERROR_SUCCESS) { + ret = ERROR_RTMP_AMF0_DECODE; + srs_error("amf0 read play reset marker failed. ret=%d", ret); + return ret; + } else { + // check if the value is bool or number + // An optional Boolean value or number that specifies whether to flush any previous playlist. + if (any_value->is_boolean()) { + SrsAmf0Boolean* reset_bool = dynamic_cast (any_value); + if (reset_bool) { + reset = reset_bool->value; + } + } else if (any_value->is_number()) { + SrsAmf0Number* reset_number = dynamic_cast (any_value); + if (reset_number) { + reset = (reset_number->value == 0 ? false : true); + } + } else { + ret = ERROR_RTMP_AMF0_DECODE; + srs_error("amf0 decode play reset not support type. desire number or bool, ret=%d", ret); + return ret; + } + SrsAutoFree(SrsAmf0Any, any_value, false); + } + } + srs_info("amf0 decode play packet success"); return ret; }