From bed17ec07d1972a9081b70327d0bf096eadeff74 Mon Sep 17 00:00:00 2001 From: brunoherbelin Date: Wed, 24 Dec 2025 22:11:08 +0100 Subject: [PATCH] Enable GPU decoding support if GL upload and color conversion features are available. --- src/Recorder.cpp | 2 ++ src/Streamer.cpp | 16 +++++++++++----- src/VideoBroadcast.cpp | 6 ++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/src/Recorder.cpp b/src/Recorder.cpp index 6fff0aa..692fcd1 100644 --- a/src/Recorder.cpp +++ b/src/Recorder.cpp @@ -334,6 +334,8 @@ std::string VideoRecorder::init(GstCaps *caps) // This uploads system memory to GPU and does color conversion in GPU shader if (Settings::application.render.gpu_decoding && (int) hardware_encoder.size() > 0 && + GstToolkit::has_feature("glupload") && + GstToolkit::has_feature("glcolorconvert") && GstToolkit::has_feature(hardware_encoder[Settings::application.record.profile])) { // glupload: system memory → GLMemory (in GStreamer's thread) // glcolorconvert: GPU color conversion (RGBA → NV12 for VAAPI, passthrough for NVIDIA) diff --git a/src/Streamer.cpp b/src/Streamer.cpp index 0ec22a1..4c59b60 100644 --- a/src/Streamer.cpp +++ b/src/Streamer.cpp @@ -400,12 +400,18 @@ std::string VideoStreamer::init(GstCaps *caps) config != NetworkToolkit::stream_h264_send_pipeline.cend() && !found_harware_acceleration; ++config) { if ( GstToolkit::has_feature(config->first) ) { #ifdef USE_GST_OPENGL_SYNC_HANDLER - description += "glupload ! glcolorconvert ! "; - Log::Info("Video Streamer with glupload & GPU color conversion"); + if ( GstToolkit::has_feature("glupload") && + GstToolkit::has_feature("glcolorconvert") ) { + description += "glupload ! glcolorconvert ! "; + Log::Info("Video Streamer with glupload & GPU color conversion"); + } + else #endif - description += config->second; - found_harware_acceleration = true; - Log::Info("Video Streamer using hardware accelerated encoder (%s)", config->first.c_str()); + { + description += config->second; + found_harware_acceleration = true; + Log::Info("Video Streamer using hardware accelerated encoder (%s)", config->first.c_str()); + } } } } diff --git a/src/VideoBroadcast.cpp b/src/VideoBroadcast.cpp index d171f6f..d487498 100644 --- a/src/VideoBroadcast.cpp +++ b/src/VideoBroadcast.cpp @@ -70,9 +70,11 @@ bool VideoBroadcast::available() if (!srt_sink_.empty()) { - if (Settings::application.render.gpu_decoding) { + if (Settings::application.render.gpu_decoding && + GstToolkit::has_feature("glupload") && + GstToolkit::has_feature("glcolorconvert")) { for (auto config = srt_encoder_alternatives_.cbegin(); - config != srt_encoder_alternatives_.cend() && srt_encoder_.empty(); ++config) { + config != srt_encoder_alternatives_.cend() && srt_encoder_.empty(); ++config) { if ( GstToolkit::has_feature(config->first) ) { srt_encoder_ = config->second; if (config->first != srt_encoder_alternatives_.back().first)