Ensures we don't read keyFrames[-1] when trying to seek before the first keyFrame. Note that our function returns the last keyframe whose pts is <= to the desired pts. And it returns -1 if no such keyframe is found.
We also use a single function to convert seconds to pts. Here we do a call to std::round() to ensure that we go back to int64 as faithfully as possible. Previously we were truncating and that could lead to off-by-one errors.
This fixes #307 (in particular, (1) fixes that)
I added a test for (1) but adding a test for (2) requires a lot of precise video editing that I haven't done.
This PR does:
std::round()
to ensure that we go back to int64 as faithfully as possible. Previously we were truncating and that could lead to off-by-one errors.This fixes #307 (in particular, (1) fixes that)
I added a test for (1) but adding a test for (2) requires a lot of precise video editing that I haven't done.