videorate: Correct segment-based calculations
It was adding and subtracting the segment base here and there, but it was also doing so incorrectly, leading to various calculation errors.
Fixed a few bugs uncovered, related to getting a new segment:
- If we reset base_ts/next_ts/out_frame_count, also reset prevbuf
- Only do so if the new segment is different than the previous one
Also replaced a few occurrences of GST_BUFFER_TIMESTAMP with GST_BUFFER_PTS for consistency.
Integrated the tests of !2186 (closed) , now passing. The test_segment_update_same test had to be fixed, because it was wrongly assuming that we would not fill the gap inside the new-but-same segment.