Use fewer magic numbers and keep track of the different synchronization mechanisms separately. Also keep track of more state to detect more situations when resynchronization should happen. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>