amfcodec: fix setting quality presets
authorAndoni Morales Alastruey <amorales@fluendo.com>
Tue, 12 Apr 2022 09:20:00 +0000 (11:20 +0200)
committerNacho Garcia <ngarcia@fluendo.com>
Tue, 12 Apr 2022 10:14:04 +0000 (12:14 +0200)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2159>

subprojects/gst-plugins-bad/sys/amfcodec/gstamfh264enc.cpp

index fbc64af..1d27513 100644 (file)
@@ -849,6 +849,16 @@ gst_amf_h264_enc_set_format (GstAmfEncoder * encoder,
     goto error;
   }
 
+  if (self->preset > AMF_VIDEO_ENCODER_QUALITY_PRESET_UNKNOWN) {
+    result = comp->SetProperty (AMF_VIDEO_ENCODER_QUALITY_PRESET,
+        (amf_int64) self->preset);
+    if (result != AMF_OK) {
+      GST_ERROR_OBJECT (self, "Failed to set quality preset, result %"
+          GST_AMF_RESULT_FORMAT, GST_AMF_RESULT_ARGS (result));
+      goto error;
+    }
+  }
+
   result = comp->SetProperty (AMF_VIDEO_ENCODER_PROFILE, (amf_int64) profile);
   if (result != AMF_OK) {
     GST_ERROR_OBJECT (self, "Failed to set profile, result %"