diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..44d89841 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "github-actions" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e06be7af..4ff288c7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,14 +9,18 @@ on: - 'THANKS' - 'LICENSE' - 'NOTICE' - pull_request: jobs: build-windows: - name: Build momo for Windows - runs-on: windows-latest + strategy: + fail-fast: false + matrix: + arch: + - x86_64 + name: Build momo for Windows_${{ matrix.arch }} + runs-on: windows-2019 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get Versions run: | Get-Content "VERSION" | Foreach-Object { @@ -44,9 +48,9 @@ jobs: } $WINVER_MAJOR = [System.Environment]::OSVersion.Version.Major $RELEASE_ID = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseID - echo "PACKAGE_NAME=momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}.zip" >> windows.env - echo "CONTENT_TYPE=application/zip" >> windows.env - echo "::set-output name=name::momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}.zip" + echo "PACKAGE_NAME=momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${{ matrix.arch }}.zip" >> windows_${{ matrix.arch }}.env + echo "CONTENT_TYPE=application/zip" >> windows_${{ matrix.arch }}.env + echo "::set-output name=name::momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${{ matrix.arch }}.zip" id: package_name - name: Upload Artifact uses: actions/upload-artifact@v2 @@ -56,8 +60,8 @@ jobs: - name: Upload Environment uses: actions/upload-artifact@v2 with: - name: windows.env - path: windows.env + name: windows_${{ matrix.arch }}.env + path: windows_${{ matrix.arch }}.env build-macos: strategy: fail-fast: false @@ -68,7 +72,7 @@ jobs: name: Build momo for macOS_${{ matrix.arch }} runs-on: macos-11.0 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get Versions run: | source VERSION @@ -117,7 +121,7 @@ jobs: name: Build momo for ${{ matrix.name }} runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get Versions run: | source VERSION @@ -161,7 +165,7 @@ jobs: steps: - name: Create Release id: create_release - uses: actions/create-release@v1.0.0 + uses: actions/create-release@v1.1.4 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -186,7 +190,7 @@ jobs: fail-fast: true matrix: name: - - windows + - windows_x86_64 - macos_arm64 - macos_x86_64 - raspberry-pi-os_armv6 @@ -219,7 +223,7 @@ jobs: name: ${{ steps.env.outputs.package_name }} path: ${{ steps.env.outputs.package_name }} - name: Upload ${{ matrix.name }} Release Asset - uses: actions/upload-release-asset@v1.0.1 + uses: actions/upload-release-asset@v1.0.2 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: @@ -238,7 +242,7 @@ jobs: - upload-assets if: always() steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: rtCamp/action-slack-notify@v2 if: | needs.build-windows.result == 'failure' || diff --git a/.github/workflows/daily_build.yml b/.github/workflows/daily_build.yml index cecbc99c..1586be1d 100644 --- a/.github/workflows/daily_build.yml +++ b/.github/workflows/daily_build.yml @@ -8,10 +8,15 @@ on: jobs: build-windows: - name: Build momo for Windows - runs-on: windows-latest + strategy: + fail-fast: false + matrix: + arch: + - x86_64 + name: Build momo for Windows_${{ matrix.arch }} + runs-on: windows-2019 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get Versions run: | Get-Content "VERSION" | Foreach-Object { @@ -40,7 +45,7 @@ jobs: name: Build momo for macOS_${{ matrix.arch }} runs-on: macos-11.0 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get Versions run: | source VERSION @@ -70,7 +75,7 @@ jobs: name: Build momo for ${{ matrix.name }} runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get Versions run: | source VERSION @@ -94,7 +99,7 @@ jobs: - build-linux if: always() steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: rtCamp/action-slack-notify@v2 if: | needs.build-windows.result == 'failure' || diff --git a/.gitignore b/.gitignore index 87540517..172d049f 100644 --- a/.gitignore +++ b/.gitignore @@ -41,9 +41,9 @@ webrtc_logs_0 /_build /_package -/build/windows/_source -/build/windows/_build -/build/windows/_install +/build/windows_*/_source +/build/windows_*/_build +/build/windows_*/_install /build/macos_*/_source /build/macos_*/_build /build/macos_*/_install diff --git a/CHANGES.md b/CHANGES.md index 82e8b7c5..60be6043 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,25 @@ ## develop +## 2022.1.0 + +- [UPDATE] Raspberry Pi OS bullseye に対応 + - @tnoho +- [UPDATE] JetPack 4.6 に上げる + - @tnoho +- [UPDATE] `libwebrtc` を `99.4844.1.0` に上げる + - @tnoho +- [UPDATE] sdl2 を 2.0.20 に上げる + - @voluntas +- [UPDATE] cmake を 3.22.3 に上げる + - @voluntas +- [ADD] DataChannel を使うことになっていて Offer を行う際には DataChannel を作るように変更 + - @tnoho +- [FIX] Jetson のハードウェアデコーダーが出力時に出力サイズでフレームを切り抜いていなかったため修正 + - @tnoho +- [FIX] スクリーンキャプチャが Linux で落ちるのを修正 + - @tnoho + ## 2021.6.0 - [UPDATE] Boost 1.78.0 に上げる diff --git a/CMakeLists.txt b/CMakeLists.txt index 682d85f2..9579de2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,8 +34,8 @@ set(WEBRTC_BUILD_VERSION "unspecified" CACHE STRING "webrtc-build のバージ set(WEBRTC_READABLE_VERSION "unspecified" CACHE STRING "WebRTC の読みやすいバージョン") set(WEBRTC_COMMIT "" CACHE STRING "WebRTC のコミットハッシュ") -if(MOMO_PACKAGE_NAME STREQUAL "windows") - set(_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/windows/_install) +if(MOMO_PACKAGE_NAME STREQUAL "windows_x86_64") + set(_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/build/windows_x86_64/_install) set(TARGET_OS "windows") set(TARGET_ARCH "x86_64") @@ -350,7 +350,7 @@ target_sources(momo target_include_directories(momo PRIVATE src) -set_target_properties(momo PROPERTIES CXX_STANDARD 14 C_STANDARD 99) +set_target_properties(momo PROPERTIES CXX_STANDARD 17 C_STANDARD 99) target_link_libraries(momo PRIVATE @@ -362,6 +362,9 @@ target_link_libraries(momo target_compile_definitions(momo PRIVATE + # CLI11 は C++17 でのビルドにおいて std::filesystem を利用するが、これを clang で解決するには c++fs のリンクが必要になる。 + # しかし、 libwebrtc の libc++ では std::filesystem が提供されていないため下記のオプションを追加して利用しないようにする。 + CLI11_HAS_FILESYSTEM=0 OPENSSL_IS_BORINGSSL USE_NVCODEC_ENCODER=$ USE_MMAL_ENCODER=$ @@ -382,16 +385,24 @@ if (USE_SDL2) _THREAD_SAFE ) - if (TARGET SDL2::SDL2-static) + + if ("${TARGET_OS}" STREQUAL "windows" OR "${TARGET_OS}" STREQUAL "macos") target_link_libraries(momo PRIVATE SDL2::SDL2-static SDL2::SDL2main ) else() - target_link_directories(momo PRIVATE ${SDL2_LIBDIR}) - target_link_libraries(momo PRIVATE SDL2) - target_include_directories(momo PRIVATE "${SYSROOT}${SDL2_INCLUDE_DIRS}") + if (TARGET SDL2::SDL2Config) + target_link_libraries(momo + PRIVATE + SDL2::SDL2Config + ) + else() + target_link_directories(momo PRIVATE ${SDL2_LIBDIR}) + target_link_libraries(momo PRIVATE SDL2) + target_include_directories(momo PRIVATE "${SYSROOT}${SDL2_INCLUDE_DIRS}") + endif() endif() if ("${TARGET_OS}" STREQUAL "macos") @@ -703,8 +714,8 @@ elseif (TARGET_OS STREQUAL "linux") target_link_directories(momo PRIVATE ${_VC_PATH}/lib) target_link_libraries(momo PRIVATE - brcmGLESv2 - brcmEGL + GLESv2 + EGL bcm_host containers vcos diff --git a/README.md b/README.md index d6b3acd0..92b3901b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # WebRTC Native Client Momo -[![libwebrtc](https://img.shields.io/badge/libwebrtc-m9.4692-blue.svg)](https://chromium.googlesource.com/external/webrtc/+/branch-heads/4692) +[![libwebrtc](https://img.shields.io/badge/libwebrtc-m99.4844-blue.svg)](https://chromium.googlesource.com/external/webrtc/+/branch-heads/4844) [![GitHub tag (latest SemVer)](https://img.shields.io/github/tag/shiguredo/momo.svg)](https://github.com/shiguredo/momo) [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) [![Actions Status](https://github.com/shiguredo/momo/workflows/daily-build-workflow/badge.svg)](https://github.com/shiguredo/momo/actions) diff --git a/VERSION b/VERSION index b4b83e3a..d5d1ad99 100644 --- a/VERSION +++ b/VERSION @@ -1,7 +1,7 @@ -MOMO_VERSION=2021.6.0 -WEBRTC_BUILD_VERSION=97.4692.0.4 +MOMO_VERSION=2022.1.0 +WEBRTC_BUILD_VERSION=99.4844.1.0 BOOST_VERSION=1.78.0 CLI11_VERSION=2.1.2 -SDL2_VERSION=2.0.18 -CMAKE_VERSION=3.22.1 +SDL2_VERSION=2.0.20 +CMAKE_VERSION=3.22.3 CUDA_VERSION=11.0.2-1 diff --git a/build/build.ps1 b/build/build.ps1 index eedac0eb..08f88277 100644 --- a/build/build.ps1 +++ b/build/build.ps1 @@ -1,28 +1,30 @@ Param([switch]$clean, [switch]$package) +$WINDOWS_ARCH = "x86_64" + $ErrorActionPreference = 'Stop' if ($clean) { - if (Test-Path "windows\_source") { - Remove-Item "windows\_source" -Force -Recurse + if (Test-Path "windows_${WINDOWS_ARCH}\_source") { + Remove-Item "windows_${WINDOWS_ARCH}\_source" -Force -Recurse } - if (Test-Path "windows\_build") { - Remove-Item "windows\_build" -Force -Recurse + if (Test-Path "windows_${WINDOWS_ARCH}\_build") { + Remove-Item "windows_${WINDOWS_ARCH}\_build" -Force -Recurse } - if (Test-Path "windows\_install") { - Remove-Item "windows\_install" -Force -Recurse + if (Test-Path "windows_${WINDOWS_ARCH}\_install") { + Remove-Item "windows_${WINDOWS_ARCH}\_install" -Force -Recurse } - if (Test-Path "..\_build\windows") { - Remove-Item "..\_build\windows" -Force -Recurse + if (Test-Path "..\_build\windows_${WINDOWS_ARCH}") { + Remove-Item "..\_build\windows_${WINDOWS_ARCH}" -Force -Recurse } exit 0 } -Push-Location windows +Push-Location "windows_${WINDOWS_ARCH}" .\install_deps.ps1 Pop-Location -$WEBRTC_VERSION_FILE = Join-Path (Resolve-Path ".").Path "windows\_install\webrtc\VERSIONS" +$WEBRTC_VERSION_FILE = Join-Path (Resolve-Path ".").Path "windows_${WINDOWS_ARCH}\_install\webrtc\VERSIONS" Get-Content $WEBRTC_VERSION_FILE | Foreach-Object { if (!$_) { continue @@ -41,10 +43,10 @@ Get-Content $MOMO_VERSION_FILE | Foreach-Object { $MOMO_COMMIT = "$(git rev-parse HEAD)" -mkdir ..\_build\windows -Force -ErrorAction Ignore -Push-Location ..\_build\windows +mkdir "..\_build\windows_${WINDOWS_ARCH}" -Force -ErrorAction Ignore +Push-Location "..\_build\windows_${WINDOWS_ARCH}" cmake ..\.. -G "Visual Studio 16 2019" ` - -DMOMO_PACKAGE_NAME="windows" ` + -DMOMO_PACKAGE_NAME="windows_${WINDOWS_ARCH}" ` -DMOMO_VERSION="$MOMO_VERSION" ` -DMOMO_COMMIT="$MOMO_COMMIT" ` -DWEBRTC_BUILD_VERSION="$WEBRTC_BUILD_VERSION" ` @@ -58,20 +60,20 @@ if ($package) { Push-Location .. $WINVER_MAJOR = [System.Environment]::OSVersion.Version.Major $RELEASE_ID = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId).ReleaseID - if (Test-Path "_package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}.zip") { - Remove-Item "_package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}.zip" -Force + if (Test-Path "_package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${WINDOWS_ARCH}.zip") { + Remove-Item "_package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${WINDOWS_ARCH}.zip" -Force } - if (Test-Path "_package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}") { - Remove-Item "_package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}" -Force -Recurse + if (Test-Path "_package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${WINDOWS_ARCH}") { + Remove-Item "_package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${WINDOWS_ARCH}" -Force -Recurse } - mkdir -Force "_package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}" - Copy-Item _build\windows\Release\momo.exe _package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}\ - Copy-Item LICENSE _package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}\ - Copy-Item NOTICE _package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}\ - Copy-Item html _package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}\html\ -Recurse + mkdir -Force "_package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${WINDOWS_ARCH}" + Copy-Item _build\windows_${WINDOWS_ARCH}\Release\momo.exe _package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${WINDOWS_ARCH}\ + Copy-Item LICENSE _package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${WINDOWS_ARCH}\ + Copy-Item NOTICE _package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${WINDOWS_ARCH}\ + Copy-Item html _package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${WINDOWS_ARCH}\html\ -Recurse Push-Location _package - Compress-Archive -Path "momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}" -DestinationPath "momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}.zip" + Compress-Archive -Path "momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${WINDOWS_ARCH}" -DestinationPath "momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${WINDOWS_ARCH}.zip" Pop-Location - Remove-Item "_package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}" -Force -Recurse + Remove-Item "_package\momo-${MOMO_VERSION}_windows-${WINVER_MAJOR}.${RELEASE_ID}_${WINDOWS_ARCH}" -Force -Recurse Pop-Location } \ No newline at end of file diff --git a/build/build.sh b/build/build.sh index f97938a6..05ea099e 100755 --- a/build/build.sh +++ b/build/build.sh @@ -90,7 +90,7 @@ popd source ../VERSION case "$PACKAGE" in - "windows" ) + "windows_x86_64" ) echo "Windows では build.bat を利用してください。" exit 1 ;; diff --git a/build/macos_arm64/install_deps.sh b/build/macos_arm64/install_deps.sh index 15bdc54a..ec86b678 100755 --- a/build/macos_arm64/install_deps.sh +++ b/build/macos_arm64/install_deps.sh @@ -75,6 +75,7 @@ if [ $BOOST_CHANGED -eq 1 -o ! -e $INSTALL_DIR/boost/lib/libboost_filesystem.a ] echo "using clang : : $INSTALL_DIR/llvm/clang/bin/clang++ : ;" > project-config.jam SYSROOT="`xcrun --sdk macosx --show-sdk-path`" ./b2 \ + cxxstd=17 \ cflags=" \ -target $ARCH_NAME \ -mmacosx-version-min=11.0 \ diff --git a/build/macos_x86_64/install_deps.sh b/build/macos_x86_64/install_deps.sh index 19ca9b53..d0450326 100755 --- a/build/macos_x86_64/install_deps.sh +++ b/build/macos_x86_64/install_deps.sh @@ -79,6 +79,7 @@ if [ $BOOST_CHANGED -eq 1 -o ! -e $INSTALL_DIR/boost/lib/libboost_filesystem.a ] echo "using clang : : $INSTALL_DIR/llvm/clang/bin/clang++ : ;" > project-config.jam SYSROOT="`xcrun --sdk macosx --show-sdk-path`" ./b2 \ + cxxstd=17 \ cflags=" \ --sysroot=$SYSROOT \ " \ diff --git a/build/raspberry-pi-os_armv6/Dockerfile b/build/raspberry-pi-os_armv6/Dockerfile index 18dda6fa..b924bace 100644 --- a/build/raspberry-pi-os_armv6/Dockerfile +++ b/build/raspberry-pi-os_armv6/Dockerfile @@ -44,6 +44,7 @@ RUN \ && cd /root/boost-source/source \ && echo 'using clang : : /root/llvm/clang/bin/clang++ : ;' > project-config.jam \ && ./b2 \ + cxxstd=17 \ cxxflags=' \ -D_LIBCPP_ABI_UNSTABLE \ -D_LIBCPP_DISABLE_AVAILABILITY \ diff --git a/build/raspberry-pi-os_armv6/rpi-raspbian.conf b/build/raspberry-pi-os_armv6/rpi-raspbian.conf index 51cf74bf..5259673c 100644 --- a/build/raspberry-pi-os_armv6/rpi-raspbian.conf +++ b/build/raspberry-pi-os_armv6/rpi-raspbian.conf @@ -4,19 +4,16 @@ bootstrap=Ports Ports2 Rasp aptsources=Ports Ports2 Rasp [Ports] -packages=libc6-dev libstdc++-6-dev libasound2-dev libpulse-dev libudev-dev libexpat1-dev libnss3-dev python-dev libgtk-3-dev libsdl2-dev +packages=libc6-dev libstdc++-10-dev libasound2-dev libpulse-dev libudev-dev libexpat1-dev libnss3-dev libgtk-3-dev libsdl2-dev source=http://ftp.jaist.ac.jp/raspbian -keyring=raspbian-archive-keyring -suite=buster +suite=bullseye [Ports2] -packages=libc6-dev libstdc++-6-dev libasound2-dev libpulse-dev libudev-dev libexpat1-dev libnss3-dev python-dev libgtk-3-dev libsdl2-dev +packages=libc6-dev libstdc++-10-dev libasound2-dev libpulse-dev libudev-dev libexpat1-dev libnss3-dev libgtk-3-dev libsdl2-dev source=http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian -keyring=raspbian-archive-keyring -suite=buster +suite=bullseye [Rasp] packages=libraspberrypi-bin libraspberrypi-dev source=http://archive.raspberrypi.org/debian -keyring=raspbian-archive-keyring -suite=buster +suite=bullseye diff --git a/build/raspberry-pi-os_armv7/Dockerfile b/build/raspberry-pi-os_armv7/Dockerfile index ca687747..6f866e04 100644 --- a/build/raspberry-pi-os_armv7/Dockerfile +++ b/build/raspberry-pi-os_armv7/Dockerfile @@ -44,6 +44,7 @@ RUN \ && cd /root/boost-source/source \ && echo 'using clang : : /root/llvm/clang/bin/clang++ : ;' > project-config.jam \ && ./b2 \ + cxxstd=17 \ cxxflags=' \ -D_LIBCPP_ABI_UNSTABLE \ -D_LIBCPP_DISABLE_AVAILABILITY \ @@ -107,7 +108,8 @@ RUN \ -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=BOTH \ -DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=BOTH \ -DCMAKE_SYSROOT=/root/rootfs \ - -DBUILD_SHARED_LIBS=OFF \ + -DSDL_STATIC=ON \ + -DSDL_SHARED=OFF \ -DSDL_ATOMIC=OFF \ -DSDL_AUDIO=OFF \ -DSDL_VIDEO=ON \ @@ -124,23 +126,24 @@ RUN \ -DSDL_FILESYSTEM=OFF \ -DSDL_DLOPEN=ON \ -DSDL_SENSOR=ON \ - -DVIDEO_OPENGL=ON \ - -DVIDEO_OPENGLES=ON \ - -DVIDEO_RPI=OFF \ - -DVIDEO_WAYLAND=OFF \ - -DVIDEO_X11=ON \ - -DX11_SHARED=OFF \ - -DVIDEO_X11_XCURSOR=OFF \ - -DVIDEO_X11_XINERAMA=OFF \ - -DVIDEO_X11_XINPUT=OFF \ - -DVIDEO_X11_XRANDR=OFF \ - -DVIDEO_X11_XSCRNSAVER=OFF \ - -DVIDEO_X11_XSHAPE=OFF \ - -DVIDEO_X11_XVM=OFF \ - -DVIDEO_VULKAN=OFF \ - -DVIDEO_VIVANTE=OFF \ - -DVIDEO_COCOA=OFF \ - -DVIDEO_METAL=OFF \ - -DVIDEO_KMSDRM=OFF \ + -DSDL_COCOA=OFF \ + -DSDL_KMSDRM=OFF \ + -DSDL_METAL=OFF \ + -DSDL_OPENGL=ON \ + -DSDL_OPENGLES=ON \ + -DSDL_RPI=OFF \ + -DSDL_VIVANTE=OFF \ + -DSDL_VULKAN=OFF \ + -DSDL_WAYLAND=OFF \ + -DSDL_X11=ON \ + -DSDL_X11_SHARED=OFF \ + -DSDL_X11_XCURSOR=OFF \ + -DSDL_X11_XFIXES=OFF \ + -DSDL_X11_XINERAMA=OFF \ + -DSDL_X11_XINPUT=OFF \ + -DSDL_X11_XRANDR=OFF \ + -DSDL_X11_XSCRNSAVER=OFF \ + -DSDL_X11_XSHAPE=OFF \ + -DSDL_X11_XVM=OFF \ && make -j`nproc` \ && make install diff --git a/build/raspberry-pi-os_armv7/rpi-raspbian.conf b/build/raspberry-pi-os_armv7/rpi-raspbian.conf index 51cf74bf..5259673c 100644 --- a/build/raspberry-pi-os_armv7/rpi-raspbian.conf +++ b/build/raspberry-pi-os_armv7/rpi-raspbian.conf @@ -4,19 +4,16 @@ bootstrap=Ports Ports2 Rasp aptsources=Ports Ports2 Rasp [Ports] -packages=libc6-dev libstdc++-6-dev libasound2-dev libpulse-dev libudev-dev libexpat1-dev libnss3-dev python-dev libgtk-3-dev libsdl2-dev +packages=libc6-dev libstdc++-10-dev libasound2-dev libpulse-dev libudev-dev libexpat1-dev libnss3-dev libgtk-3-dev libsdl2-dev source=http://ftp.jaist.ac.jp/raspbian -keyring=raspbian-archive-keyring -suite=buster +suite=bullseye [Ports2] -packages=libc6-dev libstdc++-6-dev libasound2-dev libpulse-dev libudev-dev libexpat1-dev libnss3-dev python-dev libgtk-3-dev libsdl2-dev +packages=libc6-dev libstdc++-10-dev libasound2-dev libpulse-dev libudev-dev libexpat1-dev libnss3-dev libgtk-3-dev libsdl2-dev source=http://ftp.tsukuba.wide.ad.jp/Linux/raspbian/raspbian -keyring=raspbian-archive-keyring -suite=buster +suite=bullseye [Rasp] packages=libraspberrypi-bin libraspberrypi-dev source=http://archive.raspberrypi.org/debian -keyring=raspbian-archive-keyring -suite=buster +suite=bullseye diff --git a/build/raspberry-pi-os_armv8/Dockerfile b/build/raspberry-pi-os_armv8/Dockerfile index 7c28c508..971efa9b 100644 --- a/build/raspberry-pi-os_armv8/Dockerfile +++ b/build/raspberry-pi-os_armv8/Dockerfile @@ -44,6 +44,7 @@ RUN \ && cd /root/boost-source/source \ && echo 'using clang : : /root/llvm/clang/bin/clang++ : ;' > project-config.jam \ && ./b2 \ + cxxstd=17 \ cxxflags=' \ -D_LIBCPP_ABI_UNSTABLE \ -D_LIBCPP_DISABLE_AVAILABILITY \ diff --git a/build/raspberry-pi-os_armv8/rpi-raspbian.conf b/build/raspberry-pi-os_armv8/rpi-raspbian.conf index ee34dab0..e3bc5e31 100644 --- a/build/raspberry-pi-os_armv8/rpi-raspbian.conf +++ b/build/raspberry-pi-os_armv8/rpi-raspbian.conf @@ -4,13 +4,11 @@ bootstrap=Deb Rasp aptsources=Deb Rasp [Deb] -packages=libgcc-8-dev libc6-dev libstdc++-8-dev libasound2-dev libpulse-dev libudev-dev libexpat1-dev libnss3-dev python-dev libgtk-3-dev libx11-dev +packages=libc6-dev libstdc++-10-dev libasound2-dev libpulse-dev libudev-dev libexpat1-dev libnss3-dev libgtk-3-dev libx11-dev source=http://deb.debian.org/debian -keyring=debian-archive-keyring -suite=buster +suite=bullseye [Rasp] packages=libraspberrypi-bin libraspberrypi-dev source=http://archive.raspberrypi.org/debian -keyring=raspberrypi-archive-keyring -suite=buster +suite=bullseye diff --git a/build/ubuntu-18.04_armv8_jetson_nano/Dockerfile b/build/ubuntu-18.04_armv8_jetson_nano/Dockerfile index e6a9180c..fcee6bec 100644 --- a/build/ubuntu-18.04_armv8_jetson_nano/Dockerfile +++ b/build/ubuntu-18.04_armv8_jetson_nano/Dockerfile @@ -49,6 +49,7 @@ RUN \ && cd /root/boost-source/source \ && echo 'using clang : : /root/llvm/clang/bin/clang++ : ;' > project-config.jam \ && ./b2 \ + cxxstd=17 \ cxxflags=' \ -D_LIBCPP_ABI_UNSTABLE \ -D_LIBCPP_DISABLE_AVAILABILITY \ diff --git a/build/ubuntu-18.04_armv8_jetson_nano/arm64.conf b/build/ubuntu-18.04_armv8_jetson_nano/arm64.conf index ebbf95f8..d15b09ac 100644 --- a/build/ubuntu-18.04_armv8_jetson_nano/arm64.conf +++ b/build/ubuntu-18.04_armv8_jetson_nano/arm64.conf @@ -13,11 +13,11 @@ components=main universe [Jetson] packages=nvidia-l4t-camera nvidia-l4t-multimedia source=https://repo.download.nvidia.com/jetson/common -suite=r32.5 +suite=r32.6 components=main [T210] packages=nvidia-l4t-jetson-multimedia-api source=https://repo.download.nvidia.com/jetson/t210 -suite=r32.5 +suite=r32.6 components=main \ No newline at end of file diff --git a/build/ubuntu-18.04_armv8_jetson_xavier/Dockerfile b/build/ubuntu-18.04_armv8_jetson_xavier/Dockerfile index e6a9180c..fcee6bec 100644 --- a/build/ubuntu-18.04_armv8_jetson_xavier/Dockerfile +++ b/build/ubuntu-18.04_armv8_jetson_xavier/Dockerfile @@ -49,6 +49,7 @@ RUN \ && cd /root/boost-source/source \ && echo 'using clang : : /root/llvm/clang/bin/clang++ : ;' > project-config.jam \ && ./b2 \ + cxxstd=17 \ cxxflags=' \ -D_LIBCPP_ABI_UNSTABLE \ -D_LIBCPP_DISABLE_AVAILABILITY \ diff --git a/build/ubuntu-18.04_armv8_jetson_xavier/arm64.conf b/build/ubuntu-18.04_armv8_jetson_xavier/arm64.conf index 8469d708..e2a70dee 100644 --- a/build/ubuntu-18.04_armv8_jetson_xavier/arm64.conf +++ b/build/ubuntu-18.04_armv8_jetson_xavier/arm64.conf @@ -13,11 +13,11 @@ components=main universe [Jetson] packages=nvidia-l4t-camera nvidia-l4t-multimedia source=https://repo.download.nvidia.com/jetson/common -suite=r32.5 +suite=r32.6 components=main [T194] packages=nvidia-l4t-jetson-multimedia-api source=https://repo.download.nvidia.com/jetson/t194 -suite=r32.5 +suite=r32.6 components=main \ No newline at end of file diff --git a/build/ubuntu-18.04_x86_64/Dockerfile b/build/ubuntu-18.04_x86_64/Dockerfile index 1379e863..a491d166 100644 --- a/build/ubuntu-18.04_x86_64/Dockerfile +++ b/build/ubuntu-18.04_x86_64/Dockerfile @@ -38,6 +38,7 @@ RUN \ && cd /root/boost-source/source \ && echo 'using clang : : /root/llvm/clang/bin/clang++ : ;' > project-config.jam \ && ./b2 \ + cxxstd=17 \ cxxflags=' \ -D_LIBCPP_ABI_UNSTABLE \ -D_LIBCPP_DISABLE_AVAILABILITY \ diff --git a/build/ubuntu-20.04_x86_64/Dockerfile b/build/ubuntu-20.04_x86_64/Dockerfile index aff21a8c..cc59eb71 100644 --- a/build/ubuntu-20.04_x86_64/Dockerfile +++ b/build/ubuntu-20.04_x86_64/Dockerfile @@ -38,6 +38,7 @@ RUN \ && cd /root/boost-source/source \ && echo 'using clang : : /root/llvm/clang/bin/clang++ : ;' > project-config.jam \ && ./b2 \ + cxxstd=17 \ cxxflags=' \ -D_LIBCPP_ABI_UNSTABLE \ -D_LIBCPP_DISABLE_AVAILABILITY \ diff --git a/build/windows/install_deps.ps1 b/build/windows_x86_64/install_deps.ps1 similarity index 95% rename from build/windows/install_deps.ps1 rename to build/windows_x86_64/install_deps.ps1 index b6aa73e2..178b5be1 100644 --- a/build/windows/install_deps.ps1 +++ b/build/windows_x86_64/install_deps.ps1 @@ -24,7 +24,7 @@ mkdir $CACHE_DIR -ErrorAction Ignore if (!(Test-Path "$INSTALL_DIR\webrtc\lib\webrtc.lib")) { # shiguredo-webrtc-windows のバイナリをダウンロードする - $_URL = "https://github.com/shiguredo-webrtc-build/webrtc-build/releases/download/m$WEBRTC_BUILD_VERSION/webrtc.windows.zip" + $_URL = "https://github.com/shiguredo-webrtc-build/webrtc-build/releases/download/m$WEBRTC_BUILD_VERSION/webrtc.windows_x86_64.zip" $_FILE = "$SOURCE_DIR\webrtc-m$WEBRTC_BUILD_VERSION.zip" Push-Location $SOURCE_DIR if (!(Test-Path $_FILE)) { diff --git a/cmake.ps1 b/cmake.ps1 index cffd3bca..a57f09d1 100644 --- a/cmake.ps1 +++ b/cmake.ps1 @@ -1,6 +1,6 @@ $ErrorActionPreference = 'Stop' -$WEBRTC_VERSION_FILE = Join-Path (Resolve-Path ".").Path "build\windows\_install\webrtc\VERSIONS" +$WEBRTC_VERSION_FILE = Join-Path (Resolve-Path ".").Path "build\windows_x86_64\_install\webrtc\VERSIONS" Get-Content $WEBRTC_VERSION_FILE | Foreach-Object{ if (!$_) { continue @@ -19,12 +19,12 @@ Get-Content $MOMO_VERSION_FILE | Foreach-Object{ $MOMO_COMMIT = "$(git rev-parse HEAD)" -$INSTALL_DIR = (Join-Path (Resolve-Path ".").Path "build\windows\_install").Replace("\", "/") +$INSTALL_DIR = (Join-Path (Resolve-Path ".").Path "build\windows_x86_64\_install").Replace("\", "/") $MODULE_PATH = (Join-Path (Resolve-Path ".").Path "cmake").Replace("\", "/") -$SDL_MODULE_PATH = (Join-Path (Resolve-Path ".").Path "build\windows\_install\SDL2\cmake").Replace("\", "/") +$SDL_MODULE_PATH = (Join-Path (Resolve-Path ".").Path "build\windows_x86_64\_install\SDL2\cmake").Replace("\", "/") -mkdir _build\windows -Force -ErrorAction Ignore -Push-Location _build\windows +mkdir _build\windows_x86_64 -Force -ErrorAction Ignore +Push-Location _build\windows_x86_64 cmake ..\.. -G "Visual Studio 16 2019" ` -DMOMO_VERSION="$MOMO_VERSION" ` -DMOMO_COMMIT="$MOMO_COMMIT" ` diff --git a/doc/BUILD_LINUX_LOCAL.md b/doc/BUILD_LINUX_LOCAL.md index 7512e51b..a1a322f9 100644 --- a/doc/BUILD_LINUX_LOCAL.md +++ b/doc/BUILD_LINUX_LOCAL.md @@ -81,6 +81,7 @@ if [ ! -e $INSTALL_DIR/boost/lib/libboost_filesystem.a ]; then pushd $SOURCE_DIR/boost/source echo "using clang : : $INSTALL_DIR/llvm/clang/bin/clang++ : ;" > project-config.jam ./b2 \ + cxxstd=17 \ cxxflags=" \ -D_LIBCPP_ABI_UNSTABLE \ -nostdinc++ \ @@ -294,6 +295,7 @@ if [ ! -e $INSTALL_DIR/boost/lib/libboost_filesystem.a ]; then pushd $SOURCE_DIR/boost/source echo "using clang : : $SOURCE_DIR/webrtc/src/third_party/llvm-build/Release+Asserts/bin/clang++ : ;" > project-config.jam ./b2 \ + cxxstd=17 \ cxxflags=" \ -D_LIBCPP_ABI_UNSTABLE \ -nostdinc++ \ diff --git a/doc/FAQ.md b/doc/FAQ.md index 565e8d9e..2dad965e 100644 --- a/doc/FAQ.md +++ b/doc/FAQ.md @@ -51,7 +51,7 @@ NVENC が利用可能なビデオカードは以下で確認してください ### 動作確認が取れたビデオカード -**是非 Discord の #nvidia-video-codec-sdk チャネルまでご連絡ください** +**是非 Discord の #momo-nvidia-video-codec-sdk チャネルまでご連絡ください** - GeForce GTX 1080 Ti - @melpon @@ -98,16 +98,33 @@ NVENC が利用可能なビデオカードは以下で確認してください Momo では Sora の DataChannel メッセージングに対応する予定はありません。 Sora C++ SDK にて対応予定です。 +## Raspberry Pi OS のレガシー版には対応していますか? + +レガシー版には対応せず、最新版にのみ対応していきます。 + ## Raspberry Pi (Raspberry-Pi-OS) で `--hw-mjpeg-decoder true` を指定した時に映像が出ません RaspberryPi の MJPEG デコーダ は一部の MJPEG に対応したカメラでしか機能しません。 MJPEG に対応した CSI カメラや USB カメラをご用意いただくか、 `--hw-mjpeg-decoder false` にしてご利用ください。 -## Mac (arm64) から H.264 の FHD でスクリーンキャプチャを配信したい +## Mac (arm64) から H.264 の FHD でスクリーンキャプチャを配信したい Mac (arm64) から FHD でスクリーンキャプチャを配信したい場合は Sora の H.264 のプロファイルレベル ID を 3.2 以上に設定してください。 設定方法はこちらの [Sora のドキュメント](https://sora-doc.shiguredo.jp/sora_conf#default-h264-profile-level-id)をお読みください。 プロファイルレベル ID を変更しない場合は H.264 の HD 以下で配信するか、他のコーデックを使用して FHD 配信をしてください。 + +## Windows で H.264 を利用できますか? + +NVIDIA のビデオカードの NVENC を利用することで H.264 が利用可能になります。 +ご利用の環境で H.264 が利用できるかどうかは `./momo --video-codec-engines` を使用して H264 の項目をご確認ください。 + +## Jetson シリーズを使って SDL で Simulcast の H.264 を受信する + +Jetson シリーズで Simulcast の H.264 を SDL を使って受信する場合、下部に緑の線が見えることがあります。 + +これは受信している Simulcast の解像度が H.264 の解像度の仕様に不一致な状態で受信しているためで、 Sora の API を使用して受信する解像度を変更してください。 + +API の詳細はこちらの [Sora のドキュメント](https://sora-doc.shiguredo.jp/EXPERIMENTAL_API#adcbc8)をお読みください。 diff --git a/doc/SETUP_JETSON.md b/doc/SETUP_JETSON.md index 95f1281c..d8efed0c 100644 --- a/doc/SETUP_JETSON.md +++ b/doc/SETUP_JETSON.md @@ -107,7 +107,11 @@ Sora Labo の利用申請や使用方法については [Sora Labo のドキュ ```shell $ ./momo --hw-mjpeg-decoder true --framerate 30 --resolution 4K --log-level 2 sora \ - wss://sora-labo.shiguredo.jp/signaling shiguredo@sora-labo \ + --signaling-url \ + wss://..sora.sora-labo.shiguredo.app/signaling \ + wss://..sora.sora-labo.shiguredo.app/signaling \ + wss://..sora.sora-labo.shiguredo.app/signaling \ + --channel-id shiguredo@sora-labo \ --video true --audio true \ --video-codec-type VP8 --video-bit-rate 15000 \ --auto --role sendonly --multistream true \ diff --git a/doc/SETUP_WINDOWS.md b/doc/SETUP_WINDOWS.md index 113818e3..08d5a66b 100644 --- a/doc/SETUP_WINDOWS.md +++ b/doc/SETUP_WINDOWS.md @@ -15,8 +15,13 @@ metadataオプションのキーや値を囲む「"」を「\\\"」にする必 PowerShell での実行例: ``` -.\momo.exe --no-audio-device sora ` - wss://sora-labo.shiguredo.jp/signaling shiguredo@sora-labo ` +.\momo.exe --no-audio-device ` + sora ` + --signaling-url ` + wss://..sora.sora-labo.shiguredo.app/signaling ` + wss://..sora.sora-labo.shiguredo.app/signaling ` + wss://..sora.sora-labo.shiguredo.app/signaling ` + --channel-id shiguredo@sora-labo ` --video-codec-type VP8 --video-bit-rate 500 ` --audio false ` --role sendonly --metadata '{\"signaling_key\": \"xyz\"}' diff --git a/doc/USE_AYAME.md b/doc/USE_AYAME.md index 00782ea5..4e3d261d 100644 --- a/doc/USE_AYAME.md +++ b/doc/USE_AYAME.md @@ -19,13 +19,13 @@ Ayame Labo はサインアップせずにシグナリングサーバを利用可 ここではルーム ID は `open-momo` としておりますが、必ず推測されにくい値に変更してください。 ```shell -./momo --no-audio-device ayame wss://ayame-labo.shiguredo.jp/signaling open-momo +./momo --no-audio-device ayame --signaling-url wss://ayame-labo.shiguredo.jp/signaling --channel-id open-momo ``` Windows の場合: ``` -.\momo.exe --no-audio-device ayame wss://ayame-labo.shiguredo.jp/signaling open-momo +.\momo.exe --no-audio-device ayame --signaling-url wss://ayame-labo.shiguredo.jp/signaling --channel-id open-momo ``` @@ -44,13 +44,13 @@ Ayame Labo にサインアップした場合はルーム ID に GitHub ユーザ - ここではシグナリングキーを `xyz` としています ```shell -./momo --no-audio-device ayame wss://ayame-labo.shiguredo.jp/signaling shiguredo@open-momo --signaling-key xyz +./momo --no-audio-device ayame --signaling-url wss://ayame-labo.shiguredo.jp/signaling --channel-id shiguredo@open-momo --signaling-key xyz ``` Windows の場合: ``` -.\momo.exe --no-audio-device ayame wss://ayame-labo.shiguredo.jp/signaling shiguredo@open-momo --signaling-key xyz +.\momo.exe --no-audio-device ayame --signaling-url wss://ayame-labo.shiguredo.jp/signaling --channel-id shiguredo@open-momo --signaling-key xyz ``` Ayame SDK のオンラインサンプルを利用します。 URL の引数にルーム ID とシグナリングキーを指定してアクセスします。 diff --git a/doc/USE_SORA.md b/doc/USE_SORA.md index ef14f163..8f6dc897 100644 --- a/doc/USE_SORA.md +++ b/doc/USE_SORA.md @@ -25,9 +25,9 @@ GitHub アカウントを用意して https://sora-labo.shiguredo.jp/ にサイ ./momo --no-audio-device \ sora \ --signaling-url \ - wss://node-01.sora-labo.shiguredo.jp/signaling \ - wss://node-01.sora-labo.shiguredo.jp/signaling \ - wss://node-01.sora-labo.shiguredo.jp/signaling \ + wss://..sora.sora-labo.shiguredo.app/signaling \ + wss://..sora.sora-labo.shiguredo.app/signaling \ + wss://..sora.sora-labo.shiguredo.app/signaling \ --channel-id shiguredo@sora-labo \ --video-codec-type VP8 --video-bit-rate 500 \ --audio false \ @@ -44,9 +44,9 @@ GUI 環境で Momo を利用すると、 SDL を利用し音声や映像の受 ./momo --resolution VGA --no-audio-device --use-sdl --show-me \ sora \ --signaling-url \ - wss://node-01.sora-labo.shiguredo.jp/signaling \ - wss://node-01.sora-labo.shiguredo.jp/signaling \ - wss://node-01.sora-labo.shiguredo.jp/signaling \ + wss://..sora.sora-labo.shiguredo.app/signaling \ + wss://..sora.sora-labo.shiguredo.app/signaling \ + wss://..sora.sora-labo.shiguredo.app/signaling \ --channel-id shiguredo@open-momo \ --video-codec-type VP8 --video-bit-rate 1000 \ --audio false \ @@ -61,9 +61,9 @@ GUI 環境で Momo を利用すると、 SDL を利用し音声や映像の受 ./momo --no-audio-device \ sora \ --signaling-url \ - wss://node-01.sora-labo.shiguredo.jp/signaling \ - wss://node-01.sora-labo.shiguredo.jp/signaling \ - wss://node-01.sora-labo.shiguredo.jp/signaling \ + wss://..sora.sora-labo.shiguredo.app/signaling \ + wss://..sora.sora-labo.shiguredo.app/signaling \ + wss://..sora.sora-labo.shiguredo.app/signaling \ --channel-id shiguredo@sora-labo \ --simulcast true \ --video-codec-type VP8 --video-bit-rate 500 \ diff --git a/script/get_llvm.sh b/script/get_llvm.sh index ec7bf927..410554a7 100755 --- a/script/get_llvm.sh +++ b/script/get_llvm.sh @@ -31,7 +31,7 @@ pushd $OUTPUT_DIR/llvm pushd tools git fetch git reset --hard $WEBRTC_SRC_TOOLS_COMMIT - python clang/scripts/update.py --output-dir=$OUTPUT_DIR/llvm/clang + python3 clang/scripts/update.py --output-dir=$OUTPUT_DIR/llvm/clang popd popd diff --git a/script/init_rootfs_arm64.sh b/script/init_rootfs_arm64.sh index 0f5e1607..4eedfde5 100755 --- a/script/init_rootfs_arm64.sh +++ b/script/init_rootfs_arm64.sh @@ -28,9 +28,5 @@ elif [ -L $TARGET_DIR/usr/lib/gcc/aarch64-linux-gnu/8/libgcc_s.so ]; then ln -s ../../../../../lib64/aarch64-linux-gnu/libgcc_s.so.1 $TARGET_DIR/usr/lib/gcc/aarch64-linux-gnu/8/libgcc_s.so elif [ -e $TARGET_DIR/lib/aarch64-linux-gnu/libgcc_s.so.1 ]; then ln -s ../../../../../lib/aarch64-linux-gnu/libgcc_s.so.1 $TARGET_DIR/usr/lib/gcc/aarch64-linux-gnu/8/libgcc_s.so - else - exit 1 fi -else - exit 1 fi diff --git a/src/hwenc_jetson/jetson_v4l2_capturer.cpp b/src/hwenc_jetson/jetson_v4l2_capturer.cpp index f684c798..3195a363 100644 --- a/src/hwenc_jetson/jetson_v4l2_capturer.cpp +++ b/src/hwenc_jetson/jetson_v4l2_capturer.cpp @@ -9,8 +9,6 @@ #include "jetson_buffer.h" -#define MJPEG_EOS_SEARCH_SIZE 4096 - rtc::scoped_refptr JetsonV4L2Capturer::Create( V4L2VideoCapturerConfig config) { rtc::scoped_refptr capturer; @@ -35,7 +33,7 @@ rtc::scoped_refptr JetsonV4L2Capturer::Create( } bool JetsonV4L2Capturer::UseNativeBuffer() { - return true; + return true; } rtc::scoped_refptr JetsonV4L2Capturer::Create( @@ -86,44 +84,27 @@ bool JetsonV4L2Capturer::DeAllocateVideoBuffers() { return V4L2VideoCapturer::DeAllocateVideoBuffers(); } -bool JetsonV4L2Capturer::OnCaptured(struct v4l2_buffer& buf) { +void JetsonV4L2Capturer::OnCaptured(uint8_t* data, uint32_t bytesused) { const int64_t timestamp_us = rtc::TimeMicros(); int adapted_width, adapted_height, crop_width, crop_height, crop_x, crop_y; if (!AdaptFrame(_currentWidth, _currentHeight, timestamp_us, &adapted_width, &adapted_height, &crop_width, &crop_height, &crop_x, &crop_y)) { - return false; + return; } if (_captureVideoType == webrtc::VideoType::kMJPEG) { - unsigned int bytesused = buf.bytesused; - unsigned int eosSearchSize = MJPEG_EOS_SEARCH_SIZE; - uint8_t *p; - /* v4l2_buf.bytesused may have padding bytes for alignment - Search for EOF to get exact size */ - if (eosSearchSize > bytesused) - eosSearchSize = bytesused; - for (unsigned int i = 0; i < eosSearchSize; i++) { - p = (uint8_t *)_pool[buf.index].start + bytesused; - if ((*(p-2) == 0xff) && (*(p-1) == 0xd9)) { - break; - } - bytesused--; - } - auto decoder = jpeg_decoder_pool_->Pop(); int fd = 0; uint32_t width, height, pixfmt; - if (decoder->DecodeToFd(fd, (unsigned char *)_pool[buf.index].start, - bytesused, pixfmt, width, height) < 0) { + if (decoder->DecodeToFd(fd, data, bytesused, pixfmt, width, height) < 0) { RTC_LOG(LS_ERROR) << "decodeToFd Failed"; - return false; + return; } rtc::scoped_refptr jetson_buffer( - JetsonBuffer::Create( - _captureVideoType, width, height, adapted_width, adapted_height, - fd, pixfmt, std::move(decoder))); + JetsonBuffer::Create(_captureVideoType, width, height, adapted_width, + adapted_height, fd, pixfmt, std::move(decoder))); OnFrame(webrtc::VideoFrame::Builder() .set_video_frame_buffer(jetson_buffer) .set_timestamp_rtp(0) @@ -134,12 +115,10 @@ bool JetsonV4L2Capturer::OnCaptured(struct v4l2_buffer& buf) { } else { rtc::scoped_refptr jetson_buffer( - JetsonBuffer::Create( - _captureVideoType, _currentWidth, _currentHeight, - adapted_width, adapted_height)); - memcpy(jetson_buffer->Data(), (unsigned char*)_pool[buf.index].start, - buf.bytesused); - jetson_buffer->SetLength(buf.bytesused); + JetsonBuffer::Create(_captureVideoType, _currentWidth, _currentHeight, + adapted_width, adapted_height)); + memcpy(jetson_buffer->Data(), data, bytesused); + jetson_buffer->SetLength(bytesused); OnFrame(webrtc::VideoFrame::Builder() .set_video_frame_buffer(jetson_buffer) .set_timestamp_rtp(0) @@ -148,10 +127,4 @@ bool JetsonV4L2Capturer::OnCaptured(struct v4l2_buffer& buf) { .set_rotation(webrtc::kVideoRotation_0) .build()); } - - // enqueue the buffer again - if (ioctl(_deviceFd, VIDIOC_QBUF, &buf) == -1) { - RTC_LOG(LS_INFO) << "Failed to enqueue capture buffer"; - } - return true; -} +} \ No newline at end of file diff --git a/src/hwenc_jetson/jetson_v4l2_capturer.h b/src/hwenc_jetson/jetson_v4l2_capturer.h index 088a1fd9..4b89adda 100644 --- a/src/hwenc_jetson/jetson_v4l2_capturer.h +++ b/src/hwenc_jetson/jetson_v4l2_capturer.h @@ -7,9 +7,11 @@ class JetsonV4L2Capturer : public V4L2VideoCapturer { public: - static rtc::scoped_refptr Create(V4L2VideoCapturerConfig config); + static rtc::scoped_refptr Create( + V4L2VideoCapturerConfig config); bool UseNativeBuffer() override; + private: static rtc::scoped_refptr Create( webrtc::VideoCaptureModule::DeviceInfo* device_info, @@ -18,7 +20,7 @@ class JetsonV4L2Capturer : public V4L2VideoCapturer { bool AllocateVideoBuffers() override; bool DeAllocateVideoBuffers() override; - bool OnCaptured(struct v4l2_buffer& buf) override; + void OnCaptured(uint8_t* data, uint32_t bytesused) override; std::shared_ptr jpeg_decoder_pool_; }; diff --git a/src/hwenc_jetson/jetson_video_decoder.cpp b/src/hwenc_jetson/jetson_video_decoder.cpp index 701be1a4..aa899c8d 100644 --- a/src/hwenc_jetson/jetson_video_decoder.cpp +++ b/src/hwenc_jetson/jetson_video_decoder.cpp @@ -236,7 +236,7 @@ void JetsonVideoDecoder::CaptureLoop() { if (errno == EAGAIN) { continue; } else { - RTC_LOG(LS_ERROR) << __FUNCTION__ << " Failed to dqEvent at decoder"; + RTC_LOG(LS_ERROR) << __FUNCTION__ << " Failed to dqEvent at decoder"; got_error_ = true; break; } @@ -279,14 +279,14 @@ void JetsonVideoDecoder::CaptureLoop() { v4l2_buf.timestamp.tv_usec; NvBufferRect src_rect, dest_rect; - src_rect.top = 0; - src_rect.left = 0; - src_rect.width = buffer->planes[0].fmt.width; - src_rect.height = buffer->planes[0].fmt.height; + src_rect.top = capture_crop_->c.top; + src_rect.left = capture_crop_->c.left; + src_rect.width = capture_crop_->c.width; + src_rect.height = capture_crop_->c.height; dest_rect.top = 0; dest_rect.left = 0; - dest_rect.width = buffer->planes[0].fmt.width; - dest_rect.height = buffer->planes[0].fmt.height; + dest_rect.width = capture_crop_->c.width; + dest_rect.height = capture_crop_->c.height; NvBufferTransformParams transform_params; memset(&transform_params, 0, sizeof(transform_params)); @@ -295,6 +295,7 @@ void JetsonVideoDecoder::CaptureLoop() { transform_params.transform_filter = NvBufferTransform_Filter_Smart; transform_params.src_rect = src_rect; transform_params.dst_rect = dest_rect; + // 何が来ても YUV420 に変換する ret = NvBufferTransform(buffer->planes[0].fd, dst_dma_fd_, &transform_params); if (ret == -1) { @@ -303,8 +304,7 @@ void JetsonVideoDecoder::CaptureLoop() { } rtc::scoped_refptr i420_buffer = - buffer_pool_.CreateI420Buffer(buffer->planes[0].fmt.width, - buffer->planes[0].fmt.height); + buffer_pool_.CreateI420Buffer(capture_crop_->c.width, capture_crop_->c.height); if (!i420_buffer.get()) { // Pool has too many pending frames. RTC_HISTOGRAM_BOOLEAN( @@ -366,13 +366,15 @@ int JetsonVideoDecoder::SetCapture() { ret = decoder_->capture_plane.getFormat(format); INIT_ERROR(ret < 0, "Failed to getFormat at capture_plane"); - struct v4l2_crop crop; - ret = decoder_->capture_plane.getCrop(crop); + capture_crop_.reset(new v4l2_crop()); + ret = decoder_->capture_plane.getCrop(*capture_crop_.get()); INIT_ERROR(ret < 0, "Failed to getCrop at capture_plane"); - RTC_LOG(LS_INFO) << __FUNCTION__ << " " << format.fmt.pix_mp.pixelformat - << " " << format.fmt.pix_mp.width << "x" - << format.fmt.pix_mp.height; + RTC_LOG(LS_INFO) << __FUNCTION__ << " plane format " << format.fmt.pix_mp.pixelformat + << " " << format.fmt.pix_mp.width << "x" << format.fmt.pix_mp.height; + RTC_LOG(LS_INFO) << __FUNCTION__ << " crop " + << capture_crop_->c.top << "x" << capture_crop_->c.left + << " " << capture_crop_->c.width << "x" << format.fmt.pix_mp.height; if (dst_dma_fd_ != -1) { NvBufferDestroy(dst_dma_fd_); @@ -381,8 +383,8 @@ int JetsonVideoDecoder::SetCapture() { NvBufferCreateParams input_params = {0}; input_params.payloadType = NvBufferPayload_SurfArray; - input_params.width = crop.c.width; - input_params.height = crop.c.height; + input_params.width = capture_crop_->c.width; + input_params.height = capture_crop_->c.height; input_params.layout = NvBufferLayout_Pitch; input_params.colorFormat = NvBufferColorFormat_YUV420; input_params.nvbuf_tag = NvBufferTag_VIDEO_DEC; diff --git a/src/hwenc_jetson/jetson_video_decoder.h b/src/hwenc_jetson/jetson_video_decoder.h index a87e3745..1227e056 100644 --- a/src/hwenc_jetson/jetson_video_decoder.h +++ b/src/hwenc_jetson/jetson_video_decoder.h @@ -54,6 +54,7 @@ class JetsonVideoDecoder : public webrtc::VideoDecoder { std::atomic eos_; std::atomic got_error_; int dst_dma_fd_; + std::unique_ptr capture_crop_; }; #endif // JETSON_VIDEO_DECODER_H_ diff --git a/src/hwenc_jetson/jetson_video_encoder.cpp b/src/hwenc_jetson/jetson_video_encoder.cpp index 8b6b69a5..ed438fc3 100644 --- a/src/hwenc_jetson/jetson_video_encoder.cpp +++ b/src/hwenc_jetson/jetson_video_encoder.cpp @@ -672,7 +672,6 @@ webrtc::VideoEncoder::EncoderInfo JetsonVideoEncoder::GetEncoderInfo() const { info.scaling_settings = VideoEncoder::ScalingSettings(kLowVp9QpThreshold, kHighVp9QpThreshold); } - info.has_internal_source = false; return info; } diff --git a/src/hwenc_mmal/mmal_h264_encoder.cpp b/src/hwenc_mmal/mmal_h264_encoder.cpp index b0a2f6b8..9ef822c0 100644 --- a/src/hwenc_mmal/mmal_h264_encoder.cpp +++ b/src/hwenc_mmal/mmal_h264_encoder.cpp @@ -376,7 +376,6 @@ webrtc::VideoEncoder::EncoderInfo MMALH264Encoder::GetEncoderInfo() const { info.implementation_name = "MMAL H264"; info.scaling_settings = VideoEncoder::ScalingSettings(kLowH264QpThreshold, kHighH264QpThreshold); - info.has_internal_source = false; return info; } diff --git a/src/hwenc_mmal/mmal_v4l2_capturer.cpp b/src/hwenc_mmal/mmal_v4l2_capturer.cpp index 16a2f308..e552ad46 100644 --- a/src/hwenc_mmal/mmal_v4l2_capturer.cpp +++ b/src/hwenc_mmal/mmal_v4l2_capturer.cpp @@ -97,7 +97,7 @@ bool MMALV4L2Capturer::UseNativeBuffer() { return true; } -bool MMALV4L2Capturer::OnCaptured(struct v4l2_buffer& buf) { +void MMALV4L2Capturer::OnCaptured(uint8_t* data, uint32_t bytesused) { const int64_t timestamp_us = rtc::TimeMicros(); int adapted_width; @@ -109,7 +109,7 @@ bool MMALV4L2Capturer::OnCaptured(struct v4l2_buffer& buf) { if (!AdaptFrame(_currentWidth, _currentHeight, timestamp_us, &adapted_width, &adapted_height, &crop_width, &crop_height, &crop_x, &crop_y)) { - return false; + return; } std::lock_guard lock(mtx_); @@ -121,7 +121,7 @@ bool MMALV4L2Capturer::OnCaptured(struct v4l2_buffer& buf) { MMALRelease(); if (MMALConfigure(adapted_width, adapted_height) == -1) { RTC_LOG(LS_ERROR) << "Failed to MMALConfigure"; - return false; + return; } } @@ -138,20 +138,14 @@ bool MMALV4L2Capturer::OnCaptured(struct v4l2_buffer& buf) { buffer->pts = buffer->dts = timestamp_us; buffer->offset = 0; buffer->flags = MMAL_BUFFER_HEADER_FLAG_FRAME; - buffer->data = (uint8_t*)_pool[buf.index].start; - buffer->length = buffer->alloc_size = buf.bytesused; + buffer->data = data; + buffer->length = buffer->alloc_size = bytesused; if (mmal_port_send_buffer(component_in_->input[0], buffer) != MMAL_SUCCESS) { RTC_LOG(LS_ERROR) << "Failed to send input buffer"; - return false; + return; } } - - // enqueue the buffer again - if (ioctl(_deviceFd, VIDIOC_QBUF, &buf) == -1) { - RTC_LOG(LS_INFO) << "Failed to enqueue capture buffer"; - } - return true; } void MMALV4L2Capturer::MMALInputCallbackFunction(MMAL_PORT_T* port, diff --git a/src/hwenc_mmal/mmal_v4l2_capturer.h b/src/hwenc_mmal/mmal_v4l2_capturer.h index 48171c7a..4065710d 100644 --- a/src/hwenc_mmal/mmal_v4l2_capturer.h +++ b/src/hwenc_mmal/mmal_v4l2_capturer.h @@ -50,7 +50,7 @@ class MMALV4L2Capturer : public V4L2VideoCapturer { int32_t StartCapture(V4L2VideoCapturerConfig config) override; int32_t StopCapture() override; bool UseNativeBuffer() override; - bool OnCaptured(struct v4l2_buffer& buf) override; + void OnCaptured(uint8_t* data, uint32_t bytesused) override; static void MMALInputCallbackFunction(MMAL_PORT_T* port, MMAL_BUFFER_HEADER_T* buffer); void MMALInputCallback(MMAL_PORT_T* port, MMAL_BUFFER_HEADER_T* buffer); diff --git a/src/hwenc_nvcodec/nvcodec_h264_encoder.cpp b/src/hwenc_nvcodec/nvcodec_h264_encoder.cpp index 561adc3e..0886b9bc 100644 --- a/src/hwenc_nvcodec/nvcodec_h264_encoder.cpp +++ b/src/hwenc_nvcodec/nvcodec_h264_encoder.cpp @@ -329,7 +329,6 @@ webrtc::VideoEncoder::EncoderInfo NvCodecH264Encoder::GetEncoderInfo() const { info.implementation_name = "NvCodec H264"; info.scaling_settings = webrtc::VideoEncoder::ScalingSettings( kLowH264QpThreshold, kHighH264QpThreshold); - info.has_internal_source = false; return info; } diff --git a/src/rtc/momo_video_decoder_factory.cpp b/src/rtc/momo_video_decoder_factory.cpp index 84a84d6f..ce45d047 100644 --- a/src/rtc/momo_video_decoder_factory.cpp +++ b/src/rtc/momo_video_decoder_factory.cpp @@ -169,6 +169,6 @@ MomoVideoDecoderFactory::CreateVideoDecoder( #endif } - RTC_NOTREACHED(); + RTC_DCHECK_NOTREACHED(); return nullptr; } diff --git a/src/rtc/peer_connection_observer.cpp b/src/rtc/peer_connection_observer.cpp index 22dcc2a7..4f9ad44d 100644 --- a/src/rtc/peer_connection_observer.cpp +++ b/src/rtc/peer_connection_observer.cpp @@ -10,6 +10,10 @@ PeerConnectionObserver::~PeerConnectionObserver() { ClearAllRegisteredTracks(); } +RTCDataManager* PeerConnectionObserver::DataManager() { + return data_manager_; +} + void PeerConnectionObserver::OnDataChannel( rtc::scoped_refptr data_channel) { if (data_manager_ != nullptr) { diff --git a/src/rtc/peer_connection_observer.h b/src/rtc/peer_connection_observer.h index 6c452315..44df7cf0 100644 --- a/src/rtc/peer_connection_observer.h +++ b/src/rtc/peer_connection_observer.h @@ -16,6 +16,8 @@ class PeerConnectionObserver : public webrtc::PeerConnectionObserver { : sender_(sender), receiver_(receiver), data_manager_(data_manager) {} ~PeerConnectionObserver(); + RTCDataManager* DataManager(); + private: void OnSignalingChange( webrtc::PeerConnectionInterface::SignalingState new_state) override {} diff --git a/src/rtc/rtc_connection.cpp b/src/rtc/rtc_connection.cpp index 92a08470..bf4c37eb 100644 --- a/src/rtc/rtc_connection.cpp +++ b/src/rtc/rtc_connection.cpp @@ -116,6 +116,18 @@ RTCConnection::~RTCConnection() { void RTCConnection::CreateOffer(OnCreateSuccessFunc on_success, OnCreateFailureFunc on_failure) { + // CreateOffer を行うのは Ayame だけのため、ここで Offer の場合には DataChannel を作ることとした + // Momo の性質上 ReOffer することは無いので問題ないと思われる + RTCDataManager* data_manager = observer_->DataManager(); + if (data_manager != nullptr) { + webrtc::DataChannelInit config; + auto result = connection_->CreateDataChannelOrError("serial", &config); + if (!result.ok()) { + RTC_LOG(LS_ERROR) << "CreateDataChannel() failed: " << result.error().message(); + } + data_manager->OnDataChannel(result.MoveValue()); + } + using RTCOfferAnswerOptions = webrtc::PeerConnectionInterface::RTCOfferAnswerOptions; RTCOfferAnswerOptions options = RTCOfferAnswerOptions(); diff --git a/src/rtc/screen_video_capturer.cpp b/src/rtc/screen_video_capturer.cpp index e4a06b8a..3fb86791 100644 --- a/src/rtc/screen_video_capturer.cpp +++ b/src/rtc/screen_video_capturer.cpp @@ -31,7 +31,11 @@ const std::string ScreenVideoCapturer::GetSourceListString() { if (GetSourceList(&sources)) { int i = 0; for (webrtc::DesktopCapturer::Source& source : sources) { - oss << i++ << " : " << source.title << std::endl; + // ubuntu で画面キャプチャが動かない問題への対策 + // 原因は正しくつかめていないが std::to_string をはさむことで + // セグメンテーション違反となる処理を回避できているのか、 + // クリーンインストールされた環境においては問題なく動作する。 + oss << std::to_string(i++) << " : " << source.title << std::endl; } } return oss.str(); diff --git a/src/sdl_renderer/sdl_renderer.cpp b/src/sdl_renderer/sdl_renderer.cpp index f3189678..8342f496 100644 --- a/src/sdl_renderer/sdl_renderer.cpp +++ b/src/sdl_renderer/sdl_renderer.cpp @@ -216,11 +216,13 @@ void SDLRenderer::Sink::OnFrame(const webrtc::VideoFrame& frame) { if (frame_aspect > outline_aspect_) { width = outline_width_; height = width / frame_aspect; + offset_x_ = 0; offset_y_ = (outline_height_ - height) / 2; } else { height = outline_height_; width = height * frame_aspect; offset_x_ = (outline_width_ - width) / 2; + offset_y_ = 0; } if (width_ != width || height_ != height) { width_ = width; diff --git a/src/v4l2_video_capturer/v4l2_video_capturer.cpp b/src/v4l2_video_capturer/v4l2_video_capturer.cpp index c9138651..9839a0fc 100644 --- a/src/v4l2_video_capturer/v4l2_video_capturer.cpp +++ b/src/v4l2_video_capturer/v4l2_video_capturer.cpp @@ -39,6 +39,8 @@ #include #include +#define MJPEG_EOS_SEARCH_SIZE 4096 + rtc::scoped_refptr V4L2VideoCapturer::Create( V4L2VideoCapturerConfig config) { rtc::scoped_refptr capturer; @@ -484,12 +486,38 @@ bool V4L2VideoCapturer::CaptureProcess() { } } - if (!OnCaptured(buf)) { - // enqueue the buffer again - if (ioctl(_deviceFd, VIDIOC_QBUF, &buf) == -1) { - RTC_LOG(LS_INFO) << __FUNCTION__ - << " Failed to enqueue capture buffer"; + uint8_t* data = (uint8_t*)_pool[buf.index].start; + uint32_t bytesused = buf.bytesused; + // 一部のカメラ (DELL WB7022) は不正なデータを送ってくることがある。 + // これをハードウェアJPEGデコーダーに送ると Momo ごとクラッシュしてしまう。 + // JPEG の先頭は SOI マーカー 0xffd8 で始まるのでチェックして落ちないようにする。 + if (_captureVideoType == webrtc::VideoType::kMJPEG && bytesused >= 2) { + if (data[0] != 0xff || data[1] != 0xd8) { + RTC_LOG(LS_WARNING) << __FUNCTION__ + << " Invalid JPEG buffer frame skipped"; + } else { + unsigned int eosSearchSize = MJPEG_EOS_SEARCH_SIZE; + uint8_t* p; + /* v4l2_buf.bytesused may have padding bytes for alignment + Search for EOF to get exact size */ + if (eosSearchSize > bytesused) + eosSearchSize = bytesused; + for (unsigned int i = 0; i < eosSearchSize; i++) { + p = data + bytesused; + if ((*(p - 2) == 0xff) && (*(p - 1) == 0xd9)) { + break; + } + bytesused--; + } + OnCaptured(data, bytesused); } + } else { + OnCaptured(data, bytesused); + } + + // enqueue the buffer again + if (ioctl(_deviceFd, VIDIOC_QBUF, &buf) == -1) { + RTC_LOG(LS_INFO) << __FUNCTION__ << " Failed to enqueue capture buffer"; } } } @@ -497,26 +525,25 @@ bool V4L2VideoCapturer::CaptureProcess() { return true; } -bool V4L2VideoCapturer::OnCaptured(struct v4l2_buffer& buf) { +void V4L2VideoCapturer::OnCaptured(uint8_t* data, uint32_t bytesused) { rtc::scoped_refptr dst_buffer = nullptr; if (UseNativeBuffer()) { rtc::scoped_refptr native_buffer( NativeBuffer::Create(_captureVideoType, _currentWidth, _currentHeight)); - memcpy(native_buffer->MutableData(), (unsigned char*)_pool[buf.index].start, - buf.bytesused); - native_buffer->SetLength(buf.bytesused); + memcpy(native_buffer->MutableData(), data, bytesused); + native_buffer->SetLength(bytesused); dst_buffer = native_buffer; } else { rtc::scoped_refptr i420_buffer( webrtc::I420Buffer::Create(_currentWidth, _currentHeight)); i420_buffer->InitializeData(); if (libyuv::ConvertToI420( - (unsigned char*)_pool[buf.index].start, buf.bytesused, - i420_buffer.get()->MutableDataY(), i420_buffer.get()->StrideY(), - i420_buffer.get()->MutableDataU(), i420_buffer.get()->StrideU(), - i420_buffer.get()->MutableDataV(), i420_buffer.get()->StrideV(), 0, - 0, _currentWidth, _currentHeight, _currentWidth, _currentHeight, - libyuv::kRotate0, ConvertVideoType(_captureVideoType)) < 0) { + data, bytesused, i420_buffer.get()->MutableDataY(), + i420_buffer.get()->StrideY(), i420_buffer.get()->MutableDataU(), + i420_buffer.get()->StrideU(), i420_buffer.get()->MutableDataV(), + i420_buffer.get()->StrideV(), 0, 0, _currentWidth, _currentHeight, + _currentWidth, _currentHeight, libyuv::kRotate0, + ConvertVideoType(_captureVideoType)) < 0) { RTC_LOG(LS_ERROR) << "ConvertToI420 Failed"; } else { dst_buffer = i420_buffer; @@ -533,10 +560,4 @@ bool V4L2VideoCapturer::OnCaptured(struct v4l2_buffer& buf) { .build(); OnCapturedFrame(video_frame); } - - // enqueue the buffer again - if (ioctl(_deviceFd, VIDIOC_QBUF, &buf) == -1) { - RTC_LOG(LS_INFO) << "Failed to enqueue capture buffer"; - } - return true; } diff --git a/src/v4l2_video_capturer/v4l2_video_capturer.h b/src/v4l2_video_capturer/v4l2_video_capturer.h index 8bbcd0c1..8157a000 100644 --- a/src/v4l2_video_capturer/v4l2_video_capturer.h +++ b/src/v4l2_video_capturer/v4l2_video_capturer.h @@ -50,7 +50,7 @@ class V4L2VideoCapturer : public ScalableVideoTrackSource { virtual int32_t StopCapture(); virtual bool AllocateVideoBuffers(); virtual bool DeAllocateVideoBuffers(); - virtual bool OnCaptured(struct v4l2_buffer& buf); + virtual void OnCaptured(uint8_t* data, uint32_t bytesused); int32_t _deviceFd; int32_t _currentWidth; diff --git a/src/websocket.cpp b/src/websocket.cpp index a0e72731..0cbfac24 100644 --- a/src/websocket.cpp +++ b/src/websocket.cpp @@ -13,7 +13,11 @@ #include "util.h" static boost::asio::ssl::context CreateSSLContext() { - boost::asio::ssl::context ctx(boost::asio::ssl::context::tlsv12); + // TLS 1.2 と 1.3 のみ対応 + SSL_CTX* handle = ::SSL_CTX_new(::TLS_method()); + SSL_CTX_set_min_proto_version(handle, TLS1_2_VERSION); + SSL_CTX_set_max_proto_version(handle, TLS1_3_VERSION); + boost::asio::ssl::context ctx(handle); //ctx.set_default_verify_paths(); ctx.set_options(boost::asio::ssl::context::default_workarounds | boost::asio::ssl::context::no_sslv2 |