When jitter buffer thread is being restarted, currently used frames are discarded. This was done by simply setting oldestFrame, newestFrame and currentWriteFrame members to NULL. Used frames were not returned to the free list, and thus those frames were lost along with memory used for them. The worst case is when all frames were being used, and after restart there were none left for jitter buffer to work with.
This patch returns used frames to the free list before restarting the jitter buffer thread.