[Bug 708914] Add openni2 plugin and openni2src element

GStreamer (bugzilla.gnome.org) bugzilla at gnome.org
Wed Nov 6 08:22:26 PST 2013


https://bugzilla.gnome.org/show_bug.cgi?id=708914
  GStreamer | gst-plugins-bad | unspecified

--- Comment #12 from Miguel (elmiguelao) Casas-Sanchez <miguelecasassanchez at gmail.com> 2013-11-06 16:22:20 UTC ---
(In reply to comment #11)
> Review of attachment 259053 [details]:
> 
> Remove the common change from the patch
> 
> ::: ext/openni2/gstopenni2src.cpp
> @@ +70,3 @@
> +#define DEFAULT_SOURCETYPE  SOURCETYPE_DEPTH
> +
> +#define SAMPLE_READ_WAIT_TIMEOUT 2000   //2000ms
> 
> No // comments, use /* */ comments
> 

Done. Here and elsewhere.

> @@ +307,3 @@
> +  GstCaps *ret;
> +  ni2src = GST_OPENNI2_SRC (src);
> +  if (ni2src->gst_caps)
> 
> This is racy btw, you need to lock access to ni2src->gst_caps
> 

Mutex accessed.

> @@ +553,3 @@
> +    data = (guint8*) g_malloc(framesize);
> +    ni2src_buffer_as_gst_memory =
> gst_memory_new_wrapped(GST_MEMORY_FLAG_READONLY,
> +        data, framesize, 0, framesize, data, g_free);
> 
> You can also just use memory = gst_allocator_alloc (NULL, framesize, NULL);
> instead of that. Or just use gst_buffer_new_and_alloc()
> 

Did so: gst_buffer_new_and_alloc and used it to dump the Openni2 data.

> But why readonly? Also you need to be careful with the strides, maybe they're
> not the same for openni and GStreamer.
> 

I meant to be wrapping up the openni2 memory as read only, because I wouldn't
know how it'd react to writing onto it. Anyway this doesn't apply anymore :)

> @@ +559,3 @@
> +    /* Add depth as 8bit alpha channel, depth is 16bit samples */
> +    guint16* pDepth = (guint16*) src->depthFrame.getData();
> +    for( int i=0; i < src->depthFrame.getDataSize()/2; ++i)
> 
> Why divided by 2?

Multiplexing RGB and depth as RGBA is done by hand in this part of the code;
with
the depth map having 16bpp and alpha just 8bpp. The key here is that 
getDataSize() gives the size of the depth in bytes, so we divide it by two and
then
each sample is divided by 2^8, to make it 8bpp - losing accuracy in the process
of course.

Patch comming!

-- 
Configure bugmail: https://bugzilla.gnome.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the gstreamer-bugs mailing list