v4l2allocator: reference memory before the buffer is queued
v4l2allocator: reference memory before the buffer is queued

In gst_v4l2_allocator_qbuf(), the memory is referenced after the
buffer is queued. Once queued (VIDIOC_QBUF), the buffer might be handled
by the V4L2 driver (e.g. decoded) and dequeued (gst_v4l2_allocator_dqbuf),
through a different thread, before the memory is referenced (gst_memory_ref).
In this case, in gst_v4l2_allocator_dqbuf(), the memory is unreferenced
(gst_memory_unref) before having been referenced: the memory refcount
reaches 0, and the memory is freed.
So, to avoid this crossing case, in gst_v4l2_allocator_qbuf(), the
memory shall be referenced before the buffer is queued.

https://bugzilla.gnome.org/show_bug.cgi?id=777399

GrokImageCompression/gst-plugins-good,stfl/gst-plugins-good,pexip/gst-plugins-good,StreamUtils/gst-plugins-good,GStreamer/gst-plugins-good,pexip/gst-plugins-good,hizukiayaka/gst-plugins-good,GrokImageCompression/gst-plugins-good,GrokImageCompression/gst-plugins-good,hizukiayaka/gst-plugins-good,StreamUtils/gst-plugins-good,GrokImageCompression/gst-plugins-good,hizukiayaka/gst-plugins-good,pexip/gst-plugins-good,stfl/gst-plugins-good,GStreamer/gst-plugins-good,stfl/gst-plugins-good,stfl/gst-plugins-good,GStreamer/gst-plugins-good,StreamUtils/gst-plugins-good,pexip/gst-plugins-good,hizukiayaka/gst-plugins-good,GStreamer/gst-plugins-good,StreamUtils/gst-plugins-good,pexip/gst-plugins-good