From 1050978246ce203b6f352b75499454e6a2773638 Mon Sep 17 00:00:00 2001 From: loki Date: Wed, 12 May 2021 23:22:13 +0200 Subject: [PATCH] Add warning to ignore errors during encoder validation --- sunshine/main.cpp | 2 -- sunshine/video.cpp | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/sunshine/main.cpp b/sunshine/main.cpp index 801493aa..9dc686a9 100644 --- a/sunshine/main.cpp +++ b/sunshine/main.cpp @@ -15,7 +15,6 @@ #include #include "video.h" -#include "input.h" #include "nvhttp.h" #include "rtsp.h" #include "config.h" @@ -142,7 +141,6 @@ int main(int argc, char *argv[]) { return 4; } - input::init(); reed_solomon_init(); if(video::init()) { return 2; diff --git a/sunshine/video.cpp b/sunshine/video.cpp index 54252375..3127ccbc 100644 --- a/sunshine/video.cpp +++ b/sunshine/video.cpp @@ -1146,6 +1146,11 @@ bool validate_config(std::shared_ptr &disp, const encoder_t &e bool validate_encoder(encoder_t &encoder) { std::shared_ptr disp; + BOOST_LOG(info) << "Trying encoder ["sv << encoder.name << ']'; + auto fg = util::fail_guard([&]() { + BOOST_LOG(info) << "Encoder ["sv << encoder.name << "] failed"sv; + }); + auto force_hevc = config::video.hevc_mode >= 2; auto test_hevc = force_hevc || (config::video.hevc_mode == 0 && encoder.hevc_mode); @@ -1200,10 +1205,21 @@ bool validate_encoder(encoder_t &encoder) { } } + fg.disable(); return true; } int init() { + // video depends on input for input::touch_port_event + input::init(); + + BOOST_LOG(info) << "//////////////////////////////////////////////////////////////////"sv; + BOOST_LOG(info) << "// //"sv; + BOOST_LOG(info) << "// Testing for available encoders, this may generate errors. //"sv; + BOOST_LOG(info) << "// You can safely ignore those errors. //"sv; + BOOST_LOG(info) << "// //"sv; + BOOST_LOG(info) << "//////////////////////////////////////////////////////////////////"sv; + KITTY_WHILE_LOOP(auto pos = std::begin(encoders), pos != std::end(encoders), { if( (!config::video.encoder.empty() && pos->name != config::video.encoder) || @@ -1229,6 +1245,14 @@ int init() { return -1; } + BOOST_LOG(info); + BOOST_LOG(info) << "//////////////////////////////////////////////////////////////"sv; + BOOST_LOG(info) << "// //"sv; + BOOST_LOG(info) << "// Ignore any errors mentioned above, they are not relevant //"sv; + BOOST_LOG(info) << "// //"sv; + BOOST_LOG(info) << "//////////////////////////////////////////////////////////////"sv; + BOOST_LOG(info); + auto &encoder = encoders.front(); if(encoder.hevc[encoder_t::PASSED]) { BOOST_LOG(info) << "Found encoder "sv << encoder.name << ": ["sv << encoder.h264.name << ", "sv << encoder.hevc.name << ']';