Merge pull request #151 from bondagit/daemon-v1.6.6

Daemon v1.6.6
This commit is contained in:
Andrea Bondavalli 2024-01-21 10:39:24 +01:00 committed by GitHub
commit ac6cab0076
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 28 additions and 10 deletions

View File

@ -346,8 +346,12 @@ Config json_to_config_(std::istream& js, Config& config) {
} catch (boost::property_tree::json_parser::json_parser_error& je) { } catch (boost::property_tree::json_parser::json_parser_error& je) {
throw std::runtime_error("error parsing JSON at line " + throw std::runtime_error("error parsing JSON at line " +
std::to_string(je.line()) + " :" + je.message()); std::to_string(je.line()) + " :" + je.message());
} catch (...) { } catch (std::invalid_argument& e) {
throw std::runtime_error("failed to convert a number"); throw std::runtime_error("error parsing JSON: cannot perform number conversion");
} catch (std::out_of_range& e) {
throw std::runtime_error("error parsing JSON: number conversion out of range");
} catch (std::exception& e) {
throw std::runtime_error("error parsing JSON: " + std::string(e.what()));
} }
return config; return config;
} }
@ -412,8 +416,12 @@ StreamSource json_to_source(const std::string& id, const std::string& json) {
} catch (boost::property_tree::json_parser::json_parser_error& je) { } catch (boost::property_tree::json_parser::json_parser_error& je) {
throw std::runtime_error("error parsing JSON at line " + throw std::runtime_error("error parsing JSON at line " +
std::to_string(je.line()) + " :" + je.message()); std::to_string(je.line()) + " :" + je.message());
} catch (...) { } catch (std::invalid_argument& e) {
throw std::runtime_error("failed to convert a number"); throw std::runtime_error("error parsing JSON: cannot perform number conversion");
} catch (std::out_of_range& e) {
throw std::runtime_error("error parsing JSON: number conversion out of range");
} catch (std::exception& e) {
throw std::runtime_error("error parsing JSON: " + std::string(e.what()));
} }
return source; return source;
} }
@ -452,8 +460,12 @@ StreamSink json_to_sink(const std::string& id, const std::string& json) {
} catch (boost::property_tree::json_parser::json_parser_error& je) { } catch (boost::property_tree::json_parser::json_parser_error& je) {
throw std::runtime_error("error parsing JSON at line " + throw std::runtime_error("error parsing JSON at line " +
std::to_string(je.line()) + " :" + je.message()); std::to_string(je.line()) + " :" + je.message());
} catch (...) { } catch (std::invalid_argument& e) {
throw std::runtime_error("failed to convert a number"); throw std::runtime_error("error parsing JSON: cannot perform number conversion");
} catch (std::out_of_range& e) {
throw std::runtime_error("error parsing JSON: number conversion out of range");
} catch (std::exception& e) {
throw std::runtime_error("error parsing JSON: " + std::string(e.what()));
} }
return sink; return sink;
} }

View File

@ -39,7 +39,7 @@ namespace po = boost::program_options;
namespace postyle = boost::program_options::command_line_style; namespace postyle = boost::program_options::command_line_style;
namespace logging = boost::log; namespace logging = boost::log;
static const std::string version("bondagit-1.6.5"); static const std::string version("bondagit-1.6.6");
static std::atomic<bool> terminate = false; static std::atomic<bool> terminate = false;
void termination_handler(int signum) { void termination_handler(int signum) {

View File

@ -825,9 +825,15 @@ std::error_code SessionManager::add_sink(const StreamSink& sink) {
BOOST_LOG_TRIVIAL(info) << "session_manager:: playout delay " BOOST_LOG_TRIVIAL(info) << "session_manager:: playout delay "
<< info.stream.m_ui32PlayOutDelay; << info.stream.m_ui32PlayOutDelay;
if (IN_MULTICAST(info.stream.m_ui32DestIP)) {
auto mcast_mac_addr = get_mcast_mac_addr(info.stream.m_ui32DestIP); auto mcast_mac_addr = get_mcast_mac_addr(info.stream.m_ui32DestIP);
std::copy(std::begin(mcast_mac_addr), std::end(mcast_mac_addr), std::copy(std::begin(mcast_mac_addr), std::end(mcast_mac_addr),
info.stream.m_ui8DestMAC); info.stream.m_ui8DestMAC);
} else {
auto mac_addr = config_->get_mac_addr();
std::copy(std::begin(mac_addr), std::end(mac_addr),
info.stream.m_ui8DestMAC);
}
std::unique_lock sinks_lock(sinks_mutex_); std::unique_lock sinks_lock(sinks_mutex_);
auto const it = sinks_.find(sink.id); auto const it = sinks_.find(sink.id);