From a3cdb005d5015c650e9406550b5b661241eff8bc Mon Sep 17 00:00:00 2001 From: Jeongmo Yang Date: Tue, 26 Sep 2023 18:46:12 +0900 Subject: [PATCH] v4l2videoenc: Set max level to avoid encoding failure - The encoding level list is arranged in ascending order, and the minimum level is used if level is not described in src(output) caps of encoder element. It causes encoding failure by resolution and fps limit of the level. [Version] 1.22.0-35 [Issue Type] Improvement Change-Id: Ifd1c2716ce2fb0aa5871162597ae23e49b26ec91 Signed-off-by: Jeongmo Yang --- packaging/gstreamer.spec | 2 +- subprojects/gst-plugins-good/meson.build | 1 + subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c | 13 +++++++++++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/packaging/gstreamer.spec b/packaging/gstreamer.spec index c6b4e10..f0e875e 100644 --- a/packaging/gstreamer.spec +++ b/packaging/gstreamer.spec @@ -62,7 +62,7 @@ Name: %{_name} Version: 1.22.0 -Release: 34 +Release: 35 Summary: Streaming-Media Framework Runtime License: LGPL-2.0+ Group: Multimedia/Framework diff --git a/subprojects/gst-plugins-good/meson.build b/subprojects/gst-plugins-good/meson.build index f17df1e..42cf306 100644 --- a/subprojects/gst-plugins-good/meson.build +++ b/subprojects/gst-plugins-good/meson.build @@ -471,6 +471,7 @@ cdata.set('TIZEN_FEATURE_V4L2_DISABLE_COLORIMETRY', true) cdata.set('TIZEN_FEATURE_POST_VARIANT_INFO', true) cdata.set('TIZEN_FEATURE_ADAPTIVE_VARIANT_LIMIT', true) cdata.set('TIZEN_FEATURE_BUG_FIX', true) +cdata.set('TIZEN_FEATURE_V4L2_ENCODER_SET_MAX_LEVEL', true) if get_option('tv-profile') cdata.set('TIZEN_PROFILE_TV', true) diff --git a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c index 2fb4660..d9f34e2 100644 --- a/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c +++ b/subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c @@ -473,6 +473,9 @@ negotiate_profile_and_level (GstCapsFeatures * features, GstStructure * s, if (!failed && codec->level_cid && get_string_list (s, "level", &levels)) { GList *l; +#ifdef TIZEN_FEATURE_V4L2_ENCODER_SET_MAX_LEVEL + gint max_level = -1; +#endif for (l = levels.head; l; l = l->next) { struct v4l2_control control = { 0, }; @@ -495,6 +498,15 @@ negotiate_profile_and_level (GstCapsFeatures * features, GstStructure * s, level = codec->level_to_string (control.value); +#ifdef TIZEN_FEATURE_V4L2_ENCODER_SET_MAX_LEVEL + if (v4l2_level > max_level && + (control.value == v4l2_level || + g_list_find_custom (l, level, g_str_equal))) { + ctx->level = level; + max_level = v4l2_level; + GST_WARNING_OBJECT (ctx->self, "max level -> %d", max_level); + } +#else if (control.value == v4l2_level) { ctx->level = level; break; @@ -504,6 +516,7 @@ negotiate_profile_and_level (GstCapsFeatures * features, GstStructure * s, ctx->level = level; break; } +#endif } if (levels.length && !ctx->level) -- 2.7.4