From 48444bec65472ee5210554dbdf9d64e703610a6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maciej=20Blizi=C5=84ski?= Date: Tue, 23 Jul 2024 13:52:37 +0100 Subject: [PATCH 1/8] Use cpp-httplib via a submodule. This removes the need to script out the fetching of the other repository. Submodule stores the version of the sub-repository. --- .gitmodules | 3 +++ 3rdparty/.gitignore | 2 -- 3rdparty/cpp-httplib | 1 + build.sh | 8 -------- 4 files changed, 4 insertions(+), 10 deletions(-) create mode 100644 .gitmodules create mode 160000 3rdparty/cpp-httplib diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..d03a0f8 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "3rdparty/cpp-httplib"] + path = 3rdparty/cpp-httplib + url = git@github.com:bondagit/cpp-httplib.git diff --git a/3rdparty/.gitignore b/3rdparty/.gitignore index a31ccab..ab02b6f 100644 --- a/3rdparty/.gitignore +++ b/3rdparty/.gitignore @@ -1,3 +1 @@ /ravenna-alsa-lkm -/cpp-httplib - diff --git a/3rdparty/cpp-httplib b/3rdparty/cpp-httplib new file mode 160000 index 0000000..42f9f91 --- /dev/null +++ b/3rdparty/cpp-httplib @@ -0,0 +1 @@ +Subproject commit 42f9f9107f87ad2ee04be117dbbadd621c449552 diff --git a/build.sh b/build.sh index ed77e53..60d7d8a 100755 --- a/build.sh +++ b/build.sh @@ -17,14 +17,6 @@ if [ ! -d ravenna-alsa-lkm ]; then cd ../.. fi -if [ ! -d cpp-httplib ]; then - git clone https://github.com/bondagit/cpp-httplib.git - cd cpp-httplib - git checkout 42f9f9107f87ad2ee04be117dbbadd621c449552 - cd .. -fi -cd .. - cd webui echo "Downloading current webui release ..." wget --timestamping https://github.com/bondagit/aes67-linux-daemon/releases/latest/download/webui.tar.gz From fcd87be244edf3ac914c4bc9050472e772289c29 Mon Sep 17 00:00:00 2001 From: "Linux-Fan, Ma_Sys.ma" Date: Sun, 15 Sep 2024 14:18:30 +0200 Subject: [PATCH 2/8] aes67-daemon: Make dependency on libfaac optional Previously, since the introduction of the streamer support in version 2.0.0, it was impossible to compile the daemon without a dependency on libfaac. This prevented the daemon from being built on Debian systems without `non-free` repositories enabled. It seems the issue with libfaac is that it is based on code with a non-DFSG compliant license. This commit introduces a new config option WITH_STREAMER which is ON by default, causing the behaviour to stay backwards-compatible with the one before this commit. It is newly possible to pass `-DWITH_STREAMER=OFF` to cmake to build without streamer support and without the dependency on libfaac. --- daemon/CMakeLists.txt | 20 +++++++++++++++----- daemon/http_server.cpp | 6 ++++++ daemon/http_server.hpp | 9 +++++++++ daemon/json.cpp | 2 ++ daemon/json.hpp | 5 +++++ daemon/main.cpp | 9 +++++++++ 6 files changed, 46 insertions(+), 5 deletions(-) diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index 38a0a83..1d054d5 100644 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -12,6 +12,7 @@ option(FAKE_DRIVER "Use fake driver instead of RAVENNA" OFF) set(CMAKE_CXX_STANDARD 17) option(WITH_SYSTEMD "Include systemd notify and watchdog support" OFF) +option(WITH_STREAMER "Enable streamer support" ON) # ravena lkm _should_ be provided by the CLI. Nonetheless, we should be able # to find it in system dirs too... @@ -24,9 +25,6 @@ if (NOT CPP_HTTPLIB_DIR) find_path( CPP_HTTPLIB_DIR "httplib.h" REQUIRED) endif() -find_library(ALSA_LIBRARY NAMES asound) -find_library(AAC_LIBRARY NAMES faac) - find_library(AVAHI_LIBRARY-COMMON NAMES avahi-common) find_library(AVAHI_LIBRARY-CLIENT NAMES avahi-client) find_path(AVAHI_INCLUDE_DIR avahi-client/publish.h) @@ -37,7 +35,13 @@ find_package(Boost COMPONENTS system thread log program_options REQUIRED) include_directories(aes67-daemon ${RAVENNA_ALSA_LKM_DIR}/common ${RAVENNA_ALSA_LKM_DIR}/driver ${CPP_HTTPLIB_DIR} ${Boost_INCLUDE_DIR}) add_definitions( -DBOOST_LOG_DYN_LINK -DBOOST_LOG_USE_NATIVE_SYSLOG ) add_compile_options( -Wall ) -set(SOURCES error_code.cpp json.cpp main.cpp session_manager.cpp http_server.cpp config.cpp interface.cpp log.cpp sap.cpp browser.cpp rtsp_client.cpp mdns_client.cpp mdns_server.cpp rtsp_server.cpp utils.cpp streamer.cpp) +set(SOURCES error_code.cpp json.cpp main.cpp session_manager.cpp http_server.cpp config.cpp interface.cpp log.cpp sap.cpp browser.cpp rtsp_client.cpp mdns_client.cpp mdns_server.cpp rtsp_server.cpp utils.cpp) + +if(WITH_STREAMER) + MESSAGE(STATUS "WITH_STREAMER") + add_definitions(-DUSE_STREAMER) + list(APPEND SOURCES streamer.cpp) +endif() if(FAKE_DRIVER) MESSAGE(STATUS "FAKE_DRIVER") @@ -52,7 +56,7 @@ if(ENABLE_TESTS) add_subdirectory(tests) endif() -target_link_libraries(aes67-daemon ${Boost_LIBRARIES} ${ALSA_LIBRARY} ${AAC_LIBRARY}) +target_link_libraries(aes67-daemon ${Boost_LIBRARIES}) if(WITH_AVAHI) MESSAGE(STATUS "WITH_AVAHI") add_definitions(-D_USE_AVAHI_) @@ -65,3 +69,9 @@ if(WITH_SYSTEMD) add_definitions(-D_USE_SYSTEMD_) target_link_libraries(aes67-daemon systemd) endif() + +if(WITH_STREAMER) + find_library(ALSA_LIBRARY NAMES asound) + find_library(AAC_LIBRARY NAMES faac) + target_link_libraries(aes67-daemon ${ALSA_LIBRARY} ${AAC_LIBRARY}) +endif() diff --git a/daemon/http_server.cpp b/daemon/http_server.cpp index e3f67bd..1ada3d0 100644 --- a/daemon/http_server.cpp +++ b/daemon/http_server.cpp @@ -323,6 +323,7 @@ bool HttpServer::init() { }); /* retrieve streamer info and position */ +#ifdef USE_STREAMER svr_.Get("/api/streamer/info/([0-9]+)", [this](const Request& req, Response& res) { uint32_t id; @@ -377,10 +378,12 @@ bool HttpServer::init() { set_headers(res, "application/json"); res.body = streamer_info_to_json(info); }); +#endif /* retrieve streamer file */ svr_.Get("/api/streamer/stream/([0-9]+)/([0-9]+)", [this](const Request& req, Response& res) { +#ifdef USE_STREAMER if (!config_->get_streamer_enabled()) { set_error(400, "streamer not enabled", res); return; @@ -411,6 +414,9 @@ bool HttpServer::init() { res.set_header("X-File-Count", std::to_string(fileCount)); res.set_header("X-File-Current-Id", std::to_string(currentFileId)); res.set_header("X-File-Start-Id", std::to_string(startFileId)); +#else + set_error(400, "streamer support not compiled-in", res); +#endif }); svr_.set_logger([](const Request& req, const Response& res) { diff --git a/daemon/http_server.hpp b/daemon/http_server.hpp index 65a6667..1ac24e2 100644 --- a/daemon/http_server.hpp +++ b/daemon/http_server.hpp @@ -25,18 +25,25 @@ #include "browser.hpp" #include "config.hpp" #include "session_manager.hpp" + +#ifdef USE_STREAMER #include "streamer.hpp" +#endif class HttpServer { public: HttpServer() = delete; explicit HttpServer(std::shared_ptr session_manager, std::shared_ptr browser, +#ifdef USE_STREAMER std::shared_ptr streamer, +#endif std::shared_ptr config) : session_manager_(session_manager), browser_(browser), +#ifdef USE_STREAMER streamer_(streamer), +#endif config_(config){}; bool init(); bool terminate(); @@ -44,7 +51,9 @@ class HttpServer { private: std::shared_ptr session_manager_; std::shared_ptr browser_; +#ifdef USE_STREAMER std::shared_ptr streamer_; +#endif std::shared_ptr config_; httplib::Server svr_; std::future res_; diff --git a/daemon/json.cpp b/daemon/json.cpp index 27cd0ec..275e0cf 100644 --- a/daemon/json.cpp +++ b/daemon/json.cpp @@ -290,6 +290,7 @@ std::string remote_sources_to_json(const std::list& sources) { return ss.str(); } +#ifdef USE_STREAMER std::string streamer_info_to_json(const StreamerInfo& info) { std::stringstream ss; ss << "{" @@ -304,6 +305,7 @@ std::string streamer_info_to_json(const StreamerInfo& info) { << ",\n \"rate\": " << unsigned(info.rate) << "\n}\n"; return ss.str(); } +#endif Config json_to_config_(std::istream& js, Config& config) { try { diff --git a/daemon/json.hpp b/daemon/json.hpp index 1dd8b04..b250f5a 100644 --- a/daemon/json.hpp +++ b/daemon/json.hpp @@ -24,7 +24,10 @@ #include "browser.hpp" #include "session_manager.hpp" + +#ifdef USE_STREAMER #include "streamer.hpp" +#endif /* JSON serializers */ std::string config_to_json(const Config& config); @@ -39,7 +42,9 @@ std::string streams_to_json(const std::list& sources, const std::list& sinks); std::string remote_source_to_json(const RemoteSource& source); std::string remote_sources_to_json(const std::list& sources); +#ifdef USE_STREAMER std::string streamer_info_to_json(const StreamerInfo& info); +#endif /* JSON deserializers */ Config json_to_config(std::istream& jstream, const Config& curCconfig); diff --git a/daemon/main.cpp b/daemon/main.cpp index e307fd0..513bd3a 100644 --- a/daemon/main.cpp +++ b/daemon/main.cpp @@ -30,7 +30,10 @@ #include "mdns_server.hpp" #include "rtsp_server.hpp" #include "session_manager.hpp" + +#ifdef USE_STREAMER #include "streamer.hpp" +#endif #ifdef _USE_SYSTEMD_ #include @@ -181,6 +184,7 @@ int main(int argc, char* argv[]) { } /* start streamer */ +#ifdef USE_STREAMER auto streamer = Streamer::create(session_manager, config); if (config->get_streamer_enabled() && (streamer == nullptr || !streamer->init())) { @@ -189,6 +193,9 @@ int main(int argc, char* argv[]) { /* start http server */ HttpServer http_server(session_manager, browser, streamer, config); +#else + HttpServer http_server(session_manager, browser, config); +#endif if (!http_server.init()) { throw std::runtime_error(std::string("HttpServer:: init failed")); } @@ -247,11 +254,13 @@ int main(int argc, char* argv[]) { } /* stop streamer */ +#ifdef USE_STREAMER if (config->get_streamer_enabled()) { if (!streamer->terminate()) { throw std::runtime_error(std::string("Streamer:: terminate failed")); } } +#endif /* stop rtsp server */ if (!rtsp_server.terminate()) { From 47da082405026f102d1e5823b9a606a612ae1460 Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Mon, 16 Sep 2024 11:33:54 +0200 Subject: [PATCH 3/8] - renamed USE_STREAMER compilation flag to _USE_STREAMER_ - changed cpp-httplib git submodule path to https://github.com/bondagit/cpp-httplib.git - removed compilation warning related to the usage of Boost bind global placeholders - updated daemon version to 2.0.2 --- .gitmodules | 2 +- 3rdparty/cpp-httplib | 2 +- build.sh | 1 + daemon/CMakeLists.txt | 2 +- daemon/config.cpp | 19 ++++++++++++++++++- daemon/config.hpp | 4 ++-- daemon/http_server.cpp | 6 ++++-- daemon/http_server.hpp | 8 ++++---- daemon/json.cpp | 7 +++++-- daemon/json.hpp | 4 ++-- daemon/main.cpp | 8 ++++---- daemon/netlink_client.hpp | 3 ++- daemon/sap.cpp | 3 ++- daemon/session_manager.cpp | 3 ++- daemon/tests/daemon_test.cpp | 8 ++++++-- 15 files changed, 55 insertions(+), 25 deletions(-) diff --git a/.gitmodules b/.gitmodules index d03a0f8..ac58ae1 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "3rdparty/cpp-httplib"] path = 3rdparty/cpp-httplib - url = git@github.com:bondagit/cpp-httplib.git + url = https://github.com/bondagit/cpp-httplib.git diff --git a/3rdparty/cpp-httplib b/3rdparty/cpp-httplib index 42f9f91..07c6e58 160000 --- a/3rdparty/cpp-httplib +++ b/3rdparty/cpp-httplib @@ -1 +1 @@ -Subproject commit 42f9f9107f87ad2ee04be117dbbadd621c449552 +Subproject commit 07c6e58951931f8c74de8291ff35a3298fe481c4 diff --git a/build.sh b/build.sh index 6ad4446..3948fb0 100755 --- a/build.sh +++ b/build.sh @@ -39,6 +39,7 @@ cmake \ -DWITH_AVAHI=ON \ -DFAKE_DRIVER=OFF \ -DWITH_SYSTEMD=ON \ + -DWITH_STREAMER=ON \ . make cd .. diff --git a/daemon/CMakeLists.txt b/daemon/CMakeLists.txt index 1d054d5..b7a8b6e 100644 --- a/daemon/CMakeLists.txt +++ b/daemon/CMakeLists.txt @@ -39,7 +39,7 @@ set(SOURCES error_code.cpp json.cpp main.cpp session_manager.cpp http_server.cpp if(WITH_STREAMER) MESSAGE(STATUS "WITH_STREAMER") - add_definitions(-DUSE_STREAMER) + add_definitions(-D_USE_STREAMER_) list(APPEND SOURCES streamer.cpp) endif() diff --git a/daemon/config.cpp b/daemon/config.cpp index 08bd7c5..634fa49 100644 --- a/daemon/config.cpp +++ b/daemon/config.cpp @@ -17,6 +17,8 @@ // along with this program. If not, see . // +#define BOOST_BIND_GLOBAL_PLACEHOLDERS + #include #include #include @@ -72,7 +74,8 @@ std::shared_ptr Config::parse(const std::string& filename, config.streamer_file_duration_ = 1; if (config.streamer_files_num_ < 4 || config.streamer_files_num_ > 16) config.streamer_files_num_ = 8; - if (config.streamer_player_buffer_files_num_ < 1 || config.streamer_player_buffer_files_num_ > 2) + if (config.streamer_player_buffer_files_num_ < 1 || + config.streamer_player_buffer_files_num_ > 2) config.streamer_player_buffer_files_num_ = 1; boost::system::error_code ec; @@ -169,3 +172,17 @@ std::string Config::get_node_id() const { return custom_node_id_; } } + +bool Config::get_streamer_enabled() const { +#ifndef _USE_STREAMER_ + return false; +#endif + return streamer_enabled_; +} + +bool Config::get_mdns_enabled() const { +#ifndef _USE_AVAHI_ + return false; +#endif + return mdns_enabled_; +} diff --git a/daemon/config.hpp b/daemon/config.hpp index 90a56e8..05879cd 100644 --- a/daemon/config.hpp +++ b/daemon/config.hpp @@ -45,7 +45,7 @@ class Config { return streamer_player_buffer_files_num_; }; uint8_t get_streamer_channels() const { return streamer_channels_; }; - bool get_streamer_enabled() const { return streamer_enabled_; }; + bool get_streamer_enabled() const; int get_log_severity() const { return log_severity_; }; uint32_t get_playout_delay() const { return playout_delay_; }; uint32_t get_tic_frame_size_at_1fs() const { return tic_frame_size_at_1fs_; }; @@ -73,7 +73,7 @@ class Config { const std::string& get_ip_addr_str() const { return ip_str_; }; bool get_daemon_restart() const { return daemon_restart_; }; bool get_driver_restart() const { return driver_restart_; }; - bool get_mdns_enabled() const { return mdns_enabled_; }; + bool get_mdns_enabled() const; int get_interface_idx() const { return interface_idx_; }; const std::string& get_ptp_status_script() const { return ptp_status_script_; diff --git a/daemon/http_server.cpp b/daemon/http_server.cpp index 1ada3d0..4ce4bf5 100644 --- a/daemon/http_server.cpp +++ b/daemon/http_server.cpp @@ -17,6 +17,8 @@ // along with this program. If not, see . // +#define BOOST_BIND_GLOBAL_PLACEHOLDERS + #include #include #include @@ -323,7 +325,7 @@ bool HttpServer::init() { }); /* retrieve streamer info and position */ -#ifdef USE_STREAMER +#ifdef _USE_STREAMER_ svr_.Get("/api/streamer/info/([0-9]+)", [this](const Request& req, Response& res) { uint32_t id; @@ -383,7 +385,7 @@ bool HttpServer::init() { /* retrieve streamer file */ svr_.Get("/api/streamer/stream/([0-9]+)/([0-9]+)", [this](const Request& req, Response& res) { -#ifdef USE_STREAMER +#ifdef _USE_STREAMER_ if (!config_->get_streamer_enabled()) { set_error(400, "streamer not enabled", res); return; diff --git a/daemon/http_server.hpp b/daemon/http_server.hpp index 1ac24e2..41a25b4 100644 --- a/daemon/http_server.hpp +++ b/daemon/http_server.hpp @@ -26,7 +26,7 @@ #include "config.hpp" #include "session_manager.hpp" -#ifdef USE_STREAMER +#ifdef _USE_STREAMER_ #include "streamer.hpp" #endif @@ -35,13 +35,13 @@ class HttpServer { HttpServer() = delete; explicit HttpServer(std::shared_ptr session_manager, std::shared_ptr browser, -#ifdef USE_STREAMER +#ifdef _USE_STREAMER_ std::shared_ptr streamer, #endif std::shared_ptr config) : session_manager_(session_manager), browser_(browser), -#ifdef USE_STREAMER +#ifdef _USE_STREAMER_ streamer_(streamer), #endif config_(config){}; @@ -51,7 +51,7 @@ class HttpServer { private: std::shared_ptr session_manager_; std::shared_ptr browser_; -#ifdef USE_STREAMER +#ifdef _USE_STREAMER_ std::shared_ptr streamer_; #endif std::shared_ptr config_; diff --git a/daemon/json.cpp b/daemon/json.cpp index 275e0cf..2a7c680 100644 --- a/daemon/json.cpp +++ b/daemon/json.cpp @@ -17,6 +17,8 @@ // along with this program. If not, see . // +#define BOOST_BIND_GLOBAL_PLACEHOLDERS + #include #include #include @@ -290,14 +292,15 @@ std::string remote_sources_to_json(const std::list& sources) { return ss.str(); } -#ifdef USE_STREAMER +#ifdef _USE_STREAMER_ std::string streamer_info_to_json(const StreamerInfo& info) { std::stringstream ss; ss << "{" << "\n \"status\": " << unsigned(info.status) << ",\n \"file_duration\": " << unsigned(info.file_duration) << ",\n \"files_num\": " << unsigned(info.files_num) - << ",\n \"player_buffer_files_num\": " << unsigned(info.player_buffer_files_num) + << ",\n \"player_buffer_files_num\": " + << unsigned(info.player_buffer_files_num) << ",\n \"start_file_id\": " << unsigned(info.start_file_id) << ",\n \"current_file_id\": " << unsigned(info.current_file_id) << ",\n \"channels\": " << unsigned(info.channels) diff --git a/daemon/json.hpp b/daemon/json.hpp index b250f5a..2804bd3 100644 --- a/daemon/json.hpp +++ b/daemon/json.hpp @@ -25,7 +25,7 @@ #include "browser.hpp" #include "session_manager.hpp" -#ifdef USE_STREAMER +#ifdef _USE_STREAMER_ #include "streamer.hpp" #endif @@ -42,7 +42,7 @@ std::string streams_to_json(const std::list& sources, const std::list& sinks); std::string remote_source_to_json(const RemoteSource& source); std::string remote_sources_to_json(const std::list& sources); -#ifdef USE_STREAMER +#ifdef _USE_STREAMER_ std::string streamer_info_to_json(const StreamerInfo& info); #endif diff --git a/daemon/main.cpp b/daemon/main.cpp index 513bd3a..bfaec6b 100644 --- a/daemon/main.cpp +++ b/daemon/main.cpp @@ -31,7 +31,7 @@ #include "rtsp_server.hpp" #include "session_manager.hpp" -#ifdef USE_STREAMER +#ifdef _USE_STREAMER_ #include "streamer.hpp" #endif @@ -43,7 +43,7 @@ namespace po = boost::program_options; namespace postyle = boost::program_options::command_line_style; namespace logging = boost::log; -static const std::string version("bondagit-2.0.1"); +static const std::string version("bondagit-2.0.2"); static std::atomic terminate = false; void termination_handler(int signum) { @@ -184,7 +184,7 @@ int main(int argc, char* argv[]) { } /* start streamer */ -#ifdef USE_STREAMER +#ifdef _USE_STREAMER_ auto streamer = Streamer::create(session_manager, config); if (config->get_streamer_enabled() && (streamer == nullptr || !streamer->init())) { @@ -254,7 +254,7 @@ int main(int argc, char* argv[]) { } /* stop streamer */ -#ifdef USE_STREAMER +#ifdef _USE_STREAMER_ if (config->get_streamer_enabled()) { if (!streamer->terminate()) { throw std::runtime_error(std::string("Streamer:: terminate failed")); diff --git a/daemon/netlink_client.hpp b/daemon/netlink_client.hpp index f8ce5e8..95e00cf 100644 --- a/daemon/netlink_client.hpp +++ b/daemon/netlink_client.hpp @@ -23,13 +23,14 @@ #include #include #include -#include +#include #include #include #include #include "netlink.hpp" +using namespace boost::placeholders; using boost::asio::deadline_timer; class NetlinkClient { diff --git a/daemon/sap.cpp b/daemon/sap.cpp index 03232d7..cb7e3ae 100644 --- a/daemon/sap.cpp +++ b/daemon/sap.cpp @@ -17,10 +17,11 @@ // along with this program. If not, see . // -#include +#include #include "sap.hpp" +using namespace boost::placeholders; using namespace boost::asio; using namespace boost::asio::ip; diff --git a/daemon/session_manager.cpp b/daemon/session_manager.cpp index 27bfc25..c997b2e 100644 --- a/daemon/session_manager.cpp +++ b/daemon/session_manager.cpp @@ -18,6 +18,7 @@ // #define CPPHTTPLIB_PAYLOAD_MAX_LENGTH 4096 // max for SDP file +#define BOOST_BIND_GLOBAL_PLACEHOLDERS #include #include @@ -463,7 +464,7 @@ void SessionManager::add_source_observer(SourceObserverType type, } void SessionManager::add_sink_observer(SinkObserverType type, - const SinkObserver& cb) { + const SinkObserver& cb) { switch (type) { case SinkObserverType::add_sink: add_sink_observers_.push_back(cb); diff --git a/daemon/tests/daemon_test.cpp b/daemon/tests/daemon_test.cpp index 0dc994d..940c05c 100644 --- a/daemon/tests/daemon_test.cpp +++ b/daemon/tests/daemon_test.cpp @@ -17,6 +17,8 @@ // #define CPPHTTPLIB_PAYLOAD_MAX_LENGTH 4096 // max for SDP file +#define BOOST_BIND_GLOBAL_PLACEHOLDERS + #include #include #include @@ -404,7 +406,8 @@ BOOST_AUTO_TEST_CASE(get_config) { auto streamer_channels = pt.get("streamer_channels"); auto streamer_files_num = pt.get("streamer_files_num"); auto streamer_file_duration = pt.get("streamer_file_duration"); - auto streamer_player_buffer_files_num = pt.get("streamer_player_buffer_files_num"); + auto streamer_player_buffer_files_num = + pt.get("streamer_player_buffer_files_num"); BOOST_CHECK_MESSAGE(http_port == 9999, "config as excepcted"); // BOOST_CHECK_MESSAGE(log_severity == 5, "config as excepcted"); BOOST_CHECK_MESSAGE(playout_delay == 0, "config as excepcted"); @@ -432,7 +435,8 @@ BOOST_AUTO_TEST_CASE(get_config) { BOOST_CHECK_MESSAGE(streamer_channels == 8, "config as excepcted"); BOOST_CHECK_MESSAGE(streamer_files_num == 6, "config as excepcted"); BOOST_CHECK_MESSAGE(streamer_file_duration == 3, "config as excepcted"); - BOOST_CHECK_MESSAGE(streamer_player_buffer_files_num == 2, "config as excepcted"); + BOOST_CHECK_MESSAGE(streamer_player_buffer_files_num == 2, + "config as excepcted"); } BOOST_AUTO_TEST_CASE(get_ptp_status) { From fdbfb3f1a1aff326bae8146532165a2787e98254 Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Mon, 16 Sep 2024 11:45:44 +0200 Subject: [PATCH 4/8] Added init of git submodules in build.sh --- build.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build.sh b/build.sh index 3948fb0..9153306 100755 --- a/build.sh +++ b/build.sh @@ -9,6 +9,9 @@ export CXX=/usr/bin/clang++ TOPDIR=$(pwd) +echo "Init git submodules ..." +git submodule update --init --recursive + cd 3rdparty if [ ! -d ravenna-alsa-lkm ]; then git clone --single-branch --branch aes67-daemon https://github.com/bondagit/ravenna-alsa-lkm.git From bb75a1e6e4e28ffd82d3cfe7d9709440fa74c932 Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Mon, 16 Sep 2024 11:48:42 +0200 Subject: [PATCH 5/8] Added init of git submodules in buildfake.sh --- buildfake.sh | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/buildfake.sh b/buildfake.sh index 2c9b325..2b7bd6f 100755 --- a/buildfake.sh +++ b/buildfake.sh @@ -10,20 +10,13 @@ export CXX=/usr/bin/clang++ TOPDIR=$(pwd) git config --global http.sslverify false +git submodule update --init --recursive cd 3rdparty if [ ! -d ravenna-alsa-lkm ]; then git clone --single-branch --branch aes67-daemon https://github.com/bondagit/ravenna-alsa-lkm.git fi -if [ ! -d cpp-httplib ]; then - git clone https://github.com/bondagit/cpp-httplib.git - cd cpp-httplib - git checkout 42f9f9107f87ad2ee04be117dbbadd621c449552 - cd .. -fi -cd .. - cd daemon echo "Building aes67-daemon ..." cmake \ From 04ea7f7f190f5c387e44f4e67e2442eb5fb83ba5 Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Mon, 16 Sep 2024 11:53:25 +0200 Subject: [PATCH 6/8] Fix to buildfake.sh --- buildfake.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/buildfake.sh b/buildfake.sh index 2b7bd6f..6c6f41b 100755 --- a/buildfake.sh +++ b/buildfake.sh @@ -16,6 +16,7 @@ cd 3rdparty if [ ! -d ravenna-alsa-lkm ]; then git clone --single-branch --branch aes67-daemon https://github.com/bondagit/ravenna-alsa-lkm.git fi +cd .. cd daemon echo "Building aes67-daemon ..." From 969e343309a05b7072dedae6b242ca9178b35188 Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Mon, 16 Sep 2024 12:05:22 +0200 Subject: [PATCH 7/8] Use 3rdparty/ravenna-alsa-lkm via a submodule. Fix to the daemon regression test. --- .gitmodules | 4 ++++ 3rdparty/ravenna-alsa-lkm | 1 + build.sh | 8 -------- buildfake.sh | 7 +------ daemon/tests/daemon.conf | 2 +- daemon/tests/daemon_test.cpp | 2 +- 6 files changed, 8 insertions(+), 16 deletions(-) create mode 160000 3rdparty/ravenna-alsa-lkm diff --git a/.gitmodules b/.gitmodules index ac58ae1..dc07671 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,7 @@ [submodule "3rdparty/cpp-httplib"] path = 3rdparty/cpp-httplib url = https://github.com/bondagit/cpp-httplib.git +[submodule "3rdparty/ravenna-alsa-lkm"] + path = 3rdparty/ravenna-alsa-lkm + url = https://github.com/bondagit/ravenna-alsa-lkm.git + branch = aes67-daemon diff --git a/3rdparty/ravenna-alsa-lkm b/3rdparty/ravenna-alsa-lkm new file mode 160000 index 0000000..9897287 --- /dev/null +++ b/3rdparty/ravenna-alsa-lkm @@ -0,0 +1 @@ +Subproject commit 989728785990592cd3544e54d767beab97366fc6 diff --git a/build.sh b/build.sh index 9153306..c03717b 100755 --- a/build.sh +++ b/build.sh @@ -12,14 +12,6 @@ TOPDIR=$(pwd) echo "Init git submodules ..." git submodule update --init --recursive -cd 3rdparty -if [ ! -d ravenna-alsa-lkm ]; then - git clone --single-branch --branch aes67-daemon https://github.com/bondagit/ravenna-alsa-lkm.git - cd ravenna-alsa-lkm/driver - make - cd ../.. -fi - cd webui echo "Downloading current webui release ..." wget --timestamping https://github.com/bondagit/aes67-linux-daemon/releases/latest/download/webui.tar.gz diff --git a/buildfake.sh b/buildfake.sh index 6c6f41b..28d5573 100755 --- a/buildfake.sh +++ b/buildfake.sh @@ -12,12 +12,6 @@ TOPDIR=$(pwd) git config --global http.sslverify false git submodule update --init --recursive -cd 3rdparty -if [ ! -d ravenna-alsa-lkm ]; then - git clone --single-branch --branch aes67-daemon https://github.com/bondagit/ravenna-alsa-lkm.git -fi -cd .. - cd daemon echo "Building aes67-daemon ..." cmake \ @@ -26,6 +20,7 @@ cmake \ -DENABLE_TESTS=ON \ -DWITH_AVAHI=OFF \ -DFAKE_DRIVER=ON \ + -DWITH_STREAMER=OFF \ . make cd .. diff --git a/daemon/tests/daemon.conf b/daemon/tests/daemon.conf index ae6a95f..07a967e 100644 --- a/daemon/tests/daemon.conf +++ b/daemon/tests/daemon.conf @@ -17,7 +17,7 @@ "syslog_server": "255.255.255.254:1234", "status_file": "", "interface_name": "lo", - "mdns_enabled": true, + "mdns_enabled": false, "custom_node_id": "test node", "node_id": "test node", "ptp_status_script": "", diff --git a/daemon/tests/daemon_test.cpp b/daemon/tests/daemon_test.cpp index 940c05c..8c06b23 100644 --- a/daemon/tests/daemon_test.cpp +++ b/daemon/tests/daemon_test.cpp @@ -430,7 +430,7 @@ BOOST_AUTO_TEST_CASE(get_config) { BOOST_CHECK_MESSAGE(node_id == "test node", "config as excepcted"); BOOST_CHECK_MESSAGE(custom_node_id == "test node", "config as excepcted"); BOOST_CHECK_MESSAGE(auto_sinks_update == true, "config as excepcted"); - BOOST_CHECK_MESSAGE(mdns_enabled == true, "config as excepcted"); + BOOST_CHECK_MESSAGE(mdns_enabled == false, "config as excepcted"); BOOST_CHECK_MESSAGE(streamer_enabled == false, "config as excepcted"); BOOST_CHECK_MESSAGE(streamer_channels == 8, "config as excepcted"); BOOST_CHECK_MESSAGE(streamer_files_num == 6, "config as excepcted"); From 1b057635f3f082777a5d3c43a194f9f79cdba880 Mon Sep 17 00:00:00 2001 From: Andrea Bondavalli Date: Mon, 16 Sep 2024 12:38:32 +0200 Subject: [PATCH 8/8] Fix to build.sh to restore module compilation and to daemon regression tests --- 3rdparty/.gitignore | 1 - build.sh | 4 ++++ daemon/tests/daemon.conf | 2 +- daemon/tests/daemon_test.cpp | 4 ++++ 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/3rdparty/.gitignore b/3rdparty/.gitignore index ab02b6f..e69de29 100644 --- a/3rdparty/.gitignore +++ b/3rdparty/.gitignore @@ -1 +0,0 @@ -/ravenna-alsa-lkm diff --git a/build.sh b/build.sh index c03717b..b33954b 100755 --- a/build.sh +++ b/build.sh @@ -12,6 +12,10 @@ TOPDIR=$(pwd) echo "Init git submodules ..." git submodule update --init --recursive +cd 3rdparty/ravenna-alsa-lkm/driver +make +cd - + cd webui echo "Downloading current webui release ..." wget --timestamping https://github.com/bondagit/aes67-linux-daemon/releases/latest/download/webui.tar.gz diff --git a/daemon/tests/daemon.conf b/daemon/tests/daemon.conf index 07a967e..ae6a95f 100644 --- a/daemon/tests/daemon.conf +++ b/daemon/tests/daemon.conf @@ -17,7 +17,7 @@ "syslog_server": "255.255.255.254:1234", "status_file": "", "interface_name": "lo", - "mdns_enabled": false, + "mdns_enabled": true, "custom_node_id": "test node", "node_id": "test node", "ptp_status_script": "", diff --git a/daemon/tests/daemon_test.cpp b/daemon/tests/daemon_test.cpp index 8c06b23..6c6db84 100644 --- a/daemon/tests/daemon_test.cpp +++ b/daemon/tests/daemon_test.cpp @@ -430,7 +430,11 @@ BOOST_AUTO_TEST_CASE(get_config) { BOOST_CHECK_MESSAGE(node_id == "test node", "config as excepcted"); BOOST_CHECK_MESSAGE(custom_node_id == "test node", "config as excepcted"); BOOST_CHECK_MESSAGE(auto_sinks_update == true, "config as excepcted"); +#ifdef _USE_AVAHI_ + BOOST_CHECK_MESSAGE(mdns_enabled == true, "config as excepcted"); +#else BOOST_CHECK_MESSAGE(mdns_enabled == false, "config as excepcted"); +#endif BOOST_CHECK_MESSAGE(streamer_enabled == false, "config as excepcted"); BOOST_CHECK_MESSAGE(streamer_channels == 8, "config as excepcted"); BOOST_CHECK_MESSAGE(streamer_files_num == 6, "config as excepcted");