Improved frame rate for AV record scenarios
Improved frame rate for AV record scenarios

Add a memcpy() to improve performance.  (And I bet you never expected to see "add a memcpy()" and "improve performance" in the same sentence.  But let me explain..)  In case of a pipeline like:

   audio-src --> audio-enc --> queue -\
                                      |
                                      v
                                     mux --> sink
                                      ^
                                      |
   video-src --> video-enc --> queue -/

a queue is used on the audio and video paths to decouple those parts of the pipeline from the mux.  Otherwise capturing audio and video frames would be coupled.  The problem is, depending on thread scheduling, the number of video buffers in the queue can be more than four (the default that is used with OMX video encoder).. and even more than 10 (which anyways seems like a not very stable configuration).  But if we use GstGooBuffer, which holds a reference to the OMX buffer, and releases it back to the video encoder (OMX_FillThisBuffer()) when the GstGooBuffer is finalized, the video encoder starves because it runs out of output buffers in which to place encoded data.  And this, in turn, causes the camera to be starved.  And the frame rate drops.

Since we aren't CPU bound in this scenario, it works out to be faster to memcpy() to a normal GstBuffer, and OMX_FillThisBuffer() immediately.

Dynamically allocating a new buffer and swapping it with pBuffer could give us a way to OMX_FillThisBuffer() immediately, without incurring the cost of an extra memcpy().  This still needs to be studied, as the OMX components have some constraints about how the buffers are allocated, so a naive malloc() will most likely cause problems.

mrchapp/gst-goo,mrchapp/gst-goo