fixbug[play packet decode bug: srs only read bool type play reset value, actuall…
…y this value can be bool or number]
正在显示
1 个修改的文件
包含
27 行增加
和
6 行删除
1 | /* | 1 | /* |
2 | The MIT License (MIT) | 2 | The MIT License (MIT) |
3 | 3 | ||
4 | -Copyright (c) 2013 winlin | 4 | +Copyright (c) 2013-2014 winlin |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy of | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy of |
7 | this software and associated documentation files (the "Software"), to deal in | 7 | this software and associated documentation files (the "Software"), to deal in |
@@ -282,8 +282,6 @@ messages. | @@ -282,8 +282,6 @@ messages. | ||
282 | /**************************************************************************** | 282 | /**************************************************************************** |
283 | ***************************************************************************** | 283 | ***************************************************************************** |
284 | ****************************************************************************/ | 284 | ****************************************************************************/ |
285 | -// when got a messae header, increase recv timeout to got an entire message. | ||
286 | -#define SRS_MIN_RECV_TIMEOUT_US 3000 | ||
287 | 285 | ||
288 | SrsProtocol::AckWindowSize::AckWindowSize() | 286 | SrsProtocol::AckWindowSize::AckWindowSize() |
289 | { | 287 | { |
@@ -2399,11 +2397,34 @@ int SrsPlayPacket::decode(SrsStream* stream) | @@ -2399,11 +2397,34 @@ int SrsPlayPacket::decode(SrsStream* stream) | ||
2399 | srs_error("amf0 decode play duration failed. ret=%d", ret); | 2397 | srs_error("amf0 decode play duration failed. ret=%d", ret); |
2400 | return ret; | 2398 | return ret; |
2401 | } | 2399 | } |
2402 | - if (!stream->empty() && (ret = srs_amf0_read_boolean(stream, reset)) != ERROR_SUCCESS) { | ||
2403 | - srs_error("amf0 decode play reset failed. ret=%d", ret); | 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); | ||
2404 | return 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 | + } | ||
2405 | } | 2427 | } |
2406 | - | ||
2407 | srs_info("amf0 decode play packet success"); | 2428 | srs_info("amf0 decode play packet success"); |
2408 | 2429 | ||
2409 | return ret; | 2430 | return ret; |
-
请 注册 或 登录 后发表评论