Repository navigation
ip/ffmpeg: fix seeking and compiler warning about %lld - #1454
Conversation
%lld expects long long but int64_t may be long. And GCC warns about that
thecloudexpanse
left a comment
There was a problem hiding this comment.
Explicitly casting to (long long) fixes the issue, so the value will match the format specifier. Apologies for missing that. I verified that this compiles cleanly with clang.
For what it's worth, changing the format specifier back to %ld and casting the value to (long) also eliminates the original warning on clang. However, since the value is a 64-bit int, I think (long long) is probably preferred.
pgaskin
left a comment
There was a problem hiding this comment.
Seeking works fine with fewer discards required. If I'm understanding/observing it correctly, it's more of an optimization than a fix (so I'd probably recommend updating the commit message to say that). Thoughts, @ihy123?
Format string thing is fine (and it's for debug logs only anyways). The correct solution would be to use PRId64, but cmus doesn't really do that.
IMO it's what works best for compatibility.
No problem |
av_rescale() accepts int64_t, so offset was implicitly converted and rounded down to an integer number of seconds which has been causing more samples to be discarded to reach the wanted time.
About %lld
3157b78 introduced a warning about %lld on GCC. @thecloudexpanse try this PR with your compiler please
Results of the seeking fix
Before:
After: