diff --git a/daemon/scripts/ptp_master_start.sh b/daemon/scripts/ptp_master_start.sh index 4c14552..ed9f350 100755 --- a/daemon/scripts/ptp_master_start.sh +++ b/daemon/scripts/ptp_master_start.sh @@ -1,4 +1,5 @@ # Note: # currently ptp4l disables IP_MULTICAST_LOOP, so sockets on the same host cannot receive ptp4l traffic. -# Only exception is for lo network interface. +# Only exception is for loopback network interface. +# sudo ptp4l -i $1 -m -l7 -E -S diff --git a/daemon/session_manager.cpp b/daemon/session_manager.cpp index 2c08769..b1217ee 100644 --- a/daemon/session_manager.cpp +++ b/daemon/session_manager.cpp @@ -918,10 +918,8 @@ bool SessionManager::worker() { sap_.set_multicast_interface(config_->get_ip_addr_str()); - // join PTP multicast address for specific domain - uint32_t ptp_addr = ip::address_v4::from_string(ptp_dflt_mcast_addr).to_ulong() + - config_->get_ptp_domain(); - igmp_.join(config_->get_ip_addr_str(), ip::address_v4(ptp_addr).to_string()); + // join PTP multicast addresses + igmp_.join(config_->get_ip_addr_str(), ptp_primary_mcast_addr); while (running_) { // check if it's time to update the PTP status @@ -973,17 +971,6 @@ bool SessionManager::worker() { (void)driver_->set_sample_rate(driver_->get_current_sample_rate()); } } - - // update PTP multicast join - uint32_t new_ptp_addr = ip::address_v4::from_string(ptp_dflt_mcast_addr).to_ulong() + - ptp_config.ui8Domain; - if (new_ptp_addr != ptp_addr) { - // leave old PTP multicast address for specific domain - igmp_.leave(config_->get_ip_addr_str(), ip::address_v4(ptp_addr).to_string()); - ptp_addr = new_ptp_addr; - // join new PTP multicast address for specific domain - igmp_.join(config_->get_ip_addr_str(), ip::address_v4(ptp_addr).to_string()); - } } ptp_interval = 10; } @@ -1024,8 +1011,9 @@ bool SessionManager::worker() { // send deletion for this source sap_.deletion(static_cast(msg_id_hash), addr, sdp); } - // leave PTP primary multicast - igmp_.leave(config_->get_ip_addr_str(), ip::address_v4(ptp_addr).to_string()); + + // leave PTP multicast addresses + igmp_.leave(config_->get_ip_addr_str(), ptp_primary_mcast_addr); return true; } diff --git a/daemon/session_manager.hpp b/daemon/session_manager.hpp index 98d8e04..737ba2a 100644 --- a/daemon/session_manager.hpp +++ b/daemon/session_manager.hpp @@ -147,7 +147,8 @@ class SessionManager { size_t process_sap(); protected: - constexpr static const char ptp_dflt_mcast_addr[] = "224.0.1.129"; + constexpr static const char ptp_primary_mcast_addr[] = "224.0.1.129"; + constexpr static const char ptp_pdelay_mcast_addr[] = "224.0.1.107"; std::string get_removed_source_sdp_(uint32_t id, uint32_t src_addr) const; std::string get_source_sdp_(uint32_t id, const StreamInfo& info) const;