nvh264enc: add constrained-baseline to the caps profiles
authorMathieu Duponchelle <mathieu@centricular.com>
Wed, 20 Oct 2021 12:34:42 +0000 (14:34 +0200)
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>
Thu, 21 Oct 2021 09:06:08 +0000 (09:06 +0000)
In practice, when baseline is requested from the encoder it
produces constrained baseline, and it is already reflected
in the profile-iop flags.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1213>

subprojects/gst-plugins-bad/docs/plugins/gst_plugins_cache.json
subprojects/gst-plugins-bad/sys/nvcodec/gstnvenc.c
subprojects/gst-plugins-bad/sys/nvcodec/gstnvh264enc.c

index 8ec3b7d..0283967 100644 (file)
                         "presence": "always"
                     },
                     "src": {
-                        "caps": "video/x-h264:\n          width: [ 145, 4096 ]\n         height: [ 49, 4096 ]\n      framerate: [ 0/1, 2147483647/1 ]\n  stream-format: byte-stream\n      alignment: au\n        profile: { (string)main, (string)high, (string)high-4:4:4, (string)baseline }\n",
+                        "caps": "video/x-h264:\n          width: [ 145, 4096 ]\n         height: [ 49, 4096 ]\n      framerate: [ 0/1, 2147483647/1 ]\n  stream-format: byte-stream\n      alignment: au\n        profile: { (string)main, (string)high, (string)high-4:4:4, (string)baseline, (string)constrained-baseline }\n",
                         "direction": "src",
                         "presence": "always"
                     }
index 4218369..1963767 100644 (file)
@@ -514,6 +514,9 @@ gst_nvenc_get_supported_codec_profiles (gpointer enc, GUID codec_id)
     /* put baseline to last since it does not support bframe */
     {"baseline", NV_ENC_H264_PROFILE_BASELINE_GUID, NV_ENC_CODEC_H264_GUID,
         FALSE, FALSE, FALSE},
+    {"constrained-baseline", NV_ENC_H264_PROFILE_BASELINE_GUID,
+          NV_ENC_CODEC_H264_GUID,
+        FALSE, FALSE, FALSE},
     /* hevc profiles */
     {"main", NV_ENC_HEVC_PROFILE_MAIN_GUID, NV_ENC_CODEC_HEVC_GUID, FALSE,
         FALSE, FALSE},
index 3c74c87..4e436d8 100644 (file)
@@ -79,7 +79,7 @@ enum
     "framerate = " GST_VIDEO_FPS_RANGE ", " \
     "stream-format = (string) byte-stream, " \
     "alignment = (string) au, " \
-    "profile = (string) { main, high, high-4:4:4, baseline }"
+    "profile = (string) { main, high, high-4:4:4, baseline, constrained-baseline }"
 
 static gboolean gst_nv_h264_enc_open (GstVideoEncoder * enc);
 static gboolean gst_nv_h264_enc_close (GstVideoEncoder * enc);
@@ -474,7 +474,8 @@ gst_nv_h264_enc_set_encoder_config (GstNvBaseEnc * nvenc,
 
     profile = gst_structure_get_string (s, "profile");
     if (profile) {
-      if (!strcmp (profile, "baseline")) {
+      if (!strcmp (profile, "baseline")
+          || !strcmp (profile, "constrained-baseline")) {
         selected_profile = NV_ENC_H264_PROFILE_BASELINE_GUID;
       } else if (g_str_has_prefix (profile, "high-4:4:4")) {
         selected_profile = NV_ENC_H264_PROFILE_HIGH_444_GUID;