After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 748503 - vtenc: support VT buffer pool
vtenc: support VT buffer pool
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Mac OS
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: corevideomemory
Blocks:
 
 
Reported: 2015-04-26 23:51 UTC by Ilya Konstantinov
Modified: 2018-11-03 13:34 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ilya Konstantinov 2015-04-26 23:51:08 UTC
VT provides VTCompressionSessionGetPixelBufferPool to get a CVPixelBufferPool. Using CVPixelBuffers from this pool will avoid memcpy into hardware buffers.

For this, we should implement:

1) GstCoreVideoMemory (bug 747216)

2) GstCoreVideoBufferPool extending GstBufferPool with a custom alloc_buffer

3) vtenc's propose_allocation with a single GstCoreVideoBufferPool allocation pool
Comment 1 Ilya Konstantinov 2015-04-27 00:47:56 UTC
Apple documentation says:

  While clients can call VTCompressionSessionGetPixelBufferPool once
  and retain the resulting pool, the call is cheap enough that it's OK 
  to call it once per frame.  If a change of session properties causes 
  the compressor's pixel buffer attributes to change, it's possible that
  VTCompressionSessionGetPixelBufferPool might return a different pool.

Therefore, a possible model:

typedef CVPixelBufferPoolRef (GstCoreVideoGetPixelBufferFunc *)(CFTypeRef);

gst_core_video_buffer_pool_init (GstCoreVideoGetPixelBufferFunc getPixelBufferPool, CFTypeRef context):

   e.g. called with (VTCompressionSessionGetPixelBufferPool, session)

   a) retain the context

gst_core_video_buffer_pool_acquire_buffer:

   a) get a CV pool with getPixelBufferPool
   a) get a new CVPixelBuffer from that CV pool
   b) add it as meta to GstBuffer (from pool)
   c) add GstCoreVideoMemory objects ("wrap the CVPixelBuffer")

gst_core_video_buffer_pool_reset_buffer:

   a) remove the GstCoreVideoMemory objects
   b) remove the CVPixelBuffer meta
   c) release the CVPixelBuffer

However, it's also possible that our VT session doesn't change too often, and that we'll send another propose_allocation in this case. In such case:

 - We'll retain the CVPixelBufferPool itself.

 - The CVPixelBuffers will remain attached to the GstBuffers, and therefore would never be truly released back the the CVPixelBufferPool -- instead, our own buffer pool will decide the min_buffers/max_buffers policy. (Though, on buffers above the max, CVPixelBufferPool's policy might still be applied.)

- -

Just some thoughts. Requesting comments :)
Comment 2 GStreamer system administrator 2018-11-03 13:34:36 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/issues/244.