From f7e434028d7d300660b336eb69e7dff2080dd6fe Mon Sep 17 00:00:00 2001 From: He Junyan Date: Fri, 30 Aug 2024 23:00:48 +0800 Subject: [PATCH] va: baseenc: Check the bitrate property before get its value Not all the encoders have the bitrate property, such as the jpeg enc. We need to check that property before getting its value, or the glib will print warnings. Part-of: --- subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c b/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c index 025e9811d7..258c4f22d4 100644 --- a/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c +++ b/subprojects/gst-plugins-bad/sys/va/gstvabaseenc.c @@ -1194,7 +1194,9 @@ gst_va_base_enc_add_codec_tag (GstVaBaseEnc * base, const gchar * codec_name) const gchar *encoder_name; guint bitrate = 0; - g_object_get (venc, "bitrate", &bitrate, NULL); + if (g_object_class_find_property (G_OBJECT_GET_CLASS (base), "bitrate")) + g_object_get (venc, "bitrate", &bitrate, NULL); + if (bitrate > 0) gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_NOMINAL_BITRATE, bitrate, NULL);