winlin

Merge pull request #5 from wenjiegit/master

fixbug[play packet decode bug: srs only read bool type play reset value, actually this value can be bool or number]
... ... @@ -40,6 +40,8 @@ cat<<END
http://$ip/players/srs_publisher.html?vhost=players
视频会议(聊天室)应用演示:
http://$ip/players/srs_chat.html?vhost=players
默认的测速应用演示:
http://$ip/players/srs_bwt.html?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com
END
echo -e "${GREEN}演示地址:${BLACK}"
echo -e "${RED} http://$ip${BLACK}"
... ...
... ... @@ -2397,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<SrsAmf0Boolean*> (any_value);
if (reset_bool) {
reset = reset_bool->value;
}
} else if (any_value->is_number()) {
SrsAmf0Number* reset_number = dynamic_cast<SrsAmf0Number*> (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;
}
... ...