1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-24 13:56:33 +02:00

lavd/v4l2: fix bug in init_convert_timestamp()

The current code returned a period=0, resulting in identical pts for all frames
after time-filtering. This is because AV_TIME_BASE_Q={1, AV_TIME_BASE} and
not {AV_TIME_BASE, 1}. With this patch the correct period in microseconds is computed.
This commit is contained in:
Giorgio Vazzana 2013-03-11 16:39:52 +01:00 committed by Nicolas George
parent 7093b7534f
commit ee4a658695

View File

@ -527,8 +527,8 @@ static int init_convert_timestamp(AVFormatContext *ctx, int64_t ts)
now = av_gettime_monotonic();
if (s->ts_mode == V4L_TS_MONO2ABS ||
(ts <= now + 1 * AV_TIME_BASE && ts >= now - 10 * AV_TIME_BASE)) {
int64_t period = av_rescale_q(1, AV_TIME_BASE_Q,
ctx->streams[0]->avg_frame_rate);
AVRational tb = {AV_TIME_BASE, 1};
int64_t period = av_rescale_q(1, tb, ctx->streams[0]->avg_frame_rate);
av_log(ctx, AV_LOG_INFO, "Detected monotonic timestamps, converting\n");
/* microseconds instead of seconds, MHz instead of Hz */
s->timefilter = ff_timefilter_new(1, period, 1.0E-6);