You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
During an audio live stream transcoding, after utilizing AudioResampler::pop() for approximately 12 hours, the returned AudioSamples::pts() restarted from 0(
), prompting me to test the Timestamp addition operation.
After a certain number of iterations, the results obtained from "+=" and "+" operations differ.
"+=" continues to increment, whereas "+" operations result in overflow.
#include <avcpp/timestamp.h>
#include <avcpp/audioresampler.h>
#include <stdint.h>
#include <stdio.h>
#include <unistd.h>
int main(int argc, char* argv[])
{
int64_t i = 0;
av::Timestamp t(0, av::Rational{1, 48000});
while (true) {
t = t + av::Timestamp{1024, t.timebase()};
// t += av::Timestamp{1024, t.timebase()};
if (t.seconds() < 1) {
printf("[%" PRId64 "]++++t=%0.3lf\n", i, t.seconds());
}
if (i % 1000000 == 0) {
printf("t=%0.3lf\n", t.seconds());
}
i++;
}
return 0;
}
The text was updated successfully, but these errors were encountered:
Sounds like it is feature of the FFmpeg av_add_stable() and its usage in the operator+(a,b) implementation. For the first look, av_add_stable() always expects, that right value always less than left value. In the sample above, overflow will be reduced just by chanding operands order:
t = av::Timestamp{1024, t.timebase()} + t;
Yep, t is greater then 1024/tb: for the some reason of the operator+(a,b) implementattion rhs and lhs values swapped.
During an audio live stream transcoding, after utilizing AudioResampler::pop() for approximately 12 hours, the returned AudioSamples::pts() restarted from 0(
avcpp/src/audioresampler.cpp
Line 189 in 5e167a4
After a certain number of iterations, the results obtained from "+=" and "+" operations differ.
"+=" continues to increment, whereas "+" operations result in overflow.
The text was updated successfully, but these errors were encountered: