audioencoder: Timestamp and buffer tracking not threadsafe
Submitted by Sebastian Dröge
The audio decoder base class passes buffers from gst_adapter_map() to the subclass via handle_frame(), and flushes them from the adapter in finish_frame(). For elements that have a different streaming thread for the srcpad and call finish_frame() from a different thread (gst-omx, gst-amc, probably others) this means that the subclass can be in handle_frame() using the mapped data while the srcpad streaming thread is doing finish_frame() for another frame and flushing data from the adapter.
This can cause usage of freed memory in handle_frame() and most likely also breaks timestamp tracking in interesting ways.