GNOME Bugzilla – Bug 795145
appsink: Reuse sample object in pull_sample if possible
Last modified: 2018-04-19 14:21:38 UTC
See commit message
Created attachment 370760 [details] [review] appsink: Reuse sample object in pull_sample if possible Simple optimization to reduce memory allocations.
Review of attachment 370760 [details] [review]: ::: gst-libs/gst/app/gstappsink.c @@ +824,3 @@ + } + priv->sample = + gst_sample_new (NULL, priv->last_caps, &priv->last_segment, NULL); See my comment on the other bug, we could easily also update the segment, caps, etc. While this does not make much of a difference, it would make the code here more consistent and does not really complicate anything... while it makes the GstSample API more consistent (why would you be able to only change the buffer but not e.g. the segment?)
Created attachment 370816 [details] [review] appsink: Reuse sample object in pull_sample if possible Simple optimization to reduce memory allocations.
Thanks, I was hesitant to add all that API for no particular reason FWIW, appsink's code is cleaner that way indeed.
Review of attachment 370816 [details] [review]: ::: gst-libs/gst/app/gstappsink.c @@ +812,3 @@ GST_DEBUG_OBJECT (appsink, "activating caps %" GST_PTR_FORMAT, caps); gst_caps_replace (&priv->last_caps, caps); + gst_sample_set_caps (priv->sample, priv->last_caps); Why would the sample be writable here and below?
Created attachment 370822 [details] [review] appsink: Reuse sample object in pull_sample if possible Simple optimization to reduce memory allocations.
Review of attachment 370822 [details] [review]: ::: gst-libs/gst/app/gstappsink.c @@ +812,3 @@ GST_DEBUG_OBJECT (appsink, "activating caps %" GST_PTR_FORMAT, caps); gst_caps_replace (&priv->last_caps, caps); + gst_sample_set_caps (priv->sample, priv->last_caps); Why would the sample always be writable here and for the segment event?
(In reply to Sebastian Dröge (slomo) from comment #7) > Why would the sample always be writable here and for the segment event? Because that's a mistake, updating, thanks
Created attachment 370859 [details] [review] appsink: Reuse sample object in pull_sample if possible Simple optimization to reduce memory allocations.
Let's get this in then? :)
Attachment 370859 [details] pushed as d00e0b6 - appsink: Reuse sample object in pull_sample if possible