summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2021-05-28 17:36:15 -0400
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-08-09 20:17:54 +0000
commite4c82f450da7ecae1772786d156ddf21aaea1fd2 (patch)
tree721071588cbd3291143e5b8f67241d3684279afc /ext
parentc5fda68403b74911d0b2e2ab2b1e58c52ab3dad7 (diff)
downloadgstreamer-plugins-bad-e4c82f450da7ecae1772786d156ddf21aaea1fd2.tar.gz
openh264: Respect level set downstream
We were not specifying the requested level to openh264 meaning that it was choosing anything and was not respecting what was specified\ downstream Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2289>
Diffstat (limited to 'ext')
-rw-r--r--ext/openh264/gstopenh264enc.cpp15
-rw-r--r--ext/openh264/meson.build2
2 files changed, 16 insertions, 1 deletions
diff --git a/ext/openh264/gstopenh264enc.cpp b/ext/openh264/gstopenh264enc.cpp
index dff3db6dd..b8b80c491 100644
--- a/ext/openh264/gstopenh264enc.cpp
+++ b/ext/openh264/gstopenh264enc.cpp
@@ -30,6 +30,7 @@
#include "gstopenh264elements.h"
#include "gstopenh264enc.h"
+#include <gst/pbutils/pbutils.h>
#include <gst/gst.h>
#include <gst/base/base.h>
#include <gst/video/video.h>
@@ -684,6 +685,19 @@ gst_openh264enc_stop (GstVideoEncoder * encoder)
return TRUE;
}
+static guint8
+gst_openh264enc_get_level_from_caps (GstCaps *outcaps, GstCaps *allowed_caps)
+{
+ GstStructure *s = gst_caps_get_structure (outcaps, 0);
+ const gchar * level = gst_structure_get_string (gst_caps_get_structure (allowed_caps, 0), "level");
+
+ if (!level)
+ return LEVEL_UNKNOWN;
+
+ gst_structure_set (s, "level", G_TYPE_STRING, level, NULL);
+ return gst_codec_utils_h264_get_level_idc (level);
+}
+
static EProfileIdc
gst_openh264enc_get_profile_from_caps (GstCaps *outcaps, GstCaps *allowed_caps)
{
@@ -790,6 +804,7 @@ gst_openh264enc_set_format (GstVideoEncoder * encoder,
enc_params.fMaxFrameRate = fps_n * 1.0 / fps_d;
enc_params.iLoopFilterDisableIdc = openh264enc->deblocking_mode;
enc_params.sSpatialLayers[0].uiProfileIdc = gst_openh264enc_get_profile_from_caps (outcaps, allowed_caps);
+ enc_params.sSpatialLayers[0].uiLevelIdc = (ELevelIdc) gst_openh264enc_get_level_from_caps (outcaps, allowed_caps);
enc_params.sSpatialLayers[0].iVideoWidth = enc_params.iPicWidth;
enc_params.sSpatialLayers[0].iVideoHeight = enc_params.iPicHeight;
enc_params.sSpatialLayers[0].fFrameRate = fps_n * 1.0 / fps_d;
diff --git a/ext/openh264/meson.build b/ext/openh264/meson.build
index 6147f9e3d..90005de67 100644
--- a/ext/openh264/meson.build
+++ b/ext/openh264/meson.build
@@ -15,7 +15,7 @@ if openh264_dep.found()
c_args : gst_plugins_bad_args,
link_args : noseh_link_args,
include_directories : [configinc],
- dependencies : [gstvideo_dep, openh264_dep],
+ dependencies : [gstvideo_dep, openh264_dep, gstpbutils_dep, ],
install : true,
install_dir : plugins_install_dir,
)