mirror of
https://github.com/ossrs/srs.git
synced 2025-02-15 04:42:04 +00:00
fixbug[play packet decode bug: srs only read bool type play reset value, actually this value can be bool or number]
This commit is contained in:
parent
3af83fb02a
commit
e959bb6c5c
1 changed files with 30 additions and 9 deletions
|
@ -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<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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue