GNOME Bugzilla – Bug 757254
Deprecate GST_MEMORY_FLAG_NO_SHARE
Last modified: 2018-11-03 12:30:29 UTC
Created attachment 314325 [details] Test case showing that meta are not propagated. Custom metadata API cannot be copied by myapi_meta_transform (GstBuffer * transbuf, GstMeta * meta, GstBuffer * buffer, GQuark type, gpointer data) with some pipelines because transbuf is not writable. Citing this message: http://lists.freedesktop.org/archives/gstreamer-devel/2015-October/055188.html "It's a bug in videodecoder, the same bug probably also exists elsewhere." Testcase attached.
The frame is mapped from gstavviddec.c while decoding and mapping takes 1 extra ref, making it not writable. Happens at gst_ffmpegviddec_get_buffer2 Perhaps we want to use the MAP_FLAG_NO_REF flag to make sure it won't take an extra ref? Would be nice to verify that the buffer won't be unrefed while it happens is mapped.
Unfortunately it is not that simple, using the no-ref flag can be dangerous as in some scenarios the buffer in a video frame is replaced and unref'd directly while libav seems to still possess a reference to the frame, causing it to try and unref it again. Some further investigation is needed, it seems wrong to unref a mapped buffer.
Related to this is also bug #740222 and bug #754826
I wonder if the GstBuffer shouldn't be a gst_buffer_copy'd before being pushed out out of avviddec? or something like that. libav only needs the memories, not the GstBuffer struct.
Some GstMemory is not shareable, so that might be problematic in these cases.
I think NO_SHARED memory is always a mistake, the tracking should be done at the GstMemory level, not at the GstBuffer level. IE, one should always be able to subbuffer mappeable memory, there is no good reason to prevent that, only bad code on our side.
I agree, let's make NO_SHARED deprecated then? You do it? :)
Before we do, we need to sort out our own use of it, at least in: - ximagesink - ximagesrc - gst-omx - gstreamer-vaapi - kmssink - (vdpau we can ignore I think)
As a first step, we can document it as deprecated and tell people not to use it in new code.
Created attachment 355361 [details] [review] memory: Deprecate GST_MEMORY_FLAG_NO_SHARE This flag always causes problems as it prevents subbuffering, instead one should create a custom GstAllocator to pool the GstMemory objects and not rely on the lifetime of the GstBuffer object they were originally attached to.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/gstreamer/gstreamer/issues/135.