From f5d8304724141834baf1e195d99ec32056f54d7c Mon Sep 17 00:00:00 2001 From: Nicola Murino Date: Wed, 9 Aug 2017 11:26:37 +0200 Subject: [PATCH] vtenc: assume 25 fps for unknown framerate This is better than reporting no latency at all and then later failing in live pipelines. https://bugzilla.gnome.org/show_bug.cgi?id=786036 --- sys/applemedia/vtenc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/sys/applemedia/vtenc.c b/sys/applemedia/vtenc.c index cef8f80b60..03ce865f39 100644 --- a/sys/applemedia/vtenc.c +++ b/sys/applemedia/vtenc.c @@ -1054,8 +1054,15 @@ gst_vtenc_update_latency (GstVTEnc * self) CFNumberGetValue (value, kCFNumberSInt32Type, &frames); if (self->latency_frames == -1 || self->latency_frames != frames) { self->latency_frames = frames; - frame_duration = gst_util_uint64_scale (GST_SECOND, - self->video_info.fps_d, self->video_info.fps_n); + if (self->video_info.fps_d == 0 || self->video_info.fps_n == 0) { + /* FIXME: Assume 25fps. This is better than reporting no latency at + * all and then later failing in live pipelines + */ + frame_duration = gst_util_uint64_scale (GST_SECOND, 1, 25); + } else { + frame_duration = gst_util_uint64_scale (GST_SECOND, + self->video_info.fps_d, self->video_info.fps_n); + } latency = frame_duration * frames; GST_INFO_OBJECT (self, "latency status %d frames %d fps %d/%d time %" GST_TIME_FORMAT, status,