Skip to content

Commit

Permalink
Merge branch 'develop' into feature/m100
Browse files Browse the repository at this point in the history
  • Loading branch information
tnoho committed Apr 4, 2022
2 parents 3228d7c + a2caa79 commit ad72019
Show file tree
Hide file tree
Showing 63 changed files with 1,765 additions and 404 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,24 @@ jobs:
New-Variable -Name $var[0] -Value $var[1] -Force
}
echo "::set-output name=boost_version::${BOOST_VERSION}"
echo "::set-output name=wincuda_version::${WINCUDA_VERSION}"
id: versions
# Boost はよくダウンロード先に繋がらずエラーになるのでキャッシュする
- name: Cache Boost ${{ steps.versions.outputs.boost_version }}
id: cache-boost
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: _cache\boost
key: windows-boost-${{ steps.versions.outputs.boost_version }}.zip.v5
# CUDA のインストールバイナリのダウンロードは 3GB ぐらいあって、
# ビルドの度に取得するのはつらいのでキャッシュする
# (インストールする nvcc は解凍後で 100MB 程度なのでキャッシュ可能)
- name: Cache NVCC ${{ steps.versions.outputs.wincuda_version }}
id: cache-cuda
uses: actions/cache@v3
with:
path: build\windows_x86_64\_install\cuda\nvcc
key: windows-cuda-${{ steps.versions.outputs.wincuda_version }}.v1
- run: "& .\\build.ps1 -package"
working-directory: build
timeout-minutes: 120
Expand Down Expand Up @@ -80,7 +91,7 @@ jobs:
id: versions
- name: Cache Boost ${{ steps.versions.outputs.boost_version }}
id: cache-boost
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: _cache/boost
key: macos-boost-${{ steps.versions.outputs.boost_version }}.tar.gz.v2
Expand Down Expand Up @@ -129,7 +140,7 @@ jobs:
id: versions
- name: Cache Boost ${{ steps.versions.outputs.boost_version }}
id: cache-boost
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: _cache/boost
key: ${{ matrix.name }}-boost-${{ steps.versions.outputs.boost_version }}.tar.gz.v2
Expand Down
13 changes: 10 additions & 3 deletions .github/workflows/daily_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,20 @@ jobs:
New-Variable -Name $var[0] -Value $var[1] -Force
}
echo "::set-output name=boost_version::${BOOST_VERSION}"
echo "::set-output name=wincuda_version::${WINCUDA_VERSION}"
id: versions
- name: Cache Boost ${{ steps.versions.outputs.boost_version }}
id: cache-boost
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: _cache\boost
key: windows-boost-${{ steps.versions.outputs.boost_version }}.zip.v5
- name: Cache NVCC ${{ steps.versions.outputs.wincuda_version }}
id: cache-cuda
uses: actions/cache@v3
with:
path: build\windows_x86_64\_install\cuda\nvcc
key: windows-cuda-${{ steps.versions.outputs.wincuda_version }}.v1
- run: "& .\\build.ps1 -package"
working-directory: build
timeout-minutes: 120
Expand All @@ -53,7 +60,7 @@ jobs:
id: versions
- name: Cache Boost ${{ steps.versions.outputs.boost_version }}
id: cache-boost
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: _cache/boost
key: macos-boost-${{ steps.versions.outputs.boost_version }}.tar.gz.v2
Expand Down Expand Up @@ -83,7 +90,7 @@ jobs:
id: versions
- name: Cache Boost ${{ steps.versions.outputs.boost_version }}
id: cache-boost
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: _cache/boost
key: ${{ matrix.name }}-boost-${{ steps.versions.outputs.boost_version }}.tar.gz.v2
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@

momo
core
.vscode
*.tar.gz
webrtc_logs_0
.DS_Store
*.swp

/_build
/_source
/_install
/_package
/build/windows_*/_source
/build/windows_*/_build
Expand Down
100 changes: 100 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
{
"configurations": [
{
"name": "Windows",
"includePath": [
"${workspaceFolder}/src",
"${workspaceFolder}/NvCodec/include",
"${workspaceFolder}/NvCodec/NvCodec",
"${workspaceFolder}/build/windows_x86_64/_install/webrtc/include",
"${workspaceFolder}/build/windows_x86_64/_install/webrtc/include/third_party/abseil-cpp",
"${workspaceFolder}/build/windows_x86_64/_install/webrtc/include/third_party/boringssl/src/include",
"${workspaceFolder}/build/windows_x86_64/_install/webrtc/include/third_party/libyuv/include",
"${workspaceFolder}/build/windows_x86_64/_install/webrtc/include/third_party/zlib",
"${workspaceFolder}/build/windows_x86_64/_install/boost/include",
"${workspaceFolder}/build/windows_x86_64/_install/CLI11/include",
"${workspaceFolder}/build/windows_x86_64/_install/SDL2/include/SDL2",
"${workspaceFolder}/build/windows_x86_64/_install/cuda/nvcc/include",
"${workspaceFolder}/_build/windows_x86_64"
],
"defines": [
"WEBRTC_WINDOWS",
"USE_NVCODEC_ENCODER=1",
"USE_MMAL_ENCODER=0",
"USE_JETSON_ENCODER=0",
"USE_H264=1",
"USE_SDL2=1",
"USE_LINUX_PULSE_AUDIO=0",
"USE_SCREEN_CAPTURER=1"
],
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "windows-msvc-x64"
},
{
"name": "Ubuntu 20.04 x86_64",
"includePath": [
"${workspaceFolder}/src",
"${workspaceFolder}/NvCodec/include",
"${workspaceFolder}/NvCodec/NvCodec",
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/webrtc/include",
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/webrtc/include/third_party/abseil-cpp",
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/webrtc/include/third_party/boringssl/src/include",
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/webrtc/include/third_party/libyuv/include",
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/webrtc/include/third_party/zlib",
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/boost/include",
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/CLI11/include",
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/SDL2/include/SDL2",
"${workspaceFolder}/_build/ubuntu-20.04_x86_64",
"/usr/local/cuda/include"
],
"defines": [
"WEBRTC_LINUX",
"USE_NVCODEC_ENCODER=1",
"USE_MMAL_ENCODER=0",
"USE_JETSON_ENCODER=0",
"USE_H264=1",
"USE_SDL2=1",
"USE_LINUX_PULSE_AUDIO=0",
"USE_SCREEN_CAPTURER=1"
],
"compilerPath": "/usr/bin/clang",
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "linux-clang-x64"
},
{
"name": "raspberry-pi-os_armv7 on Ubuntu 20.04 x86_64",
"includePath": [
"${workspaceFolder}/src",
"${workspaceFolder}/NvCodec/include",
"${workspaceFolder}/NvCodec/NvCodec",
"${workspaceFolder}/_install/raspberry-pi-os_armv7/webrtc/include",
"${workspaceFolder}/_install/raspberry-pi-os_armv7/webrtc/include/third_party/abseil-cpp",
"${workspaceFolder}/_install/raspberry-pi-os_armv7/webrtc/include/third_party/boringssl/src/include",
"${workspaceFolder}/_install/raspberry-pi-os_armv7/webrtc/include/third_party/libyuv/include",
"${workspaceFolder}/_install/raspberry-pi-os_armv7/webrtc/include/third_party/zlib",
"${workspaceFolder}/_install/raspberry-pi-os_armv7/boost/include",
"${workspaceFolder}/_install/raspberry-pi-os_armv7/CLI11/include",
"${workspaceFolder}/_install/raspberry-pi-os_armv7/SDL2/include/SDL2",
"${workspaceFolder}/_install/raspberry-pi-os_armv7/rootfs/usr/include",
"${workspaceFolder}/_build/raspberry-pi-os_armv7",
],
"defines": [
"WEBRTC_LINUX",
"USE_NVCODEC_ENCODER=0",
"USE_MMAL_ENCODER=1",
"USE_JETSON_ENCODER=0",
"USE_H264=1",
"USE_SDL2=1",
"USE_LINUX_PULSE_AUDIO=0",
"USE_SCREEN_CAPTURER=0"
],
"compilerPath": "${workspaceFolder}/_install/raspberry-pi-os_armv7/llvm/clang/bin/clang",
"cStandard": "c11",
"cppStandard": "c++14",
"intelliSenseMode": "linux-clang-x64"
}
],
"version": 4
}
5 changes: 5 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"[cpp]": {
"editor.formatOnSave": true
}
}
12 changes: 12 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@
- @tnoho
- [FIX] SDL のビルドが mac では declaration-after-statement に触れてビルドが通らないのでパッチで回避
- @tnoho
- [ADD] `--client-cert``--client-key` でクライアント認証をできるようにする
- @melpon
- [ADD] Windows と Ubuntu で NVIDIA VIDEO CODEC SDK を使ったハードウェアデコーダに対応
- @melpon
- [UPDATE] CLI11 を 2.2.0 に上げる
- @voluntas
- [FIX] Ubuntu 20.04 + H.264 + サイマルキャスト + --hw-mjpeg-decoder true で落ちるのを修正 (#221)
- @melpon
- [FIX] Raspberry Pi + H.264 + --hw-mjpeg-decoder true で、カメラの種類によっては動かないことがあるのを修正 (#141)
- @melpon
- [FIX] Raspberry Pi + H.264 + サイマルキャスト + --hw-mjpeg-decoder true で動かないのを修正 (#236)
- @melpon

## 2022.1.0

Expand Down
70 changes: 55 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,10 @@ if (USE_SCREEN_CAPTURER)
if (TARGET_OS STREQUAL "linux")
target_link_libraries(momo
PRIVATE
gio-2.0
gobject-2.0
glib-2.0
Xext
# gio-2.0
# gobject-2.0
# glib-2.0
# Xext
Xdamage
Xfixes
Xcomposite
Expand Down Expand Up @@ -502,7 +502,8 @@ if ("${TARGET_OS}" STREQUAL "windows")
PRIVATE
src/hwenc_nvcodec/nvcodec_h264_encoder.cpp
NvCodec/NvCodec/NvEncoder/NvEncoder.cpp
NvCodec/NvCodec/NvEncoder/NvEncoderD3D11.cpp)
NvCodec/NvCodec/NvEncoder/NvEncoderD3D11.cpp
src/hwenc_nvcodec/nvcodec_video_decoder.cpp)
target_include_directories(momo
PRIVATE
NvCodec/include
Expand All @@ -512,6 +513,39 @@ if ("${TARGET_OS}" STREQUAL "windows")
DXGI.lib
D3D11.lib
)

# enable_language(CUDA) は CUDA 用 Visual Studio Integration を利用して CUDA を検出しているが、
# CUDA ドライバがインストールできない場所では VS Integration をインストールできないため、
# enable_language(CUDA) は利用できない。
# なので(deprecated だけど)FindCUDA を利用してコンパイルする。

set(CUDA_TOOLKIT_ROOT_DIR ${_INSTALL_DIR}/cuda/nvcc)
find_package(CUDA REQUIRED)

set_source_files_properties(
src/cuda/cuda_context_cuda.cpp
NvCodec/NvCodec/NvDecoder/NvDecoder.cpp
src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp
PROPERTIES
CUDA_SOURCE_PROPERTY_FORMAT OBJ
)
cuda_compile(CUDA_FILES
src/cuda/cuda_context_cuda.cpp
NvCodec/NvCodec/NvDecoder/NvDecoder.cpp
src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp
OPTIONS
-Xcompiler /utf-8
-Xcompiler /I${CMAKE_CURRENT_SOURCE_DIR}/NvCodec/include
-Xcompiler /I${CMAKE_CURRENT_SOURCE_DIR}/NvCodec/NvCodec
-Xcompiler /I${CMAKE_CURRENT_SOURCE_DIR}/src
)
target_sources(momo PRIVATE ${CUDA_FILES})
target_include_directories(momo PRIVATE ${CUDA_INCLUDE_DIRS})
target_link_libraries(momo
PRIVATE
${CUDA_TOOLKIT_ROOT_DIR}/lib/x64/cudart_static.lib
#${CUDA_LIBRARIES}
)
endif()
elseif (TARGET_OS STREQUAL "macos")
target_sources(momo
Expand Down Expand Up @@ -568,28 +602,32 @@ elseif (TARGET_OS STREQUAL "linux")
target_link_libraries(momo
PRIVATE
X11
Xau
Xdmcp
# Xau
# Xdmcp
Xtst
xcb
plds4
# xcb
# plds4
Xext
expat
# expat
dl
nss3
nssutil3
plc4
nspr4
rt
# nss3
# nssutil3
# plc4
# nspr4
# rt
Threads::Threads
)

# NVIDIA Video Codec SDK
if (USE_NVCODEC_ENCODER)
target_sources(momo
PRIVATE
src/cuda/cuda_context_cuda.cpp
src/hwenc_nvcodec/nvcodec_h264_encoder.cpp
src/hwenc_nvcodec/nvcodec_v4l2_capturer.cpp
src/hwenc_nvcodec/nvcodec_h264_encoder_cuda.cpp
src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp
src/hwenc_nvcodec/nvcodec_video_decoder.cpp
NvCodec/NvCodec/NvDecoder/NvDecoder.cpp
NvCodec/NvCodec/NvEncoder/NvEncoder.cpp
NvCodec/NvCodec/NvEncoder/NvEncoderCuda.cpp)
Expand All @@ -601,7 +639,9 @@ elseif (TARGET_OS STREQUAL "linux")

# これらのソースは CUDA としてコンパイルする
set_source_files_properties(
src/cuda/cuda_context_cuda.cpp
src/hwenc_nvcodec/nvcodec_h264_encoder_cuda.cpp
src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp
NvCodec/NvCodec/NvDecoder/NvDecoder.cpp
NvCodec/NvCodec/NvEncoder/NvEncoderCuda.cpp
PROPERTIES
Expand Down
16 changes: 7 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ https://github.com/shiguredo/momo/releases

## 動作環境


- Raspberry Pi OS (64bit) ARMv8
- Raspberry Pi 4
- Raspberry Pi 3
- Raspberry Pi 2
- Raspberry Pi OS (32bit) ARMv7
- Raspberry Pi 4
- Raspberry Pi 3
Expand All @@ -101,13 +106,6 @@ https://github.com/shiguredo/momo/releases
- macOS 11 arm64 以降
- Windows 10.1809 x86_64 以降

### 以下はビルドが通ること以外は確認していません

- Raspberry Pi OS (64bit) ARMv8
- Raspberry Pi 4
- Raspberry Pi 3
- Raspberry Pi 2

## 使ってみる

Momo を使ってみたい人は [USE.md](doc/USE.md) をお読みください。
Expand All @@ -131,8 +129,8 @@ Momo を使ってみたい人は [USE.md](doc/USE.md) をお読みください
Apache License 2.0

```
Copyright 2015-2021, tnoho (Original Author)
Copyright 2018-2021, Shiguredo Inc.
Copyright 2015-2022, tnoho (Original Author)
Copyright 2018-2022, Shiguredo Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
3 changes: 2 additions & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
MOMO_VERSION=2022.1.0
WEBRTC_BUILD_VERSION=100.4896.1.2
BOOST_VERSION=1.78.0
CLI11_VERSION=2.1.2
CLI11_VERSION=2.2.0
SDL2_VERSION=2.0.20
CMAKE_VERSION=3.22.3
CUDA_VERSION=11.0.2-1
WINCUDA_VERSION=10.2
Loading

0 comments on commit ad72019

Please sign in to comment.