mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
Performance: 使用循环池优化rtmp分发性能
This commit is contained in:
parent
5404a5266a
commit
97f7255f0a
@ -55,6 +55,7 @@ static string openssl_HMACsha256(const void *key, size_t key_len, const void *da
|
||||
namespace mediakit {
|
||||
|
||||
RtmpProtocol::RtmpProtocol() {
|
||||
_packet_pool.setSize(64);
|
||||
_next_step_func = [this](const char *data, size_t len) {
|
||||
return handle_C0C1(data, len);
|
||||
};
|
||||
@ -776,7 +777,7 @@ void RtmpProtocol::handle_chunk(RtmpPacket::Ptr packet) {
|
||||
}
|
||||
|
||||
BufferRaw::Ptr RtmpProtocol::obtainBuffer(const void *data, size_t len) {
|
||||
auto buffer = BufferRaw::create();
|
||||
auto buffer = _packet_pool.obtain();
|
||||
if (data && len) {
|
||||
buffer->assign((const char *) data, len);
|
||||
}
|
||||
|
@ -107,6 +107,8 @@ private:
|
||||
function<const char * (const char *data, size_t len)> _next_step_func;
|
||||
////////////Chunk////////////
|
||||
unordered_map<int, std::pair<RtmpPacket::Ptr/*now*/, RtmpPacket::Ptr/*last*/> > _map_chunk_data;
|
||||
//循环池
|
||||
ResourcePool<BufferRaw> _packet_pool;
|
||||
};
|
||||
|
||||
} /* namespace mediakit */
|
||||
|
Loading…
Reference in New Issue
Block a user