Skip to content

Commit 6c0662a

Browse files
author
HABU Miki
committed
Merge branch 'fix/ros2_jazzy' into develop-piezo
https://github.com/EricVoll/webrtc_ros/tree/fix/ros2_jazzy で公開されているJazzy対応修正の取り込み
2 parents 9811d12 + df281d5 commit 6c0662a

File tree

8 files changed

+30
-26
lines changed

8 files changed

+30
-26
lines changed

webrtc/build/get_gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ then
2525
git clone https://gn.googlesource.com/gn third_party/gn
2626
cd third_party/gn
2727
git checkout 501b49a3ab4f0d099457b6e5b62c709a1d2311be
28-
CC=gcc CXX=g++ LDFLAGS=-fuse-ld=gold python build/gen.py
28+
CC=gcc CXX=g++ LDFLAGS=-fuse-ld=gold python3 build/gen.py
2929
"$rootdir/depot_tools/ninja" -C out gn
3030
cp out/gn .
3131
fi

webrtc_ros/CMakeLists.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ find_package(webrtc_ros_msgs REQUIRED)
1111
find_package(webrtc REQUIRED)
1212
find_package(X11 REQUIRED)
1313
find_package(jsoncpp REQUIRED)
14+
find_package(OpenCV REQUIRED)
1415

1516

1617
###########
@@ -23,7 +24,7 @@ include_directories(
2324
${OpenCV_INCLUDE_DIRS}
2425
${webrtc_ros_msgs_INCLUDE_DIRS}
2526
${webrtc_INCLUDE_DIRS}
26-
27+
2728
)
2829
add_definitions(${webrtc_DEFINITIONS})
2930

@@ -56,15 +57,17 @@ ament_target_dependencies(
5657
image_transport
5758
rclcpp
5859
std_msgs
59-
webrtc_ros_msgs
60-
60+
webrtc_ros_msgs
61+
6162
)
6263

6364
target_link_libraries(${PROJECT_NAME}_server_node
6465
${webrtc_LIBRARIES}
6566
webrtc
6667
jsoncpp_lib
6768
${X11_LIBRARIES}
69+
${OpenCV_LIBS}
70+
ament_index_cpp::ament_index_cpp
6871
)
6972

7073
set_target_properties(${PROJECT_NAME}_server_node PROPERTIES COMPILE_OPTIONS "-std=c++17")

webrtc_ros/include/webrtc_ros/ros_video_capturer.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ class RosVideoCapturer :
3737
bool remote() const override;
3838

3939
private:
40-
RTC_DISALLOW_COPY_AND_ASSIGN(RosVideoCapturer);
40+
RosVideoCapturer(const RosVideoCapturer&) = delete;
41+
RosVideoCapturer& operator=(const RosVideoCapturer&) = delete;
42+
4143
boost::shared_ptr<RosVideoCapturerImpl> impl_;
4244
};
4345

@@ -56,7 +58,8 @@ class RosVideoCapturerImpl : public boost::enable_shared_from_this<RosVideoCaptu
5658
void Stop();
5759

5860
private:
59-
RTC_DISALLOW_COPY_AND_ASSIGN(RosVideoCapturerImpl);
61+
RosVideoCapturerImpl(const RosVideoCapturerImpl&) = delete;
62+
RosVideoCapturerImpl& operator=(const RosVideoCapturerImpl&) = delete;
6063

6164
ImageTransportFactory it_;
6265
const std::string topic_, transport_;

webrtc_ros/include/webrtc_ros/ros_video_renderer.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ class RosVideoRenderer :
1616
virtual void OnFrame(const webrtc::VideoFrame& frame) override;
1717

1818
private:
19-
RTC_DISALLOW_COPY_AND_ASSIGN(RosVideoRenderer);
19+
RosVideoRenderer(const RosVideoRenderer&) = delete;
20+
RosVideoRenderer& operator=(const RosVideoRenderer&) = delete;
2021
std::shared_ptr<image_transport::ImageTransport> it_;
2122
const std::string topic_;
2223
image_transport::Publisher pub_;

webrtc_ros/src/ros_video_capturer.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#include "webrtc_ros/ros_video_capturer.h"
2-
#include "webrtc/rtc_base/bind.h"
32

43
#include <rclcpp/rclcpp.hpp>
5-
#include <cv_bridge/cv_bridge.h>
4+
#include <cv_bridge/cv_bridge.hpp>
65
#include <boost/enable_shared_from_this.hpp>
76

87
namespace webrtc_ros

webrtc_ros/src/ros_video_renderer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#include <webrtc_ros/ros_video_renderer.h>
22
#include <rclcpp/rclcpp.hpp>
3-
#include <cv_bridge/cv_bridge.h>
3+
#include <cv_bridge/cv_bridge.hpp>
44
#include <webrtc/3rdparty/libyuv/convert_from.h>
55

66
namespace webrtc_ros

webrtc_ros/src/webrtc_client.cpp

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
#include <webrtc_ros/ice_candidate_message.h>
66
//#include "talk/media/devices/devicemanager.h"
77
#include <webrtc/api/video/video_source_interface.h>
8-
#include <webrtc/rtc_base/bind.h>
98
#include <webrtc_ros/ros_video_capturer.h>
109
#include <webrtc_ros_msgs/srv/get_ice_servers.hpp>
1110

@@ -177,8 +176,7 @@ class MessageHandlerImpl : public MessageHandler {
177176
{
178177
WebrtcClientPtr _this = weak_this_.lock();
179178
if (_this)
180-
_this->signaling_thread_->Invoke<void>(RTC_FROM_HERE, rtc::Bind(&WebrtcClient::handle_message,
181-
_this.get(), type, raw));
179+
_this->signaling_thread_->BlockingCall([t = _this.get(), type, raw] { t->handle_message(type, raw); });
182180
}
183181
private:
184182
WebrtcClientWeakPtr weak_this_;
@@ -285,7 +283,7 @@ void WebrtcClient::handle_message(MessageHandler::Type type, const std::string&
285283

286284
rtc::scoped_refptr<webrtc::MediaStreamInterface> stream = peer_connection_factory_->CreateLocalMediaStream(stream_id);
287285

288-
if (!peer_connection_->AddStream(stream))
286+
if (!peer_connection_->AddStream(stream.get()))
289287
{
290288
RCLCPP_WARN(nh_->get_logger(), "Adding stream to PeerConnection failed");
291289
continue;
@@ -300,7 +298,7 @@ void WebrtcClient::handle_message(MessageHandler::Type type, const std::string&
300298
RCLCPP_WARN_STREAM(nh_->get_logger(), "Stream not found with id: " << stream_id);
301299
continue;
302300
}
303-
peer_connection_->RemoveStream(stream);
301+
peer_connection_->RemoveStream(stream.get());
304302
}
305303
else if(action.type == ConfigureAction::kAddVideoTrackActionName) {
306304
FIND_PROPERTY_OR_CONTINUE("stream_id", stream_id);
@@ -326,7 +324,7 @@ void WebrtcClient::handle_message(MessageHandler::Type type, const std::string&
326324
rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track(
327325
peer_connection_factory_->CreateVideoTrack(
328326
track_id,
329-
capturer));
327+
capturer.get()));
330328
stream->AddTrack(video_track);
331329
capturer->Start();
332330
}
@@ -356,10 +354,9 @@ void WebrtcClient::handle_message(MessageHandler::Type type, const std::string&
356354
if(audio_type == "local") {
357355
cricket::AudioOptions options;
358356
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track(
359-
peer_connection_factory_->CreateAudioTrack(
360-
track_id,
361-
peer_connection_factory_->CreateAudioSource(options)));
362-
stream->AddTrack(audio_track);
357+
peer_connection_factory_->CreateAudioTrack(track_id, peer_connection_factory_->CreateAudioSource(options).get())
358+
);
359+
stream->AddTrack(audio_track);
363360
}
364361
else {
365362
RCLCPP_WARN_STREAM(nh_->get_logger(), "Unknown video source type: " << audio_type);
@@ -416,7 +413,7 @@ void WebrtcClient::handle_message(MessageHandler::Type type, const std::string&
416413

417414
RCLCPP_DEBUG_STREAM(nh_->get_logger(), "Received remote description: " << message.sdp);
418415
rtc::scoped_refptr<DummySetSessionDescriptionObserver> dummy_set_description_observer(new rtc::RefCountedObject<DummySetSessionDescriptionObserver>());
419-
peer_connection_->SetRemoteDescription(dummy_set_description_observer, session_description);
416+
peer_connection_->SetRemoteDescription(dummy_set_description_observer.get(), session_description);
420417
}
421418
else if (IceCandidateMessage::isIceCandidate(message_json))
422419
{
@@ -465,7 +462,7 @@ void WebrtcClient::handle_message(MessageHandler::Type type, const std::string&
465462
void WebrtcClient::OnSessionDescriptionSuccess(webrtc::SessionDescriptionInterface* description)
466463
{
467464
rtc::scoped_refptr<DummySetSessionDescriptionObserver> dummy_set_description_observer(new rtc::RefCountedObject<DummySetSessionDescriptionObserver>());
468-
peer_connection_->SetLocalDescription(dummy_set_description_observer, description);
465+
peer_connection_->SetLocalDescription(dummy_set_description_observer.get(), description);
469466

470467
SdpMessage message;
471468
if (message.fromSessionDescription(*description))

webrtc_ros/src/webrtc_ros_server.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
#include <webrtc_ros/webrtc_ros_server.h>
33
#include "webrtc/rtc_base/ssl_adapter.h"
44

5-
#include "webrtc/rtc_base/bind.h"
6-
75
namespace webrtc_ros
86
{
97

108
MessageHandler* WebrtcRosServer_handle_new_signaling_channel(void* _this, SignalingChannel *channel)
119
{
12-
return ((WebrtcRosServer*) _this)->signaling_thread_->Invoke<MessageHandler*>(RTC_FROM_HERE, rtc::Bind(&WebrtcRosServer::handle_new_signaling_channel,
13-
(WebrtcRosServer*)_this, channel));
10+
MessageHandler* result;
11+
((WebrtcRosServer*) _this)->signaling_thread_->BlockingCall(
12+
[&]{ result = ((WebrtcRosServer*) _this)->handle_new_signaling_channel(channel);}
13+
);
14+
return result;
1415
}
1516

1617
WebrtcRosServer::WebrtcRosServer(rclcpp::Node::SharedPtr nh)

0 commit comments

Comments
 (0)