From: Steinar H. Gunderson Date: Sun, 17 Mar 2019 18:35:15 +0000 (+0100) Subject: Add a call create_frame() to help performance in VA-API MJPEG uploads. X-Git-Tag: 0.7.4~1 X-Git-Url: https://git.sesse.net/?p=bmusb;a=commitdiff_plain;h=03e38890b599efe6ac906fdb70b43cda63f11d01 Add a call create_frame() to help performance in VA-API MJPEG uploads. --- diff --git a/bmusb/bmusb.h b/bmusb/bmusb.h index a484496..cec84d9 100644 --- a/bmusb/bmusb.h +++ b/bmusb/bmusb.h @@ -73,6 +73,22 @@ class FrameAllocator { // if so, the frame in progress will be dropped. virtual Frame alloc_frame() = 0; + // Similar to alloc_frame(), with two additional restrictions: + // + // - The width, height and stride given must be correct + // (can not be changed after the call). + // - create_frame(), unlike alloc_frame(), is allowed to sleep + // (so bmusb will never call it, but in Nageru, other producers + // might) + // + // These two restrictions are relevant for Nageru, since it means that + // it can make frame_copy point directly into a VA-API buffer to avoid + // an extra copy. + virtual Frame create_frame(size_t width, size_t height, size_t stride) + { + return alloc_frame(); + } + virtual void release_frame(Frame frame) = 0; };