GNOME Bugzilla – Bug 343196
basetransform not handles ro/rw buffer flagging for transform_ip in all cases
Last modified: 2006-07-05 08:16:29 UTC
two issues: (1) basetranssform class does not make sure that buffers given to transsform_ip in passthrough-mode as read-only. This us required so that elements can immediately return, if they don't do analysis of the data or the like. (2) if src and sink-caps of an element are the same gst_base_transform_prepare_output_buffer() just returns the in_buf as out_buf, but refs the in_buf. Then in_buf and out_buf are not writeable anymore.
Created attachment 66374 [details] [review] fixes both basetransform problems to test the patch add these lines to the beginning of gstvolume::volume_transform_ip /* don't process data in passthrough-mode */ if (!gst_buffer_is_writable (outbuf)) return GST_FLOW_OK; then go to gst-plugins-base/tests/check and run make elements/volume.check
Created attachment 66377 [details] [review] fixes both basetransform problems remove a g_assert()
not sure what an unwritable buffer has to do with passthrough mode. better to leave the current implementation in volume, ie, check if the plugin is in passthrough mode to decide if it should do something. It's perfectly possible and also optimal to have a writable buffer in passthrough mode as opposed to artificially make it READONLY. Second patch is ok, working on a better path (there is an unref missing).
*** Bug 340045 has been marked as a duplicate of this bug. ***
Created attachment 68302 [details] [review] reworked patch updated patch that only makes sure the buffer is still writable in transform_ip.
Created attachment 68316 [details] [review] updated patch this patch also handles the case where we receive an additional ref when the prepare_buffer vmethod is implemented by the subclass.
I've reworked my code and now happy if only the reffing gets fixed.
does the last patch not fix the refcounting?
yes, it does. I just wanted to say. That I've fixed my code to not misuse the gst_buffer_is_writable() for passthrough detection.
* libs/gst/base/gstbasetransform.c: (gst_base_transform_prepare_output_buffer), (gst_base_transform_buffer_alloc), (gst_base_transform_handle_buffer): Make sure the buffer we pass to transform_ip has a refcount of 1 and thus is writable. Fixes #343196