v4l2videoenc: Set max level to avoid encoding failure 62/299362/3 accepted/tizen/unified/20231005.030720
authorJeongmo Yang <jm80.yang@samsung.com>
Tue, 26 Sep 2023 09:46:12 +0000 (18:46 +0900)
committerJeongmo Yang <jm80.yang@samsung.com>
Tue, 26 Sep 2023 11:24:55 +0000 (20:24 +0900)
- 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 <jm80.yang@samsung.com>
packaging/gstreamer.spec
subprojects/gst-plugins-good/meson.build
subprojects/gst-plugins-good/sys/v4l2/gstv4l2videoenc.c

index c6b4e10..f0e875e 100644 (file)
@@ -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
index f17df1e..42cf306 100644 (file)
@@ -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)
index 2fb4660..d9f34e2 100644 (file)
@@ -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)