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: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/705>
This commit is contained in:
Thibault Saunier 2020-06-15 13:22:38 -04:00
parent b813c40788
commit 75065ab244

View file

@ -1029,10 +1029,12 @@ gst_video_test_src_query (GstBaseSrc * bsrc, GstQuery * query)
gint64 dur; gint64 dur;
GST_OBJECT_LOCK (src); GST_OBJECT_LOCK (src);
dur = gst_util_uint64_scale_int_round (bsrc->num_buffers if (src->info.fps_n) {
* GST_SECOND, src->info.fps_d, src->info.fps_n); dur = gst_util_uint64_scale_int_round (bsrc->num_buffers
res = TRUE; * GST_SECOND, src->info.fps_d, src->info.fps_n);
gst_query_set_duration (query, GST_FORMAT_TIME, dur); res = TRUE;
gst_query_set_duration (query, GST_FORMAT_TIME, dur);
}
GST_OBJECT_UNLOCK (src); GST_OBJECT_UNLOCK (src);
goto done; goto done;
} }