GNOME Bugzilla – Bug 749729
gstsample: add a method to set buffer metadata
Last modified: 2015-06-12 08:38:49 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 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?
(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
Alright, let's close it then, thanks.