1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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>
This commit is contained in:
Michael Niedermayer 2014-02-02 00:10:43 +01:00
parent 392b0345d6
commit 4aa4533ee8

View File

@ -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");
} }
} }
if (tpf->denominator > 0 && tpf->numerator > 0) {
s1->streams[0]->avg_frame_rate.num = tpf->denominator; s1->streams[0]->avg_frame_rate.num = tpf->denominator;
s1->streams[0]->avg_frame_rate.den = tpf->numerator; s1->streams[0]->avg_frame_rate.den = tpf->numerator;
s1->streams[0]->r_frame_rate = s1->streams[0]->avg_frame_rate; 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;
} }