From 75065ab2440330f8087db49c781f637f16c3527c Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Mon, 15 Jun 2020 13:22:38 -0400 Subject: [PATCH] videotestsrc: Do not try to answer the duration query before negotiation We have no idea at that moment and this code was trying to divide by 0! Part-of: --- gst/videotestsrc/gstvideotestsrc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gst/videotestsrc/gstvideotestsrc.c b/gst/videotestsrc/gstvideotestsrc.c index bca07cec23..d36850acce 100644 --- a/gst/videotestsrc/gstvideotestsrc.c +++ b/gst/videotestsrc/gstvideotestsrc.c @@ -1029,10 +1029,12 @@ gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query) gint64 dur; GST_OBJECT_LOCK (src); - dur = gst_util_uint64_scale_int_round (bsrc->num_buffers - * GST_SECOND, src->info.fps_d, src->info.fps_n); - res = TRUE; - gst_query_set_duration (query, GST_FORMAT_TIME, dur); + if (src->info.fps_n) { + dur = gst_util_uint64_scale_int_round (bsrc->num_buffers + * GST_SECOND, src->info.fps_d, src->info.fps_n); + res = TRUE; + gst_query_set_duration (query, GST_FORMAT_TIME, dur); + } GST_OBJECT_UNLOCK (src); goto done; }