From 650b397cedf14a830d8fc0363e795623d2fd993a Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Thu, 3 Oct 2019 19:18:44 +0200 Subject: [PATCH] hwapi/base: Improve frame allocation method This allows us to cache existing frames, reducing the CPU and GPU memory load that appears due to constantly recreating frames. --- source/hwapi/base.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/source/hwapi/base.hpp b/source/hwapi/base.hpp index 36f9fe9..9a3d924 100644 --- a/source/hwapi/base.hpp +++ b/source/hwapi/base.hpp @@ -55,8 +55,13 @@ namespace obsffmpeg { public: virtual AVBufferRef* create_device_context() = 0; + virtual std::shared_ptr allocate_frame(AVBufferRef* frames) = 0; + + virtual void copy_from_obs(AVBufferRef* frames, uint32_t handle, uint64_t lock_key, + uint64_t* next_lock_key, std::shared_ptr frame) = 0; + virtual std::shared_ptr avframe_from_obs(AVBufferRef* frames, uint32_t handle, uint64_t lock_key, - uint64_t* next_lock_key) = 0; + uint64_t* next_lock_key) = 0; }; } // namespace hwapi } // namespace obsffmpeg