diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-02-02 00:10:43 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-03-07 04:04:07 +0100 |
commit | c6a4083c29e00f769b770964016f694f55c1560c (patch) | |
tree | c062cf28b47cad4e5a94751f23f605cab03ec589 | |
parent | 1997487f67ec486546b6cd21f38546e8ca042cb8 (diff) | |
download | ffmpeg-c6a4083c29e00f769b770964016f694f55c1560c.tar.gz |
avdevice/v4l2: only use frame period from v4l2 if valid
There is evidence that some drivers do not set a valid value
See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718805
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4aa4533ee8b51a1e6bdc4fbffaf90aa2b14e2c9f)
Conflicts:
libavdevice/v4l2.c
-rw-r--r-- | libavdevice/v4l2.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 88cacd9545..00686a490d 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -735,8 +735,11 @@ static int v4l2_set_parameters(AVFormatContext *s1) return AVERROR(errno); } } - s1->streams[0]->codec->time_base.den = tpf->denominator; - s1->streams[0]->codec->time_base.num = tpf->numerator; + if (tpf->denominator > 0 && tpf->numerator > 0) { + s1->streams[0]->codec->time_base.den = tpf->denominator; + s1->streams[0]->codec->time_base.num = tpf->numerator; + } else + av_log(s1, AV_LOG_WARNING, "Time per frame unknown\n"); return 0; } |