summaryrefslogtreecommitdiffstats
path: root/libavdevice/v4l2.c
diff options
context:
space:
mode:
authorGiorgio Vazzana <mywing81@gmail.com>2013-03-11 16:39:52 +0100
committerNicolas George <nicolas.george@normalesup.org>2013-03-12 17:14:47 +0100
commitee4a6586952ba0ac8309468b04631da12767cebd (patch)
tree500f306af127986734aa8c649fb939df816efaca /libavdevice/v4l2.c
parent7093b7534fd385263f678e48b7ef3177ad58da06 (diff)
downloadffmpeg-streaming-ee4a6586952ba0ac8309468b04631da12767cebd.zip
ffmpeg-streaming-ee4a6586952ba0ac8309468b04631da12767cebd.tar.gz
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.
Diffstat (limited to 'libavdevice/v4l2.c')
-rw-r--r--libavdevice/v4l2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c
index dec82b6..0c1eb85 100644
--- a/libavdevice/v4l2.c
+++ b/libavdevice/v4l2.c
@@ -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);
OpenPOWER on IntegriCloud