it's under libs/me/ of gst-fsl-plugins package. It's a really simple algorithm.
I'm not look at ffmpeg code, but I think there should be some algorithm in that too for timestamp.
Are you use some multimedia framework? like Freescale provide gstreamer plugins which can handle AV sync.
Currently VPU gstreamer plugins provided by Freescale handle the timestamp with some simple algorithm. The precondition is we get PTS for a frame based, and the plugin will hold a pool to hold the timestamp it received and get timestamp from the pool when a decompressed frame output, And there's some algorithm to reorder the timestamp or correct it since some of them are illegal values.