大幅提升接收推流性能以及降低内存占用

This commit is contained in:
xiongziliang
2020-11-01 03:41:35 +08:00
parent 5c7a08eb7c
commit 700a16c759
38 changed files with 173 additions and 193 deletions

View File

@@ -539,7 +539,7 @@ std::string AMFDecoder::load<std::string>() {
if (pos + str_len > buf.size()) {
throw std::runtime_error("Not enough data");
}
std::string s(buf, pos, str_len);
std::string s = buf.substr(pos, str_len);
pos += str_len;
return s;
}
@@ -612,7 +612,7 @@ std::string AMFDecoder::load_key() {
if (pos + str_len > buf.size()) {
throw std::runtime_error("Not enough data");
}
std::string s(buf, pos, str_len);
std::string s = buf.substr(pos, str_len);
pos += str_len;
return s;
@@ -680,7 +680,7 @@ AMFValue AMFDecoder::load_arr() {
return object;
}
AMFDecoder::AMFDecoder(const std::string &buf_in, size_t pos_in, int version_in) :
AMFDecoder::AMFDecoder(const BufferLikeString &buf_in, size_t pos_in, int version_in) :
buf(buf_in), pos(pos_in), version(version_in) {
}