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 727885 - coremediabuffer: handle stride alignment
coremediabuffer: handle stride alignment
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Mac OS
: Normal normal
: 1.3.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on: 727953
Blocks: 728249
 
 
Reported: 2014-04-09 10:08 UTC by Matthieu Bouron
Modified: 2014-04-24 10:29 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
WIP coremediabuffer: handle stride alignment (9.47 KB, patch)
2014-04-09 10:09 UTC, Matthieu Bouron
none Details | Review
coremediabuffer: handle stride alignment (10.56 KB, patch)
2014-04-15 09:30 UTC, Matthieu Bouron
none Details | Review

Description Matthieu Bouron 2014-04-09 10:08:27 UTC
This following patch make the coremedia buffers handle the stride alignment of the CVPixel buffers through the use of the video meta API. It is based on the corevideobuffer code.

Properly handle the stride alignment is required by iosavassetsrc (which i'm currently porting to 1.0).

It changes the API of coremediabuffer, so an element can decide wether or not to use the video meta API (according to downstream capabilities).

GstBuffer * gst_core_media_buffer_new (CMSampleBufferRef sample_buf);
->
GstBuffer * gst_core_media_buffer_new (CMSampleBufferRef sample_buf, gboolean use_video_meta);

Also, If the video meta API is not used and the cv pixel buffer contains padding, the core media buffer frame is copied to a SYSMEM buffer frame, thus removing the padding. In this case a regular GstBuffer is returned by the function (not a GstCoreMediaBuffer).

This fallback method can be provided as a separate public function so it is the element responsability of removing the padding. In this case the gst_core_media_buffer_new method must return somehow the fact that the underlying buffer contains padding to avoid an unnecessary copy.

Note: this is work in progress, every element using coremedia buffers (vtenc, avfvideosrc) won't compile.

What do you think ?
Comment 1 Matthieu Bouron 2014-04-09 10:09:09 UTC
Created attachment 273876 [details] [review]
WIP coremediabuffer: handle stride alignment
Comment 2 Andoni Morales 2014-04-09 10:49:07 UTC
Review of attachment 273876 [details] [review]:

Looks good for now

::: sys/applemedia/coremediabuffer.c
@@ -112,0 +123,58 @@
+
+    n_planes = 1;
+    stride[0] = CVPixelBufferGetBytesPerRow (pixel_buf);
... 55 more ...

I think you can use NULL for the allocator and it will use the default allocator
Comment 3 Matthieu Bouron 2014-04-09 15:35:05 UTC
Review of attachment 273876 [details] [review]:

::: sys/applemedia/coremediabuffer.c
@@ -85,1 +100,1 @@
-    if (CVPixelBufferLockBaseAddress (pixel_buf,
+  has_padding = FALSE;

*has_padding = FALSE;

Fixed locally.
Comment 4 Matthieu Bouron 2014-04-15 09:30:43 UTC
Created attachment 274343 [details] [review]
coremediabuffer: handle stride alignment
Comment 5 Edward Hervey 2014-04-24 10:29:02 UTC
commit e728ee820868518a717342d4bc6b00d1f01b33b0
Author: Matthieu Bouron <matthieu.bouron@collabora.com>
Date:   Wed Apr 9 10:55:03 2014 +0100

    coremediabuffer: handle stride alignment
    
    Handle stride alignment through the use of the video meta API. The
    code is based on the corevideobuffer implementation.
    
    If the video meta API is not supported and the underlying buffer
    contains padding, the core media buffer is copied to a system memory
    buffer.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=727885