From 6de0679bb868915b67d2f4b1c17197190e88091f Mon Sep 17 00:00:00 2001 From: melpon Date: Sat, 25 Apr 2020 10:50:20 +0900 Subject: [PATCH 01/11] =?UTF-8?q?ubuntu-16.04=5Farmv7=5Fros=20=E3=81=AE?= =?UTF-8?q?=E3=83=93=E3=83=AB=E3=83=89=E3=82=92=E5=89=8A=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 - .github/workflows/daily_build.yml | 1 - CHANGES.md | 3 + CMakeLists.txt | 20 --- README.md | 3 - build/build.sh | 1 - build/ubuntu-16.04_armv7_ros/Dockerfile | 85 --------- .../rpi-xenial-ros.conf | 23 --- doc/BUILD_LINUX.md | 11 -- doc/PACKAGE.md | 1 - doc/USE.md | 1 - doc/USE_ARM_ROS.md | 164 ------------------ 12 files changed, 3 insertions(+), 312 deletions(-) delete mode 100644 build/ubuntu-16.04_armv7_ros/Dockerfile delete mode 100644 build/ubuntu-16.04_armv7_ros/rpi-xenial-ros.conf delete mode 100644 doc/USE_ARM_ROS.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eb639d8a..d354a97b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -77,7 +77,6 @@ jobs: name: - raspbian-buster_armv6 - raspbian-buster_armv7 - - ubuntu-16.04_armv7_ros - ubuntu-16.04_x86_64_ros - ubuntu-18.04_armv8_jetson_nano - ubuntu-18.04_x86_64 @@ -146,7 +145,6 @@ jobs: - macos - raspbian-buster_armv6 - raspbian-buster_armv7 - - ubuntu-16.04_armv7_ros - ubuntu-16.04_x86_64_ros - ubuntu-18.04_armv8_jetson_nano - ubuntu-18.04_x86_64 diff --git a/.github/workflows/daily_build.yml b/.github/workflows/daily_build.yml index ee2a0b30..f4de0731 100644 --- a/.github/workflows/daily_build.yml +++ b/.github/workflows/daily_build.yml @@ -30,7 +30,6 @@ jobs: name: - raspbian-buster_armv6 - raspbian-buster_armv7 - - ubuntu-16.04_armv7_ros - ubuntu-16.04_x86_64_ros - ubuntu-18.04_armv8_jetson_nano - ubuntu-18.04_x86_64 diff --git a/CHANGES.md b/CHANGES.md index b2346209..72d6998f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,9 @@ ## develop +- [CHANGE] ubuntu-16.04_armv7_ros ビルドを削除 + - @melpon + ## 2020.5.2 - [FIX] AV1 が利用できなかったのを修正する diff --git a/CMakeLists.txt b/CMakeLists.txt index 600c6b16..31d23756 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,26 +119,6 @@ elseif(MOMO_PACKAGE_NAME STREQUAL "raspbian-buster_armv7") list(APPEND CMAKE_PREFIX_PATH /root/rootfs/usr/lib/arm-linux-gnueabihf/cmake/SDL2) -elseif(MOMO_PACKAGE_NAME STREQUAL "ubuntu-16.04_armv7_ros") - - set(TARGET_OS "linux") - set(TARGET_OS_LINUX "ubuntu-16.04") - set(TARGET_ARCH "arm") - set(TARGET_ARCH_ARM "armv7") - set(USE_ROS ON) - set(USE_MMAL_ENCODER ON) - set(USE_H264 ON) - set(BOOST_ROOT_DIR /root/boost) - set(JSON_ROOT_DIR /root/json) - set(CLI11_ROOT_DIR /root/CLI11) - set(WEBRTC_INCLUDE_DIR /root/webrtc/include) - set(WEBRTC_LIBRARY_DIR /root/webrtc/lib) - set(WEBRTC_LIBRARY_NAME "webrtc_nolibcxx") - set(CLANG_ROOT /root/llvm/clang) - set(SYSROOT /root/rootfs) - - set(Boost_ARCHITECTURE 32) - elseif(MOMO_PACKAGE_NAME STREQUAL "ubuntu-18.04_armv8_jetson_nano") set(TARGET_OS "linux") diff --git a/README.md b/README.md index 0562cc31..85c41e2a 100644 --- a/README.md +++ b/README.md @@ -87,9 +87,6 @@ https://github.com/shiguredo/momo/releases - Ubuntu 16.04 x86_64 ROS Kinetic - http://wiki.ros.org/kinetic -- Ubuntu 16.04 ARMv7 ROS Kinetic - - 今後削除予定 - - Raspberry Pi 3 B+ ## 使ってみる diff --git a/build/build.sh b/build/build.sh index 32f9c446..eea3241b 100755 --- a/build/build.sh +++ b/build/build.sh @@ -11,7 +11,6 @@ _PACKAGES=" \ macos \ raspbian-buster_armv6 \ raspbian-buster_armv7 \ - ubuntu-16.04_armv7_ros \ ubuntu-16.04_x86_64_ros \ ubuntu-18.04_armv8_jetson_nano \ ubuntu-18.04_x86_64 \ diff --git a/build/ubuntu-16.04_armv7_ros/Dockerfile b/build/ubuntu-16.04_armv7_ros/Dockerfile deleted file mode 100644 index 6987ae1e..00000000 --- a/build/ubuntu-16.04_armv7_ros/Dockerfile +++ /dev/null @@ -1,85 +0,0 @@ -# syntax = docker/dockerfile:1.1.1-experimental -FROM ubuntu:16.04 - -ARG PACKAGE_NAME - -LABEL jp.shiguredo.momo=$PACKAGE_NAME - -RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache - -# パッケージのインストール - -COPY script/apt_install_arm.sh /root/ -RUN --mount=type=cache,id=$PACKAGE_NAME,target=/var/cache/apt --mount=type=cache,id=$PACKAGE_NAME,target=/var/lib/apt \ - /root/apt_install_arm.sh - -# RootFS の構築 - -COPY script/init_rootfs_armhf.sh /root/ -COPY rpi-xenial-ros.conf /root/ -RUN --mount=type=cache,id=$PACKAGE_NAME,target=/var/cache/apt --mount=type=cache,id=$PACKAGE_NAME,target=/var/lib/apt \ - /root/init_rootfs_armhf.sh /root/rootfs /root/rpi-xenial-ros.conf - -# WebRTC の取得 - -ARG WEBRTC_BUILD_VERSION - -COPY script/get_webrtc.sh /root/ -RUN /root/get_webrtc.sh "$WEBRTC_BUILD_VERSION" ubuntu-16.04_armv7 /root -# COPY webrtc/ /root/webrtc/ - -# コンパイラの取得 - -COPY script/get_llvm.sh /root/ -RUN /root/get_llvm.sh /root/webrtc /root - -# Boost のビルド - -ARG BOOST_VERSION - -COPY script/setup_boost.sh /root/ -RUN \ - set -ex \ - && /root/setup_boost.sh "$BOOST_VERSION" /root/boost-source \ - && cd /root/boost-source/source \ - && echo 'using clang : : /root/llvm/clang/bin/clang++ : ;' > project-config.jam \ - && ./b2 \ - cxxflags=' \ - --target=arm-linux-gnueabihf \ - --sysroot=/root/rootfs \ - -march=armv7-a \ - -mfloat-abi=hard \ - -mtune=generic-armv7-a \ - -mfpu=neon \ - -mthumb \ - ' \ - linkflags=' \ - ' \ - toolset=clang \ - visibility=global \ - target-os=linux \ - architecture=arm \ - address-model=32 \ - link=static \ - variant=release \ - install \ - -j`nproc` \ - --ignore-site-config \ - --prefix=/root/boost \ - --with-filesystem - -# nlohmann/json の取得 - -ARG JSON_VERSION -RUN git clone --branch v$JSON_VERSION --depth 1 https://github.com/nlohmann/json.git /root/json - -# CLI11 の取得 - -ARG CLI11_VERSION -RUN git clone --branch v$CLI11_VERSION --depth 1 https://github.com/CLIUtils/CLI11.git /root/CLI11 - -# CMake のインストール -ARG CMAKE_VERSION -COPY script/get_cmake.sh /root/ -RUN /root/get_cmake.sh "$CMAKE_VERSION" Linux /root -ENV PATH "/root/cmake/bin:$PATH" diff --git a/build/ubuntu-16.04_armv7_ros/rpi-xenial-ros.conf b/build/ubuntu-16.04_armv7_ros/rpi-xenial-ros.conf deleted file mode 100644 index cbc483a0..00000000 --- a/build/ubuntu-16.04_armv7_ros/rpi-xenial-ros.conf +++ /dev/null @@ -1,23 +0,0 @@ -[General] -unpack=true -bootstrap=Ports Rasp ROS -aptsources=Ports Rasp ROS - -[Ports] -packages=g++ libasound2-dev libpulse-dev libudev-dev libexpat1-dev libnss3-dev python-dev libgtk-3-dev libconsole-bridge0.2v5 libboost-all-dev libconsole-bridge-dev -source=http://ports.ubuntu.com -keyring=ubuntu-keyring -suite=xenial -components=main universe - -[Rasp] -packages=libraspberrypi-bin libraspberrypi-bin-nonfree libraspberrypi-dev -source=http://ppa.launchpad.net/ubuntu-raspi2/ppa/ubuntu -keyring=ubuntu-keyring -suite=xenial - -[ROS] -packages=ros-kinetic-sensor-msgs ros-kinetic-message-filters ros-kinetic-roscpp ros-kinetic-rosconsole ros-kinetic-roscpp-serialization ros-kinetic-rostime ros-kinetic-xmlrpcpp ros-kinetic-cpp-common ros-kinetic-audio-common -source=http://packages.ros.org/ros/ubuntu -keyring=ubuntu-keyring -suite=xenial \ No newline at end of file diff --git a/doc/BUILD_LINUX.md b/doc/BUILD_LINUX.md index 37eeee7c..b1857a99 100644 --- a/doc/BUILD_LINUX.md +++ b/doc/BUILD_LINUX.md @@ -58,17 +58,6 @@ $ ./build.sh ubuntu-18.04_x86_64 うまくいかない場合は `./build.sh --clean ubuntu-18.04_x86_64 && ./build.sh ubuntu-18.04_x86_64` を試してみてください。それでもだめな場合は Discord にお願いします。 -## Ubuntu 16.04 (armv7) 向け ROS 対応バイナリを作成する - -build ディレクトリ以下で ./build.sh ubuntu-16.04_armv7_ros と打つことで Momo の Ubuntu 16.04 armv7 ROS 向けバイナリが生成されます。 - -```shell -$ ./build.sh ubuntu-16.04_armv7_ros -``` - -うまくいかない場合は `./build.sh --clean ubuntu-16.04_armv7_ros && ./build.sh ubuntu-16.04_armv7_ros` を試してみてください。それでもだめな場合は Discord にお願いします。 - - ## Ubuntu 16.04 (x86_64) 向け ROS 対応バイナリを作成する build ディレクトリ以下で ./build.sh ubuntu-16.04_x86_64_ros と打つことで Momo の Ubuntu 16.04 x86_64 ROS 向けバイナリが生成されます。 diff --git a/doc/PACKAGE.md b/doc/PACKAGE.md index b67dabe7..bd332f81 100644 --- a/doc/PACKAGE.md +++ b/doc/PACKAGE.md @@ -24,7 +24,6 @@ Windows の場合は以下のコマンドになります。 - raspbian-buster_armv7 - ubuntu-18.04_armv8_jetson_nano - ubuntu-18.04_x86_64 -- ubuntu-16.04_armv7_ros - ubuntu-16.04_x86_64_ros ## パッケージ解凍後の構成 diff --git a/doc/USE.md b/doc/USE.md index d9f09e91..c4a01c12 100644 --- a/doc/USE.md +++ b/doc/USE.md @@ -55,7 +55,6 @@ Momo では SDL (Simple DirectMedia Layer) を利用して音声や映像を出 ### ROS ノードとして Momo を使ってみる - Momo を ROS ノードとして使ってみたい人は [USE_ROS.md](USE_ROS.md) をお読みください。 -- ARM 対応版の Momo を ROS ノードとして使ってみたい人は [USE_ARM_ROS.md](USE_ARM_ROS.md) をお読みください。 ## Q&A diff --git a/doc/USE_ARM_ROS.md b/doc/USE_ARM_ROS.md deleted file mode 100644 index fd35f450..00000000 --- a/doc/USE_ARM_ROS.md +++ /dev/null @@ -1,164 +0,0 @@ -# ARM ROS 版 Momo を使ってみる - -動作確認済み環境は下記の通り - -- Board: Raspberry Pi 3 Model B+ -- OS: Ubuntu 16.04 -- ROS: Kinetic - -検証にあたっては、こちらのブログを参考に環境を構築しました。謝意を表します。 -[RaspberryPi 3B+でUbuntu 16.04を起動させる方法](https://www.asrobot.me/entry/2018/07/11/001603/) - -## Momo の準備 - -### Momo のビルド - -[BUILD.md](./BUILD.md)を確認してUbuntu 16.04 (armv7) 向け ROS 対応パッケージを作成してください。 - -```shell -$ make ubuntu-16.04_armv7_ros.package -``` - -#### Raspberry Pi への配置 - -下記のような構成で Raspberry Pi 内にビルドした Momo を配置します。 - -``` -$ tree -. -├── html -│   ├── test.html -│   └── webrtc.js -└── ビルドした momo -``` - - -Momo のパッケージを https://github.com/shiguredo/momo/releases からダウンロードした場合は、パッケージを展開すると既に上記と同じ構成で配置されています。 - -``` -$ tree -. -├── html -│   ├── test.html -│   └── webrtc.js -├── LICENSE -├── momo -└── NOTICE -``` - - -#### ライブラリのインストール - -次のパッケージをイストールします。 - -``` -$ sudo apt -y install libnss3 libasound2 gstreamer1.0-alsa -``` - -また H264 ハードウェアエンコーダに対応するため、下記のリポジトリを追加し、パッケージをインストールします。 - -``` -$ sudo add-apt-repository ppa:ubuntu-raspi2/ppa -$ sudo apt-get update -$ sudo apt-get install libraspberrypi-bin libraspberrypi-dev -``` - -Raspberry Pi の場合はハードウェアエンコーダを利用することで、非常に少ない CPU 消費で配信を行うことが可能です。 - -## 実行する - -Momo を実行する前に下記のように rosrun を使用して Web カメラ、マイクを起動しておきます。 - -事前に、apt で ros-kinetic-usb-cam, ros-kinetic-audio-common をインストールした上で実行します。 - -``` -$ rosrun usb_cam usb_cam_node -``` - -Raspberry Pi の場合は非常にリソースが限られていますので、Image topic は無圧縮での利用をお勧めします。 - -``` -$ rosrun audio_capture audio_capture _format:=wave _channels=1 _same_rate:=16000 -``` - -### Test で動作を確認する - -- 実行例 - -```shell -$ ./momo _use_test:=true \ - _compressed:=false \ - image:=/usb_cam/image_raw \ - audio:=/audio \ - _audio_topic_ch:=1 \ - _audio_topic_rate:=16000 -``` - -http://[momo の IP アドレス]:8080/html/test.html にアクセスしてください。 - -image には Web カメラから送られてくる画像データの topic を指定してください。 -audio にはマイクから送られてくる音声データの topic を指定してください。 - -- 変更可能なパラメータ - - image - - topic - - _compressed - - JPEG 圧縮済みイメージ topic か [true,false] - - _test_port - - test モードで利用するポート番号 [0 - 65535] - - _sora_port - - sora モードで利用するポート番号 [-1 - 65535] - - -1 の場合は Listen しない - - _log_level - - ログレベル [0 - 5] - - audio - - audio topic - - _audio_topic_ch - - チャネル数 [1] - - _audio_topic_rate - - サンプリングレート - - -### WebRTC SFU Sora で動作を確認する - -**この機能を利用する場合は WebRTC SFU Sora のライセンス契約が必要です** - -```shell -$ ./momo _use_sora:=true \ - _compressed:=false \ - _SIGNALING_URL:="wss://example.com/signaling" \ - _CHANNEL_ID:="sora" \ - _video_codec:=H264 \ - _log_level:=5 \ - _video_bitrate:=300 \ - image:=/usb_cam/image_raw \ - audio:=/audio \ - _audio_topic_ch:=1 \ - _audio_topic_rate:=16000 -``` - -image には Web カメラから送られてくる画像データの topic を指定してください。 -audio にはマイクから送られてくる音声データの topic を指定してください。 - - -- 変更可能なパラメータ - - _SIGNALING_URL - - シグナリング URL - - _CHANNEL_ID - - チャネル ID - - image - - topic - - _compressed - - JPEG 圧縮済みイメージ topic か [true,false] - - _video_codec - - ビデオコーデック [H264,VP8,VP9] - - _video_bitrate - - ビデオビットレート [1 - 30000] - - _log_level - - ログレベル [0 - 5] - - audio - - audio topic - - _audio_topic_ch - - チャネル数 [1] - - _audio_topic_rate - - サンプリングレート From fea4abd6d80ceaaa533c747022629dc52f84dacb Mon Sep 17 00:00:00 2001 From: NAKAI Ryosuke Date: Sat, 25 Apr 2020 21:45:27 +0900 Subject: [PATCH 02/11] =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E3=82=92=E4=B8=8A=E3=81=92=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d5b8926a..0536ab5e 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ MOMO_VERSION=2020.5.2 -WEBRTC_BUILD_VERSION=84.4104.0.1 +WEBRTC_BUILD_VERSION=84.4125.0.1 BOOST_VERSION=1.72.0 JSON_VERSION=3.7.3 CLI11_VERSION=1.9.0 From ed878f0a0f20bad7e96b0d7161056970ead3b7b3 Mon Sep 17 00:00:00 2001 From: tnoho Date: Sat, 25 Apr 2020 14:24:49 +0000 Subject: [PATCH 03/11] =?UTF-8?q?Ayame=20=E3=81=AE=20type=20=E3=82=92=20te?= =?UTF-8?q?st=20=E3=81=AB=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/p2p/p2p_websocket_session.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/p2p/p2p_websocket_session.cpp b/src/p2p/p2p_websocket_session.cpp index f1e8b4dd..c973428b 100644 --- a/src/p2p/p2p_websocket_session.cpp +++ b/src/p2p/p2p_websocket_session.cpp @@ -131,8 +131,14 @@ void P2PWebsocketSession::onRead(boost::system::error_code ec, } std::shared_ptr rtc_conn = p2p_conn->getRTCConnection(); rtc_conn->addIceCandidate(sdp_mid, sdp_mlineindex, candidate); - } else if (type == "close") { + } else if (type == "close" || type == "bye") { connection_ = nullptr; + } else if (type == "register") { + json accept_message = { + {"type", "accept"}, + {"isExistUser", true}, + }; + ws_->sendText(accept_message.dump()); } else { return; } From 3768e4d4b5483f5798adf49f0e5df82fa333a00c Mon Sep 17 00:00:00 2001 From: NAKAI Ryosuke Date: Sat, 25 Apr 2020 23:33:16 +0900 Subject: [PATCH 04/11] =?UTF-8?q?Revert=20"=E3=83=90=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=82=92=E4=B8=8A=E3=81=92=E3=82=8B"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit fea4abd6d80ceaaa533c747022629dc52f84dacb. --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 0536ab5e..d5b8926a 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ MOMO_VERSION=2020.5.2 -WEBRTC_BUILD_VERSION=84.4125.0.1 +WEBRTC_BUILD_VERSION=84.4104.0.1 BOOST_VERSION=1.72.0 JSON_VERSION=3.7.3 CLI11_VERSION=1.9.0 From 35d7d68cc0c56db8f26108fc3c8b71449306a369 Mon Sep 17 00:00:00 2001 From: tnoho Date: Sat, 25 Apr 2020 15:02:32 +0000 Subject: [PATCH 05/11] =?UTF-8?q?Google=20STUN=20=E3=82=92=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=81=97=E3=81=AA=E3=81=84=E3=82=AA=E3=83=97=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ayame/ayame_websocket_client.cpp | 2 +- src/connection_settings.h | 3 +++ src/p2p/p2p_connection.cpp | 9 ++++++--- src/p2p/p2p_connection.h | 4 +++- src/p2p/p2p_websocket_session.cpp | 2 +- src/util.cpp | 4 ++++ 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/ayame/ayame_websocket_client.cpp b/src/ayame/ayame_websocket_client.cpp index e8c61c7a..ba8b7f11 100644 --- a/src/ayame/ayame_websocket_client.cpp +++ b/src/ayame/ayame_websocket_client.cpp @@ -283,7 +283,7 @@ void AyameWebsocketClient::setIceServersFromConfig(json json_message) { } } } - if (ice_servers_.empty()) { + if (ice_servers_.empty() && !conn_settings_.no_google_stun) { // accept 時に iceServers が返却されてこなかった場合 google の stun server を用いる webrtc::PeerConnectionInterface::IceServer ice_server; ice_server.uri = "stun:stun.l.google.com:19302"; diff --git a/src/connection_settings.h b/src/connection_settings.h index 4c15e552..27fd85ec 100644 --- a/src/connection_settings.h +++ b/src/connection_settings.h @@ -16,6 +16,7 @@ struct ConnectionSettings { int audio_topic_ch = 1; #endif + bool no_google_stun = false; bool no_video_device = false; bool no_audio_device = false; bool force_i420 = false; @@ -106,6 +107,8 @@ struct ConnectionSettings { friend std::ostream& operator<<(std::ostream& os, const ConnectionSettings& cs) { + os << "no_google_stun: " << (cs.no_google_stun ? "true" : "false") + << "\n"; os << "no_video_device: " << (cs.no_video_device ? "true" : "false") << "\n"; os << "no_audio_device: " << (cs.no_audio_device ? "true" : "false") diff --git a/src/p2p/p2p_connection.cpp b/src/p2p/p2p_connection.cpp index 05b7409c..4cd29fde 100644 --- a/src/p2p/p2p_connection.cpp +++ b/src/p2p/p2p_connection.cpp @@ -9,13 +9,16 @@ using json = nlohmann::json; using IceConnectionState = webrtc::PeerConnectionInterface::IceConnectionState; P2PConnection::P2PConnection(RTCManager* rtc_manager, + ConnectionSettings conn_settings, std::function send) : _send(send) { webrtc::PeerConnectionInterface::RTCConfiguration rtc_config; webrtc::PeerConnectionInterface::IceServers servers; - webrtc::PeerConnectionInterface::IceServer ice_server; - ice_server.uri = "stun:stun.l.google.com:19302"; - servers.push_back(ice_server); + if (!conn_settings.no_google_stun) { + webrtc::PeerConnectionInterface::IceServer ice_server; + ice_server.uri = "stun:stun.l.google.com:19302"; + servers.push_back(ice_server); + } rtc_config.servers = servers; _connection = rtc_manager->createConnection(rtc_config, this); } diff --git a/src/p2p/p2p_connection.h b/src/p2p/p2p_connection.h index df0d004e..9f50ce96 100644 --- a/src/p2p/p2p_connection.h +++ b/src/p2p/p2p_connection.h @@ -11,7 +11,9 @@ class P2PConnection : public RTCMessageSender { public: - P2PConnection(RTCManager* rtc_manager, std::function send); + P2PConnection(RTCManager* rtc_manager, + ConnectionSettings conn_settings, + std::function send); ~P2PConnection() {} webrtc::PeerConnectionInterface::IceConnectionState getRTCConnectionState() { diff --git a/src/p2p/p2p_websocket_session.cpp b/src/p2p/p2p_websocket_session.cpp index c973428b..59737c4b 100644 --- a/src/p2p/p2p_websocket_session.cpp +++ b/src/p2p/p2p_websocket_session.cpp @@ -98,7 +98,7 @@ void P2PWebsocketSession::onRead(boost::system::error_code ec, auto send = std::bind([](P2PWebsocketSession* session, std::string str) { session->ws_->sendText(str); }, this, std::placeholders::_1); - connection_ = std::make_shared(rtc_manager_, send); + connection_ = std::make_shared(rtc_manager_, conn_settings_, send); std::shared_ptr rtc_conn = connection_->getRTCConnection(); rtc_conn->setOffer(sdp); } else if (type == "answer") { diff --git a/src/util.cpp b/src/util.cpp index 750aab4f..9aa235e2 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -54,6 +54,8 @@ void Util::parseArgs(int argc, local_nh.param("use_ayame", use_ayame, use_ayame); local_nh.param("use_sora", use_sora, use_sora); + local_nh.param("no_google_stun", cs.no_google_stun, + cs.no_google_stun); local_nh.param("no_video_device", cs.no_video_device, cs.no_video_device); local_nh.param("no_audio_device", cs.no_audio_device, @@ -206,6 +208,8 @@ void Util::parseArgs(int argc, }, ""); + app.add_flag("--no-google-stun", cs.no_google_stun, + "Do not use google stun"); app.add_flag("--no-video-device", cs.no_video_device, "Do not use video device"); app.add_flag("--no-audio-device", cs.no_audio_device, From dd15cf29d11e3992a68854ba0fe6561c49f608c6 Mon Sep 17 00:00:00 2001 From: tnoho Date: Sat, 25 Apr 2020 16:34:21 +0000 Subject: [PATCH 06/11] =?UTF-8?q?ping=20=E3=82=92=E9=80=81=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/p2p/p2p_server.cpp | 5 +++-- src/p2p/p2p_server.h | 1 + src/p2p/p2p_session.cpp | 8 +++++--- src/p2p/p2p_session.h | 4 +++- src/p2p/p2p_websocket_session.cpp | 21 +++++++++++++++++---- src/p2p/p2p_websocket_session.h | 8 +++++++- 6 files changed, 36 insertions(+), 11 deletions(-) diff --git a/src/p2p/p2p_server.cpp b/src/p2p/p2p_server.cpp index 3d23017f..1b7337e5 100644 --- a/src/p2p/p2p_server.cpp +++ b/src/p2p/p2p_server.cpp @@ -8,7 +8,8 @@ P2PServer::P2PServer(boost::asio::io_context& ioc, std::shared_ptr const& doc_root, RTCManager* rtc_manager, ConnectionSettings conn_settings) - : acceptor_(ioc), + : ioc_(ioc), + acceptor_(ioc), socket_(ioc), doc_root_(doc_root), rtc_manager_(rtc_manager), @@ -60,7 +61,7 @@ void P2PServer::onAccept(boost::system::error_code ec) { if (ec) { MOMO_BOOST_ERROR(ec, "accept"); } else { - std::make_shared(std::move(socket_), doc_root_, rtc_manager_, + std::make_shared(ioc_, std::move(socket_), doc_root_, rtc_manager_, conn_settings_) ->run(); } diff --git a/src/p2p/p2p_server.h b/src/p2p/p2p_server.h index 9556ed4a..d1165607 100644 --- a/src/p2p/p2p_server.h +++ b/src/p2p/p2p_server.h @@ -12,6 +12,7 @@ #include "util.h" class P2PServer : public std::enable_shared_from_this { + boost::asio::io_context& ioc_; boost::asio::ip::tcp::acceptor acceptor_; boost::asio::ip::tcp::socket socket_; std::shared_ptr doc_root_; diff --git a/src/p2p/p2p_session.cpp b/src/p2p/p2p_session.cpp index 974fac45..fb17452d 100644 --- a/src/p2p/p2p_session.cpp +++ b/src/p2p/p2p_session.cpp @@ -15,11 +15,13 @@ #include "util.h" -P2PSession::P2PSession(boost::asio::ip::tcp::socket socket, +P2PSession::P2PSession(boost::asio::io_context& ioc, + boost::asio::ip::tcp::socket socket, std::shared_ptr const& doc_root, RTCManager* rtc_manager, ConnectionSettings conn_settings) - : socket_(std::move(socket)), + : ioc_(ioc), + socket_(std::move(socket)), strand_(socket_.get_executor()), doc_root_(doc_root), rtc_manager_(rtc_manager), @@ -57,7 +59,7 @@ void P2PSession::onRead(boost::system::error_code ec, // WebSocket の upgrade リクエスト if (req_.target() == "/ws") { if (boost::beast::websocket::is_upgrade(req_)) { - P2PWebsocketSession::make_shared(std::move(socket_), rtc_manager_, + P2PWebsocketSession::make_shared(ioc_, std::move(socket_), rtc_manager_, conn_settings_) ->run(std::move(req_)); return; diff --git a/src/p2p/p2p_session.h b/src/p2p/p2p_session.h index 16e7e153..fcf2fc42 100644 --- a/src/p2p/p2p_session.h +++ b/src/p2p/p2p_session.h @@ -20,6 +20,7 @@ // 1つの HTTP リクエストを処理するためのクラス class P2PSession : public std::enable_shared_from_this { + boost::asio::io_context& ioc_; boost::asio::ip::tcp::socket socket_; boost::asio::strand strand_; boost::beast::flat_buffer buffer_; @@ -31,7 +32,8 @@ class P2PSession : public std::enable_shared_from_this { ConnectionSettings conn_settings_; public: - P2PSession(boost::asio::ip::tcp::socket socket, + P2PSession(boost::asio::io_context& ioc, + boost::asio::ip::tcp::socket socket, std::shared_ptr const& doc_root, RTCManager* rtc_manager, ConnectionSettings conn_settings); diff --git a/src/p2p/p2p_websocket_session.cpp b/src/p2p/p2p_websocket_session.cpp index 59737c4b..6e785143 100644 --- a/src/p2p/p2p_websocket_session.cpp +++ b/src/p2p/p2p_websocket_session.cpp @@ -9,9 +9,12 @@ using json = nlohmann::json; -P2PWebsocketSession::P2PWebsocketSession(RTCManager* rtc_manager, +P2PWebsocketSession::P2PWebsocketSession(boost::asio::io_context& ioc, + RTCManager* rtc_manager, ConnectionSettings conn_settings) - : rtc_manager_(rtc_manager), conn_settings_(conn_settings) { + : rtc_manager_(rtc_manager), conn_settings_(conn_settings), + watchdog_(ioc, + std::bind(&P2PWebsocketSession::onWatchdogExpired, this)) { RTC_LOG(LS_INFO) << __FUNCTION__; } @@ -20,10 +23,11 @@ P2PWebsocketSession::~P2PWebsocketSession() { } std::shared_ptr P2PWebsocketSession::make_shared( + boost::asio::io_context& ioc, boost::asio::ip::tcp::socket socket, RTCManager* rtc_manager, ConnectionSettings conn_settings) { - auto p = std::make_shared(rtc_manager, conn_settings); + auto p = std::make_shared(ioc, rtc_manager, conn_settings); p->ws_ = std::unique_ptr(new Websocket(std::move(socket))); return p; } @@ -34,6 +38,14 @@ void P2PWebsocketSession::run( doAccept(std::move(req)); } +void P2PWebsocketSession::onWatchdogExpired() { + json ping_message = { + {"type", "ping"}, + }; + ws_->sendText(std::move(ping_message.dump())); + watchdog_.reset(); +} + void P2PWebsocketSession::doAccept( boost::beast::http::request req) { RTC_LOG(LS_INFO) << __FUNCTION__; @@ -138,7 +150,8 @@ void P2PWebsocketSession::onRead(boost::system::error_code ec, {"type", "accept"}, {"isExistUser", true}, }; - ws_->sendText(accept_message.dump()); + ws_->sendText(std::move(accept_message.dump())); + watchdog_.enable(30); } else { return; } diff --git a/src/p2p/p2p_websocket_session.h b/src/p2p/p2p_websocket_session.h index 9f11c13a..d57fdce2 100644 --- a/src/p2p/p2p_websocket_session.h +++ b/src/p2p/p2p_websocket_session.h @@ -14,6 +14,7 @@ #include "p2p_connection.h" #include "rtc/manager.h" #include "util.h" +#include "watchdog.h" #include "ws/websocket.h" class P2PWebsocketSession @@ -21,21 +22,26 @@ class P2PWebsocketSession std::unique_ptr ws_; boost::beast::multi_buffer sending_buffer_; + WatchDog watchdog_; + RTCManager* rtc_manager_; ConnectionSettings conn_settings_; std::shared_ptr connection_; public: - P2PWebsocketSession(RTCManager* rtc_manager, + P2PWebsocketSession(boost::asio::io_context& ioc, + RTCManager* rtc_manager, ConnectionSettings conn_settings); ~P2PWebsocketSession(); static std::shared_ptr make_shared( + boost::asio::io_context& ioc, boost::asio::ip::tcp::socket socket, RTCManager* rtc_manager, ConnectionSettings conn_settings); void run(boost::beast::http::request req); private: + void onWatchdogExpired(); void doAccept( boost::beast::http::request req); void onAccept(boost::system::error_code ec); From 5b60302f2676232836c253a7c46009c76c3ab9dc Mon Sep 17 00:00:00 2001 From: tnoho Date: Sun, 26 Apr 2020 04:01:05 +0000 Subject: [PATCH 07/11] =?UTF-8?q?=E5=86=8D=E6=8E=A5=E7=B6=9A=E3=81=AE?= =?UTF-8?q?=E3=82=A4=E3=83=B3=E3=82=BF=E3=83=BC=E3=83=90=E3=83=AB=E4=B8=8A?= =?UTF-8?q?=E9=99=90=E3=82=9230=E7=A7=92=E3=81=A8=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ayame/ayame_websocket_client.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/ayame/ayame_websocket_client.cpp b/src/ayame/ayame_websocket_client.cpp index ba8b7f11..5863b20b 100644 --- a/src/ayame/ayame_websocket_client.cpp +++ b/src/ayame/ayame_websocket_client.cpp @@ -140,6 +140,9 @@ bool AyameWebsocketClient::connect() { void AyameWebsocketClient::reconnectAfter() { int interval = 5 * (2 * retry_count_); + if (interval > 30) { + interval = 30; + } RTC_LOG(LS_INFO) << __FUNCTION__ << " reconnect after " << interval << " sec"; watchdog_.enable(interval); From 4e5dac7c69f1441e8ab57f3ac365f73aa64b0717 Mon Sep 17 00:00:00 2001 From: tnoho Date: Sun, 26 Apr 2020 14:19:46 +0900 Subject: [PATCH 08/11] =?UTF-8?q?=E5=A4=89=E6=9B=B4=E5=B1=A5=E6=AD=B4?= =?UTF-8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 72d6998f..113a85b9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,8 @@ ## develop +- [ADD] test モードの Momo と Ayame モードの Momo の相互接続を可能とする + - @tnoho - [CHANGE] ubuntu-16.04_armv7_ros ビルドを削除 - @melpon From 16a5895013f2dc1658d7d8bc3ba0e501cb2fc8bd Mon Sep 17 00:00:00 2001 From: NAKAI Ryosuke Date: Sun, 26 Apr 2020 22:40:02 +0900 Subject: [PATCH 09/11] =?UTF-8?q?2020.6=20=E3=81=AB=E4=B8=8A=E3=81=92?= =?UTF-8?q?=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index d5b8926a..21d19c34 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ -MOMO_VERSION=2020.5.2 +MOMO_VERSION=2020.6.0 WEBRTC_BUILD_VERSION=84.4104.0.1 BOOST_VERSION=1.72.0 JSON_VERSION=3.7.3 From 536205edc013c64a49fbe57463a03a7fd0ace79f Mon Sep 17 00:00:00 2001 From: NAKAI Ryosuke Date: Mon, 27 Apr 2020 18:05:54 +0900 Subject: [PATCH 10/11] =?UTF-8?q?=E5=A4=89=E6=9B=B4=E5=B1=A5=E6=AD=B4?= =?UTF-8?q?=E3=82=92=E6=9B=B4=E6=96=B0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 4 ++++ VERSION | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 113a85b9..2eeeaca1 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,10 @@ ## develop +## 2020.6 + +- [UPDATE] `libwebrtc` を `M84.4127@{#0}` に上げる + - @voluntas - [ADD] test モードの Momo と Ayame モードの Momo の相互接続を可能とする - @tnoho - [CHANGE] ubuntu-16.04_armv7_ros ビルドを削除 diff --git a/VERSION b/VERSION index 21d19c34..7f7b5993 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ MOMO_VERSION=2020.6.0 -WEBRTC_BUILD_VERSION=84.4104.0.1 +WEBRTC_BUILD_VERSION=84.4127.0.1 BOOST_VERSION=1.72.0 JSON_VERSION=3.7.3 CLI11_VERSION=1.9.0 From 600a644f3829e31fc6dfff9cbaf48fd52735e5fe Mon Sep 17 00:00:00 2001 From: NAKAI Ryosuke Date: Mon, 27 Apr 2020 18:15:58 +0900 Subject: [PATCH 11/11] =?UTF-8?q?.0=20=E3=81=AF=E6=B6=88=E3=81=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 7f7b5993..6772da1a 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ -MOMO_VERSION=2020.6.0 +MOMO_VERSION=2020.6 WEBRTC_BUILD_VERSION=84.4127.0.1 BOOST_VERSION=1.72.0 JSON_VERSION=3.7.3