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 771750 - v4l2videobufferpool: Need set right video meta
v4l2videobufferpool: Need set right video meta
Status: RESOLVED INCOMPLETE
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-09-21 07:29 UTC by kevin
Modified: 2017-04-10 18:16 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description kevin 2016-09-21 07:29:39 UTC
I need below to make v4l2videodec work. info->offset is get from plane size for multi plane format. The size maybe bigger then actual video size. But video decoder will output video buffer with actual video size. So need set actual video size to video meta.

The reason of below change is _dma_buf_upload_accept() will use the meta offset to find plane memory. Will report error when memory size is diff with actual video size.

What's your option?

diff --git a/sys/v4l2/gstv4l2bufferpool.c b/sys/v4l2/gstv4l2bufferpool.c
index a4af436..22a3600 100644
--- a/sys/v4l2/gstv4l2bufferpool.c
+++ b/sys/v4l2/gstv4l2bufferpool.c
@@ -462,10 +462,9 @@ gst_v4l2_buffer_pool_alloc_buffer (GstBufferPool * bpool, GstBuffer ** buffer,
 
   /* add metadata to raw video buffers */
   if (pool->add_videometa)
-    gst_buffer_add_video_meta_full (newbuf, GST_VIDEO_FRAME_FLAG_NONE,
+    gst_buffer_add_video_meta (newbuf, GST_VIDEO_FRAME_FLAG_NONE,
         GST_VIDEO_INFO_FORMAT (info), GST_VIDEO_INFO_WIDTH (info),
-        GST_VIDEO_INFO_HEIGHT (info), GST_VIDEO_INFO_N_PLANES (info),
-        info->offset, info->stride);
+        GST_VIDEO_INFO_HEIGHT (info));
 
   *buffer = newbuf;
Comment 1 Nicolas Dufresne (ndufresne) 2016-09-21 18:13:36 UTC
Looks like the wrong fix. Can you provide a method to reproduce the issue you see ?
Comment 2 kevin 2016-09-22 01:48:08 UTC
I met the issue with our own V4L2 driver. The V4L2 driver is in development. So I can't show your reproduce the issue.

The major point of the issue is v4l2videodec output video frame buffer with wrong meta. The video meta offset is max memory size. But glupload will use the meta as gstbuffer size.

The right fix should be update the video meta after DEQUEUE one buffer from V4L2 driver. Set the video meta offset with V4L2 output buffer payload size.
Comment 3 Nicolas Dufresne (ndufresne) 2016-09-22 12:34:02 UTC
Isn't it that your driver is not using mplane as it should? You should provide traces, GST_DEBUG="v4l*"
Comment 4 Nicolas Dufresne (ndufresne) 2016-11-24 15:54:54 UTC
We are waiting on your input. Please provide the information, otherwise I'll have to close this bug.
Comment 5 kevin 2016-11-25 02:33:31 UTC
Sorry for later response. No work environment to give you log.

You can check below code in gstglupload.c.

static gboolean
_dma_buf_upload_accept (gpointer impl, GstBuffer * buffer, GstCaps * in_caps,
    GstCaps * out_caps)
{
  /* Update video info based on video meta */
  if (meta) {
    in_info->width = meta->width;
    in_info->height = meta->height;

    for (i = 0; i < meta->n_planes; i++) {
      in_info->offset[i] = meta->offset[i];
      in_info->stride[i] = meta->stride[i];
    }
  }
...
    plane_size = gst_gl_get_plane_data_size (in_info, NULL, i);

    if (!gst_buffer_find_memory (buffer, in_info->offset[i], plane_size,
            &mems_idx[i], &length, &mems_skip[i]))
      return FALSE;
}

Maybe gst_buffer_find_memory() should use mem->maxsize for mplane buffer. Our driver output NV12 video with mplane. And append some memory at the end of Y plane.

As the work is pending, I will check it later.
Comment 6 Nicolas Dufresne (ndufresne) 2017-03-05 15:09:54 UTC
Ping, I'm still waiting for the GST_DEBUG="v4l*:7" logs to validate what your driver is doing exactly, and why such change would be needed.
Comment 7 kevin 2017-03-06 01:37:21 UTC
The project is pending and will start soon. Will update you in following weeks.
Comment 8 Nicolas Dufresne (ndufresne) 2017-03-24 17:56:38 UTC
I have a strong feeling that you may have met this bug 780478 in fact ? Does that solves your issue ?
Comment 9 kevin 2017-03-27 00:50:27 UTC
Maybe yes. Thanks for your information. Will check it later.
Comment 10 Nicolas Dufresne (ndufresne) 2017-04-10 18:16:06 UTC
Closing this bug report as no further information has been provided. Please feel free to reopen this bug report if you can provide the information that was asked for in a previous comment.
Thanks!