diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-02-02 03:10:43 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-02-02 03:13:01 +0400 |
commit | 4aa4533ee8b51a1e6bdc4fbffaf90aa2b14e2c9f (patch) | |
tree | af7ff2bd8d3da902367354ae7a81bc6fb8e720eb | |
parent | 392b0345d6d27d1c3cac85d5b299072db1d09f5f (diff) |
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>
-rw-r--r-- | libavdevice/v4l2.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libavdevice/v4l2.c b/libavdevice/v4l2.c index 1ab6f1c03a..b4f65d388d 100644 --- a/libavdevice/v4l2.c +++ b/libavdevice/v4l2.c @@ -742,9 +742,12 @@ static int v4l2_set_parameters(AVFormatContext *s1) "The driver does not allow to change time per frame\n"); } } - s1->streams[0]->avg_frame_rate.num = tpf->denominator; - s1->streams[0]->avg_frame_rate.den = tpf->numerator; - s1->streams[0]->r_frame_rate = s1->streams[0]->avg_frame_rate; + if (tpf->denominator > 0 && tpf->numerator > 0) { + s1->streams[0]->avg_frame_rate.num = tpf->denominator; + s1->streams[0]->avg_frame_rate.den = tpf->numerator; + s1->streams[0]->r_frame_rate = s1->streams[0]->avg_frame_rate; + } else + av_log(s1, AV_LOG_WARNING, "Time per frame unknown\n"); return 0; } |