audiodecoder: Timestamp and buffer tracking not threadsafe and robust
Submitted by Sebastian Dröge
audiodecoder keeps a queue of pending input buffers that is filled before calling handle_frame() and cleaned in finish_frame(). For elements that have a different streaming thread on the srcpad (gst-omx, gst-amc, probably others) this can lead to buffers being removed from the queue while the subclass is inside handle_frame() and uses them.
Also the solution to just drop all frames from the queue if -1 is passed to finish_frame() is breaking timestamp tracking if the decoder still has input queued when outputting something.