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 749729 - gstsample: add a method to set buffer metadata
gstsample: add a method to set buffer metadata
Status: RESOLVED OBSOLETE
Product: GStreamer
Classification: Platform
Component: gstreamer (core)
git master
Other Linux
: Normal enhancement
: NONE
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-05-22 13:01 UTC by Nicola
Modified: 2015-06-12 08:38 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
proof of concept patch (1.70 KB, patch)
2015-05-22 13:01 UTC, Nicola
reviewed Details | Review

Description Nicola 2015-05-22 13:01:04 UTC
Created attachment 303818 [details] [review]
proof of concept patch

actually if you want to modify a buffer in a gst_sample you have to do something like this:

GstBuffer *buf = gst_sample_get_buffer(sample);
buf = gst_buffer_make_writable(buf);
....
modify buffer, for example pts or dts
....

GstSample *new_sample = gst_sample_new(buf,gst_sample_get_caps(sample),NULL,NULL);
gst_sample_unref(sample);

and if the buffer was not originally writable you have to unref the buffer too.

The new sample creation kill my app performance. 

Attached is a proof of concept patch, I think would be really useful a way to modify a buffer contained in a sample without the need to create a new sample, what do you think about?
Comment 1 Tim-Philipp Müller 2015-06-12 08:17:27 UTC
Comment on attachment 303818 [details] [review]
proof of concept patch

I don't know, this function is very specific, sooner or later people will want more things.

Perhaps we could implement a make_writable() for GstSample that makes sure the contents are writable as well, or add a _get_writable_buffer() (but then the sample itself needs to be writable too).

This is really something that kills your app performance? How many buffers do you push around per second?
Comment 2 Nicola 2015-06-12 08:25:22 UTC
(In reply to Tim-Philipp Müller from comment #1)
> Comment on attachment 303818 [details] [review] [review]
> proof of concept patch
> 
> I don't know, this function is very specific, sooner or later people will
> want more things.
> 
> Perhaps we could implement a make_writable() for GstSample that makes sure
> the contents are writable as well, or add a _get_writable_buffer() (but then
> the sample itself needs to be writable too).
> 
> This is really something that kills your app performance? How many buffers
> do you push around per second?
 
I push as many buffers I can read from disk, making sample writable ecc.. make my app about 10% slower when I work with files with many small buffers, however I don't need this patch anymore, I used an alternative approach in my app
Comment 3 Tim-Philipp Müller 2015-06-12 08:38:49 UTC
Alright, let's close it then, thanks.