basevideoenc: do not try to calculate latency from an unknown framerate

It'll divide by zero, and latency is unknown for an unknown framerate.

Fixes an assert in the schroenc test.

https://bugzilla.gnome.org/show_bug.cgi?id=657419
This commit is contained in:
Vincent Penquerc'h 2011-08-26 10:50:38 +01:00 committed by Sebastian Dröge
parent 473e71e1ca
commit 8a044de701

View file

@ -1025,6 +1025,10 @@ gst_base_video_encoder_set_latency_fields (GstBaseVideoEncoder *
{
gint64 latency;
/* 0 numerator is used for "don't know" */
if (GST_BASE_VIDEO_CODEC (base_video_encoder)->state.fps_n == 0)
return;
latency = gst_util_uint64_scale (n_fields,
GST_BASE_VIDEO_CODEC (base_video_encoder)->state.fps_d * GST_SECOND,
2 * GST_BASE_VIDEO_CODEC (base_video_encoder)->state.fps_n);