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 790473 - kmssink: VideoCrop meta is ignored as the meta is lost when wrapping or copying buffers
kmssink: VideoCrop meta is ignored as the meta is lost when wrapping or copyi...
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal normal
: 1.13.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2017-11-17 03:46 UTC by kevin
Modified: 2017-12-07 01:39 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
gstbuffer: Need check GstParentBufferMeta when get buffer meta. (39.90 KB, patch)
2017-11-17 03:47 UTC, kevin
none Details | Review
Copy metas from parent buffer when importing DMA buffer. (933 bytes, patch)
2017-11-21 03:25 UTC, kevin
none Details | Review
Get metas from original buffer. (911 bytes, patch)
2017-11-23 02:31 UTC, kevin
accepted-commit_now Details | Review
kmssink: need copy meta data from orginal buffer (764 bytes, patch)
2017-11-28 07:59 UTC, Haihua Hu
none Details | Review
kmssink: need copy meta data from orginal buffer (966 bytes, patch)
2017-11-28 08:46 UTC, Haihua Hu
none Details | Review
kmssink: Refer to the original buffer to get meta (2.02 KB, patch)
2017-12-04 14:55 UTC, Nicolas Dufresne (ndufresne)
none Details | Review
kmssink: Fix CropMeta support (1.57 KB, patch)
2017-12-04 17:11 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review

Description kevin 2017-11-17 03:46:14 UTC
Need check GstParentBufferMeta when get buffer meta. Or will lose some mata.
Comment 1 kevin 2017-11-17 03:47:48 UTC
Created attachment 363877 [details] [review]
gstbuffer: Need check GstParentBufferMeta when get buffer meta.
Comment 2 Sebastian Dröge (slomo) 2017-11-17 10:07:34 UTC
Comment on attachment 363877 [details] [review]
gstbuffer: Need check GstParentBufferMeta when get buffer meta.

Please remove the .swp file from the patch


Also what's the use case for this? The parent buffer meta only exists to keep the parent buffer around, not to make the child buffer "mirror" the parent buffer with regard to metas.

If that is needed, the metas would've had to be copied when creating the child buffer already.
Comment 3 kevin 2017-11-20 01:55:55 UTC
I met the issue in gst_kms_sink_import_dmabuf(). gst_buffer_add_parent_buffer_meta() be called in the function, but not copy crop meta. gst_kms_sink_show_frame() will get crop meta from output buffer from gst_buffer_add_parent_buffer_meta(). So loss the crop meta.

Another way is gst_kms_sink_show_frame() get meta from original buffer or copy meta from original buffer to output buffer. What is your option?
Comment 4 Sebastian Dröge (slomo) 2017-11-20 07:57:21 UTC
It should be copied
Comment 5 Nicolas Dufresne (ndufresne) 2017-11-20 17:15:16 UTC
I'd prefer we don't waste time copying to a local and meaningless wrapper, and make sure to always access the original buffer. To me, it's a bug to check meta's on the internal wrapper. If it was a filter, I would have a different talk.
Comment 6 kevin 2017-11-21 03:25:36 UTC
Created attachment 364092 [details] [review]
Copy metas from parent buffer when importing DMA buffer.

I prefer copy those metas to avoid other mistake when need other information.
Comment 7 Víctor Manuel Jáquez Leal 2017-11-21 10:08:20 UTC
If I understand correctly, the bug is crop meta is lost when importing a dmabuf, am I right?
Comment 8 Nicolas Dufresne (ndufresne) 2017-11-21 14:55:17 UTC
Review of attachment 364092 [details] [review]:

Still, it seems error prone, an example is the GstVideoMeta, which is not copied.
Comment 9 kevin 2017-11-23 02:31:33 UTC
Created attachment 364248 [details] [review]
Get metas from original buffer.

If so, need get all metas from original buffer.
Comment 10 Haihua Hu 2017-11-28 07:59:26 UTC
Created attachment 364544 [details] [review]
kmssink: need copy meta data from orginal buffer
Comment 11 Haihua Hu 2017-11-28 08:46:29 UTC
Created attachment 364547 [details] [review]
kmssink: need copy meta data from orginal buffer
Comment 12 Nicolas Dufresne (ndufresne) 2017-12-03 00:41:25 UTC
Review of attachment 364248 [details] [review]:

TO me this one is the right fix. Is there anything not covered ?
Comment 13 Haihua Hu 2017-12-04 01:37:00 UTC
(In reply to Nicolas Dufresne (stormer) from comment #12)
> Review of attachment 364248 [details] [review] [review]:
> 
> TO me this one is the right fix. Is there anything not covered ?

if support overlay interface, then show_frame() call will input NULL buffer for refresh, as a result, get meta will fail.
Comment 14 Víctor Manuel Jáquez Leal 2017-12-04 06:44:24 UTC
(In reply to Haihua Hu from comment #13)
> (In reply to Nicolas Dufresne (stormer) from comment #12)
> > Review of attachment 364248 [details] [review] [review] [review]:
> > 
> > TO me this one is the right fix. Is there anything not covered ?
> 
> if support overlay interface, then show_frame() call will input NULL buffer
> for refresh, as a result, get meta will fail.

That cannot happen because

  if (buf)
    buffer = gst_kms_sink_get_input_buffer (self, buf);
  else if (self->last_buffer)
    buffer = gst_buffer_ref (self->last_buffer);

  if (!buffer)
    return GST_FLOW_ERROR;
Comment 15 Nicolas Dufresne (ndufresne) 2017-12-04 13:13:25 UTC
If we don't hold on the original buffer, then we have a serious importation bug.
Comment 16 Nicolas Dufresne (ndufresne) 2017-12-04 14:55:20 UTC
Created attachment 364917 [details] [review]
kmssink: Refer to the original buffer to get meta

This fixes support for the GstVideoCrop meta which was no longer
working.
Comment 17 Nicolas Dufresne (ndufresne) 2017-12-04 15:00:08 UTC
Please test, I don't have anything setting crop meta on buffers at the moment.
Comment 18 Nicolas Dufresne (ndufresne) 2017-12-04 16:11:30 UTC
Ok, that being said, I forgot that for the copy_to_dumb case, we don't keep a ref on the parent (because it's not needed). And for this case, the gst_video_frame_copy() won't copy over the CropMeta.
Comment 19 Nicolas Dufresne (ndufresne) 2017-12-04 17:11:57 UTC
Created attachment 364935 [details] [review]
kmssink: Fix CropMeta support

We copy the meta's from the original buffer to the wrapper or copied
buffer.
Comment 20 Nicolas Dufresne (ndufresne) 2017-12-04 17:13:51 UTC
This takes the originally proposed solution, but place it properly so it won't only fix it for DMABuf.
Comment 21 Nicolas Dufresne (ndufresne) 2017-12-06 19:15:11 UTC
Attachment 364935 [details] pushed as 44dabe2 - kmssink: Fix CropMeta support
Comment 22 Haihua Hu 2017-12-07 01:39:02 UTC
(In reply to Nicolas Dufresne (stormer) from comment #21)
> Attachment 364935 [details] pushed as 44dabe2 - kmssink: Fix CropMeta support

Looks good to me