Optimize memory management and frame conversions#143
Conversation
…hing pixel formats
|
Hi, I've thoroughly tested this on my devices, and the improvements are clearly noticeable. HyperHDR benefits from this as well. Even on my old webOS 3.9 device, when the “Continuous output” option under “Smoothing” in HyperHDR is disabled, no frames are discarded or skipped—in other words, there are no glitches. Before this PR, you had to keep “Continuous output” enabled at all times, which would have consumed resources. |
|
Thanks guys! |
|
@sundermann is it already mergeable? I could do release for piccap today |
The PR has been merged, so nothing stands in the way of releasing a new version of PicCap. |
This pull request introduces several improvements and bug fixes across the build system, memory management, and frame handling logic. The most significant changes enhance buffer management to prevent memory leaks and overflows, optimize frame acquisition and conversion, and update third-party dependencies for improved reliability.
Memory Management Improvements
converter_reservehelper to safely manage buffer allocations, replacing repeatedrealloccalls and reducing the risk of memory leaks or overflows. All buffer allocations in the converter now use this function.calloccalls, ensuring correct memory allocation for buffer pointers.Frame Handling and Performance
unicapture/backends/libvtcapture.cppby introducing abuff_validflag to avoid redundant buffer queries and ensure the buffer is only refreshed when needed.unicapture/unicapture.cby adding aborrow_framehelper, allowing direct reuse of frames when the pixel format already matches the target, thus avoiding unnecessary conversions.Networking and Communication
writevfor atomic header and payload transmission, improving reliability and simplifying the code.