GNOME Bugzilla – Bug 702617
buffer: Wrong size/index handling when merging memory
Last modified: 2013-07-05 18:37:37 UTC
Created attachment 247230 [details] [review] Patch As explain in the title, it seems the size field and the condition to leave the for loop in _get_merged_memory of gstbuffer.c are wrong. I noticed this with a custom element which was parsing the RTP buffers after rtph264pay element. rtph264pay or another element before might store the payload in more than one blocksize and when retrieving the payload in my element with gst_rtp_buffer_get_payload(), it merges internally the memory blocks containing the payload if necessary. When the payload was stored in more than one block size, it was leading to get a buffer bigger of RTP header length size than before and messing up my data inside. In the patch provided in attachment, I applied the following changes: - Set the size of the buffer containing the merged memory of the size of the memory blocks to be merged (and not the size of the full buffer) - Change the condition to leave the for loop from (i < length) to (i < idx+length) to handle cases where i > 0.
commit 4fc1ba1e603a9bb1522cf97a6466dbbc1673c9e9 Author: Sebastian Dröge <slomo@circular-chaos.org> Date: Wed Jun 19 10:45:45 2013 +0200 buffer: Add unit test for map_range() https://bugzilla.gnome.org/show_bug.cgi?id=702617 commit db800445138425bb00b8cbf2ca601f9f7e15ac7e Author: Paul HENRYS <visechelle@gmail.com> Date: Wed Jun 19 08:36:22 2013 +0200 buffer: Fix wrong size/index handling when merging memory https://bugzilla.gnome.org/show_bug.cgi?id=702617
cherry-picked this into 1.0 as well.