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 4aa4533ee8)

Conflicts:

	libavdevice/v4l2.c
This commit is contained in:
Michael Niedermayer
2014-02-02 00:10:43 +01:00
parent 1997487f67
commit c6a4083c29

View File

@@ -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;
}