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]
正在显示
2 个修改的文件
包含
31 行增加
和
6 行删除
@@ -40,6 +40,8 @@ cat<<END | @@ -40,6 +40,8 @@ cat<<END | ||
40 | http://$ip/players/srs_publisher.html?vhost=players | 40 | http://$ip/players/srs_publisher.html?vhost=players |
41 | 视频会议(聊天室)应用演示: | 41 | 视频会议(聊天室)应用演示: |
42 | http://$ip/players/srs_chat.html?vhost=players | 42 | http://$ip/players/srs_chat.html?vhost=players |
43 | +默认的测速应用演示: | ||
44 | + http://$ip/players/srs_bwt.html?key=35c9b402c12a7246868752e2878f7e0e&vhost=bandcheck.srs.com | ||
43 | END | 45 | END |
44 | echo -e "${GREEN}演示地址:${BLACK}" | 46 | echo -e "${GREEN}演示地址:${BLACK}" |
45 | echo -e "${RED} http://$ip${BLACK}" | 47 | echo -e "${RED} http://$ip${BLACK}" |
@@ -2397,12 +2397,35 @@ int SrsPlayPacket::decode(SrsStream* stream) | @@ -2397,12 +2397,35 @@ int SrsPlayPacket::decode(SrsStream* stream) | ||
2397 | srs_error("amf0 decode play duration failed. ret=%d", ret); | 2397 | srs_error("amf0 decode play duration failed. ret=%d", ret); |
2398 | return ret; | 2398 | return ret; |
2399 | } | 2399 | } |
2400 | - if (!stream->empty() && (ret = srs_amf0_read_boolean(stream, reset)) != ERROR_SUCCESS) { | ||
2401 | - srs_error("amf0 decode play reset failed. ret=%d", ret); | ||
2402 | - return ret; | ||
2403 | - } | ||
2404 | - | ||
2405 | - srs_info("amf0 decode play packet success"); | 2400 | + |
2401 | + SrsAmf0Any* any_value = NULL; | ||
2402 | + if (!stream->empty()) { | ||
2403 | + if ((ret = srs_amf0_read_any(stream, any_value)) != ERROR_SUCCESS) { | ||
2404 | + ret = ERROR_RTMP_AMF0_DECODE; | ||
2405 | + srs_error("amf0 read play reset marker failed. ret=%d", ret); | ||
2406 | + return ret; | ||
2407 | + } else { | ||
2408 | + // check if the value is bool or number | ||
2409 | + // An optional Boolean value or number that specifies whether to flush any previous playlist. | ||
2410 | + if (any_value->is_boolean()) { | ||
2411 | + SrsAmf0Boolean* reset_bool = dynamic_cast<SrsAmf0Boolean*> (any_value); | ||
2412 | + if (reset_bool) { | ||
2413 | + reset = reset_bool->value; | ||
2414 | + } | ||
2415 | + } else if (any_value->is_number()) { | ||
2416 | + SrsAmf0Number* reset_number = dynamic_cast<SrsAmf0Number*> (any_value); | ||
2417 | + if (reset_number) { | ||
2418 | + reset = (reset_number->value == 0 ? false : true); | ||
2419 | + } | ||
2420 | + } else { | ||
2421 | + ret = ERROR_RTMP_AMF0_DECODE; | ||
2422 | + srs_error("amf0 decode play reset not support type. desire number or bool, ret=%d", ret); | ||
2423 | + return ret; | ||
2424 | + } | ||
2425 | + SrsAutoFree(SrsAmf0Any, any_value, false); | ||
2426 | + } | ||
2427 | + } | ||
2428 | + srs_info("amf0 decode play packet success"); | ||
2406 | 2429 | ||
2407 | return ret; | 2430 | return ret; |
2408 | } | 2431 | } |
-
请 注册 或 登录 后发表评论