Skip to content

Commit

Permalink
Merge pull request #236 from anrp-tri/anrp/info
Browse files Browse the repository at this point in the history
Publish audio_info on a schedule
  • Loading branch information
knorth55 authored Feb 29, 2024
2 parents e4b7087 + 4d9b198 commit 8ed82e4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions audio_capture/src/audio_capture_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -249,6 +255,8 @@ namespace audio_capture
rclcpp::Publisher<audio_common_msgs::msg::AudioDataStamped>::SharedPtr _pub_stamped;
rclcpp::Publisher<audio_common_msgs::msg::AudioInfo>::SharedPtr _pub_info;

rclcpp::TimerBase::SharedPtr _timer_info;

boost::thread _gst_thread;

GstElement *_pipeline, *_source, *_filter, *_sink, *_convert, *_encode;
Expand Down

0 comments on commit 8ed82e4

Please sign in to comment.