GNOME Bugzilla – Bug 771750
v4l2videobufferpool: Need set right video meta
Last modified: 2017-04-10 18:16:06 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;
Looks like the wrong fix. Can you provide a method to reproduce the issue you see ?
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.
Isn't it that your driver is not using mplane as it should? You should provide traces, GST_DEBUG="v4l*"
We are waiting on your input. Please provide the information, otherwise I'll have to close this bug.
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.
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.
The project is pending and will start soon. Will update you in following weeks.
I have a strong feeling that you may have met this bug 780478 in fact ? Does that solves your issue ?
Maybe yes. Thanks for your information. Will check it later.
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!