On Fri Nov 22 23:33:36 2024 +0000, Nikolay Sivov wrote:
I find this hard to understand. We'll need to document what's happening. For example, why does this check one more sample at all? Is that because buffer size is 2, or we always would check the adjacent one.
Basically we just want to supply the latest sample that has a PTS prior to the current presentation timestamp. So we will: - supply no samples if neither sample has a PTS prior to the current presentation timestamp; - supply the first sample if the first sample has a PTS prior to the current presentation timestamp and the 2nd sample has a PTS after the current presentation timestamp (or there is no 2nd sample); or - supply the 2nd sample (and drop the 1st) if the 2nd sample has a PTS prior to the current presentation timestamp.
I've now added a comment to the function.