diff --git a/audio_capture/src/audio_capture_node.cpp b/audio_capture/src/audio_capture_node.cpp index a909e53..d546380 100644 --- a/audio_capture/src/audio_capture_node.cpp +++ b/audio_capture/src/audio_capture_node.cpp @@ -166,6 +166,12 @@ namespace audio_capture _gst_thread = boost::thread( boost::bind(g_main_loop_run, _loop) ); + _timer_info = rclcpp::create_timer(this, get_clock(), std::chrono::seconds(5), [this] { publishInfo(); }); + publishInfo(); + } + + void publishInfo() { + audio_common_msgs::msg::AudioInfo info_msg; info_msg.channels = _channels; info_msg.sample_rate = _sample_rate; @@ -249,6 +255,8 @@ namespace audio_capture rclcpp::Publisher::SharedPtr _pub_stamped; rclcpp::Publisher::SharedPtr _pub_info; + rclcpp::TimerBase::SharedPtr _timer_info; + boost::thread _gst_thread; GstElement *_pipeline, *_source, *_filter, *_sink, *_convert, *_encode;