From 8040778a3535672ee1abf24b79c92123f3934633 Mon Sep 17 00:00:00 2001 From: Wook Song Date: Mon, 25 Sep 2023 16:27:17 +0900 Subject: [PATCH] DataRepo/Src: Get the framerate only if the data have it This patch fixes the bug that tries to get the 'framerate' value from the caps of any data source. Note that there is no 'framerate' field in GstAudioInfo. Signed-off-by: Wook Song --- gst/datarepo/gstdatareposrc.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gst/datarepo/gstdatareposrc.c b/gst/datarepo/gstdatareposrc.c index 282abc8..52582b4 100644 --- a/gst/datarepo/gstdatareposrc.c +++ b/gst/datarepo/gstdatareposrc.c @@ -1422,9 +1422,12 @@ gst_data_repo_src_get_data_type_and_size (GstDataRepoSrc * src, GstCaps * caps) break; } - v = gst_structure_get_value (s, "framerate"); - src->rate_n = gst_value_get_fraction_numerator (v); - src->rate_d = gst_value_get_fraction_denominator (v); + src->rate_n = 0; + src->rate_d = 1; + if (gst_structure_has_field (s, "framerate")) { + gst_structure_get_fraction (s, "framerate", &src->rate_n, &src->rate_d); + } + GST_LOG_OBJECT (src, "framerate %d/%d", src->rate_n, src->rate_d); GST_LOG_OBJECT (src, "data type: %d", src->data_type); -- 2.7.4