gstbuffer: Unref memories before metas

Xavier Claessens requested to merge xclaesse/gstreamer:bufferpool into main

gst_buffer_add_parent_buffer_meta() is used when a GstBuffer uses GstMemory from another buffer that was allocated from a pool. In that case we want to make sure the buffer returns to the pool when the memory is writable again, otherwise a copy of the memory is created. That means the child buffer must drop its ref to the memory first, then drop the ref to parent buffer so it can return to the pool when it is the only owner of the memory.

Merge request reports