Commit 4aa4533e authored by Michael Niedermayer's avatar Michael Niedermayer

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=718805Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 392b0345
...@@ -742,9 +742,12 @@ static int v4l2_set_parameters(AVFormatContext *s1) ...@@ -742,9 +742,12 @@ static int v4l2_set_parameters(AVFormatContext *s1)
"The driver does not allow to change time per frame\n"); "The driver does not allow to change time per frame\n");
} }
} }
s1->streams[0]->avg_frame_rate.num = tpf->denominator; if (tpf->denominator > 0 && tpf->numerator > 0) {
s1->streams[0]->avg_frame_rate.den = tpf->numerator; s1->streams[0]->avg_frame_rate.num = tpf->denominator;
s1->streams[0]->r_frame_rate = s1->streams[0]->avg_frame_rate; 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; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment