Making sure disabling accelerated hardware acceleration on codec

decoding discards the corresponding gstreamer decoders.
This commit is contained in:
brunoherbelin
2021-01-18 18:30:16 +01:00
parent 7c555465b8
commit 9449936df0
3 changed files with 4 additions and 4 deletions

View File

@@ -137,7 +137,7 @@ string GstToolkit::gst_version()
// see https://developer.ridgerun.com/wiki/index.php?title=GStreamer_modify_the_elements_rank // see https://developer.ridgerun.com/wiki/index.php?title=GStreamer_modify_the_elements_rank
std::list<std::string> GstToolkit::enable_gpu_decoding_plugins() std::list<std::string> GstToolkit::enable_gpu_decoding_plugins(bool enable)
{ {
static list<string> pluginslist; static list<string> pluginslist;
static GstRegistry* plugins_register = nullptr; static GstRegistry* plugins_register = nullptr;
@@ -162,7 +162,7 @@ std::list<std::string> GstToolkit::enable_gpu_decoding_plugins()
GstPluginFeature* feature = gst_registry_lookup_feature(plugins_register, plugins[i]); GstPluginFeature* feature = gst_registry_lookup_feature(plugins_register, plugins[i]);
if(feature != NULL) { if(feature != NULL) {
pluginslist.push_front( string( plugins[i] ) ); pluginslist.push_front( string( plugins[i] ) );
gst_plugin_feature_set_rank(feature, GST_RANK_PRIMARY + 1); gst_plugin_feature_set_rank(feature, enable ? GST_RANK_PRIMARY + 1 : GST_RANK_MARGINAL);
gst_object_unref(feature); gst_object_unref(feature);
} }
} }

View File

@@ -21,7 +21,7 @@ std::string filename_to_uri(std::string filename);
std::string gst_version(); std::string gst_version();
std::list<std::string> all_plugins(); std::list<std::string> all_plugins();
std::list<std::string> enable_gpu_decoding_plugins(); std::list<std::string> enable_gpu_decoding_plugins(bool enable = true);
std::list<std::string> all_plugin_features(std::string pluginname); std::list<std::string> all_plugin_features(std::string pluginname);
bool enable_feature (std::string name, bool enable); bool enable_feature (std::string name, bool enable);

View File

@@ -158,8 +158,8 @@ bool Rendering::init()
gst_init (NULL, NULL); gst_init (NULL, NULL);
// increase selection rank for GPU decoding plugins // increase selection rank for GPU decoding plugins
std::list<std::string> gpuplugins = GstToolkit::enable_gpu_decoding_plugins(Settings::application.render.gpu_decoding);
if (Settings::application.render.gpu_decoding) { if (Settings::application.render.gpu_decoding) {
std::list<std::string> gpuplugins = GstToolkit::enable_gpu_decoding_plugins();
if (gpuplugins.size() > 0) { if (gpuplugins.size() > 0) {
Log::Info("Video decoding favoring the following GPU decoding plugin(s):"); Log::Info("Video decoding favoring the following GPU decoding plugin(s):");
for(auto it = gpuplugins.begin(); it != gpuplugins.end(); it++) for(auto it = gpuplugins.begin(); it != gpuplugins.end(); it++)