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 667222 - dvdspu: use refcounting instead of explicit copy
dvdspu: use refcounting instead of explicit copy
Status: RESOLVED WONTFIX
Product: GStreamer
Classification: Platform
Component: gst-plugins-bad
git master
Other Linux
: Normal enhancement
: git master
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-01-03 21:55 UTC by Rob Clark
Modified: 2015-06-23 13:14 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
dvdspu: use refcnting instead of explicit copy (1.09 KB, patch)
2012-01-03 21:56 UTC, Rob Clark
none Details | Review

Description Rob Clark 2012-01-03 21:55:40 UTC
in most cases would amount to the same thing, but all the same there is no reason to force a copy

patch attached
Comment 1 Rob Clark 2012-01-03 21:56:00 UTC
Created attachment 204529 [details] [review]
dvdspu: use refcnting instead of explicit copy
Comment 2 Tim-Philipp Müller 2012-05-21 11:36:43 UTC
The comment makes me think this is intentional:

       /* Take a copy in case we hit a still frame and need the pristine 
        * frame around */
-      copy = gst_buffer_copy (buf);
+      copy = gst_buffer_ref (buf);
Comment 3 Rob Clark 2012-05-21 12:00:50 UTC
yeah, I saw that comment too..  but was unsure about the scenario where this would need to be a copy.

I think maybe to avoid buffer exhaustion in case of a vsink element that can only allocate a fixed number of buffers.  And even in that case the vsink should fall back to malloc'd buffers and dropping frames or doing a copy internally.

So I still think it is better to use refcnt'ing.  And if using a copy is a workaround for some specific video sink, then that should be fixed separately in the video sink.
Comment 4 Jan Schmidt 2012-09-30 10:50:40 UTC
I think I made it take a copy rather than store a reference to the sink allocated buffer when dvdspu is about to draw an overlay. Storing a ref, just makes it do a copy in gst_buffer_make_writable, which would then make the downstream buffer be a normal memory buffer, and force a copy in the sink in the common case. This way, the copy in the sink happens in the uncommon case of duplicating a reference frame for a DVD still sequence.

In the case of no dvdspu overlay, it just pushes the buffer downstream and stores a ref rather than a copy.

Another fix might be to actually make dvdspu allocate downstream when it needs to dup a frame for writability.
Comment 5 Jan Schmidt 2012-09-30 12:15:37 UTC
I think I also thought at one point about making the render functions do the dup'ing as they go if necessary: They can dup across several lines of the frame into the destination buffer, then render the overlay onto them which saves some cache thrashing.
Comment 6 Tim-Philipp Müller 2015-06-21 16:49:32 UTC
Jan, any more thoughts on this? WONTFIX?
Comment 7 Jan Schmidt 2015-06-23 13:14:46 UTC
One way or another, when directly drawing an subpicture onto the frame, taking a copy is unavoidable - might as well make it explicit.

When deferring rendering downstream with a GstVideoOverlayCompositionMeta, it could just take the ref, but we haven't merged that.