File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
src/framework/audio/common/rpc Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -590,19 +590,30 @@ class RpcPacker
590
590
template <class ... Types>
591
591
static ByteArray pack (const Options& opt, const Types&... args)
592
592
{
593
- return msgpack::pack (opt, args ...);
593
+ ByteArray ba;
594
+
595
+ // clear but keep capacity
596
+ buffer.clear ();
597
+ // makes sense if the reserve is greater than the current capacity
598
+ buffer.reserve (std::max (opt.rezerveSize , DEFAULT_CAPACITY));
599
+ msgpack::pack (buffer, args ...);
600
+
601
+ return ByteArray (&buffer[0 ], buffer.size ());
594
602
}
595
603
596
604
template <class ... Types>
597
605
static ByteArray pack (const Types&... args)
598
606
{
599
- return msgpack ::pack (args ...);
607
+ return RpcPacker ::pack (Options {}, args ...);
600
608
}
601
609
602
610
template <class ... Types>
603
611
static bool unpack (const ByteArray& data, Types&... args)
604
612
{
605
613
return msgpack::unpack (data, args ...);
606
614
}
615
+
616
+ static constexpr size_t DEFAULT_CAPACITY = 1024 * 200 ;
617
+ static inline std::vector<uint8_t > buffer = {};
607
618
};
608
619
}
You can’t perform that action at this time.
0 commit comments