Both were entangled previously and very hard to follow what happens under which conditions. Now as a very first step the code decides which of the two cases it is going to apply, and then proceeds accordingly. This also avoids calculating completely invalid values along the way and even printing them int the debug output. Also improve debug output in various places. This shouldn't cause any behaviour changes. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/6543>