From 92cf5226140ef0ed743a21d2dcc619e73d5ce52f Mon Sep 17 00:00:00 2001 From: miosakuma Date: Mon, 20 May 2024 16:54:12 +0900 Subject: [PATCH 01/34] =?UTF-8?q?[doc]=20=E3=82=B5=E3=83=B3=E3=83=97?= =?UTF-8?q?=E3=83=AB=E3=81=AE=E3=83=93=E3=83=AB=E3=83=89=E3=81=AF=20main?= =?UTF-8?q?=20=E3=81=8B=E3=82=BF=E3=82=B0=E3=82=92=E5=88=A9=E7=94=A8?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=82=82=E3=82=89=E3=81=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/messaging_recvonly_sample/README.md | 6 +++++- examples/sdl_sample/README.md | 6 +++++- examples/sumomo/README.md | 6 +++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/examples/messaging_recvonly_sample/README.md b/examples/messaging_recvonly_sample/README.md index 321ddc8a..8762ce4c 100644 --- a/examples/messaging_recvonly_sample/README.md +++ b/examples/messaging_recvonly_sample/README.md @@ -20,8 +20,12 @@ [sora-cpp-sdk](https://github.com/shiguredo/sora-cpp-sdk) をクローンして、examples 以下のディレクトリを利用してください。 +develop ブランチは開発ブランチであり、ビルドが失敗することがあるため、 `main` またはリリースタグを指定するようにしてください。 + +以下は main ブランチを指定する例です。 + ```shell -git clone https://github.com/shiguredo/sora-cpp-sdk.git +git clone -b main https://github.com/shiguredo/sora-cpp-sdk.git cd sora-cpp-sdk/examples ``` diff --git a/examples/sdl_sample/README.md b/examples/sdl_sample/README.md index 94977efa..b4cdf0be 100644 --- a/examples/sdl_sample/README.md +++ b/examples/sdl_sample/README.md @@ -20,8 +20,12 @@ [sora-cpp-sdk](https://github.com/shiguredo/sora-cpp-sdk) をクローンして、examples 以下のディレクトリを利用してください。 +develop ブランチは開発ブランチであり、ビルドが失敗することがあるため、 `main` またはリリースタグを指定するようにしてください。 + +以下は main ブランチを指定する例です。 + ```shell -git clone https://github.com/shiguredo/sora-cpp-sdk.git +git clone -b main https://github.com/shiguredo/sora-cpp-sdk.git cd sora-cpp-sdk/examples ``` diff --git a/examples/sumomo/README.md b/examples/sumomo/README.md index c6a9c047..c929e4cc 100644 --- a/examples/sumomo/README.md +++ b/examples/sumomo/README.md @@ -20,8 +20,12 @@ [sora-cpp-sdk](https://github.com/shiguredo/sora-cpp-sdk) をクローンして、examples 以下のディレクトリを利用してください。 +develop ブランチは開発ブランチであり、ビルドが失敗することがあるため、 `main` またはリリースタグを指定するようにしてください。 + +以下は main ブランチを指定する例です。 + ```shell -$ git clone https://github.com/shiguredo/sora-cpp-sdk.git +git clone -b main https://github.com/shiguredo/sora-cpp-sdk.git $ cd sora-cpp-sdk/examples ``` From 8411e5e72f9e0440617545a2ebcb3fbf2701286b Mon Sep 17 00:00:00 2001 From: voluntas Date: Wed, 12 Jun 2024 10:30:57 +0900 Subject: [PATCH 02/34] =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=83=86=E3=83=8A?= =?UTF-8?q?=E3=83=B3=E3=82=B9=E3=83=9D=E3=83=AA=E3=82=B7=E3=83=BC=E3=81=AB?= =?UTF-8?q?=E3=81=A4=E3=81=84=E3=81=A6=E3=81=96=E3=81=A3=E3=81=8F=E3=82=8A?= =?UTF-8?q?=E6=9B=B8=E3=81=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 23 +++++---- doc/maintenance_policy.md | 104 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 118 insertions(+), 9 deletions(-) create mode 100644 doc/maintenance_policy.md diff --git a/README.md b/README.md index 237c65c7..9e226901 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ Please read before u - Google Android HWA - VP8 / VP9 / H.264 / H.265 - [Intel VPL](https://github.com/intel/libvpl) (Intel Media SDK の後継) - - VP9 / H.264 / H.265 + - VP9 / H.264 / H.265 / AV1 - H.265 は Windows と Ubuntu 22.04 のみ ## ライブラリのバイナリ提供について @@ -52,11 +52,9 @@ _hololens2 は無視してください_ - Windows 10.1809 x86_64 以降 - macOS 13.5 arm64 以降 -- Ubuntu 20.04 ARMv8 Jetson (JetPack 5.1.1 以降) +- Ubuntu 22.04 ARMv8 Jetson (JetPack 6.0.0 以降) - Jetson AGX Orin - - Jetson AGX Xavier - - Jetson Xavier NX -- Ubuntu 20.04 x86_64 + - Jetson Orin NX - Ubuntu 22.04 x86_64 - Android 7 arm64 以降 - iOS 13 arm64 以降 @@ -69,6 +67,12 @@ _hololens2 は無視してください_ [faq.md](doc/faq.md) をお読みください。 +## メンテナンスポリシー + +Sora C++ SDK のメンテナンスポリシーにはプライオリティがあります。 + +詳細については [maintenance_policy.md](doc/maintenance_policy.md) をお読みください。 + ## 優先実装 優先実装とは Sora のライセンスを契約頂いているお客様限定で Sora C++ SDK の実装予定機能を有償にて前倒しで実装することです。 @@ -76,15 +80,16 @@ _hololens2 は無視してください_ - Intel VPL H.265 対応 - [アダワープジャパン株式会社](https://adawarp.com/) 様 -### 優先実装が可能な機能一覧 +### 優先実装が可能な対応一覧 **詳細は Discord やメールなどでお気軽にお問い合わせください** +- NVIDIA Jetson JetPack 5 対応 +- NVIDIA Jetson JetPack 6 Jetson Orin Nano 対応 +- Raspberry Pi OS (64bit) arm64 対応 +- Windows arm64 対応 - Ubuntu 24.04 x86_64 -- Ubuntu 22.04 arm64 対応 - - NVIDIA Jetson JetPack 6 対応 - AMD 系 HWA 対応 -- Windows arm64 対応 ## サポートについて diff --git a/doc/maintenance_policy.md b/doc/maintenance_policy.md new file mode 100644 index 00000000..a3783776 --- /dev/null +++ b/doc/maintenance_policy.md @@ -0,0 +1,104 @@ +# メンテナンスポリシー + +Sora C++ SDK ではメンテナンスポリシーにはプライオリティがあります。 + +プライオリティは P1 から P4 まであります。 +P1 が一番プライオリティが高いです。 + +## プライオリティ + +- P1 と P2 は ``develop`` ブランチで開発します +- P1 と P2 ``main`` ブランチでリリースされます +- P1 と P2 ``main`` ブランチでタグを打ちます +- P1 と P2 は [Sora Unity SDK](https://github.com/shiguredo/sora-unity-sdk) で利用できます +- P1 と P2 は [Sora Python SDK](https://github.com/shiguredo/sora-python-sdk) で利用できます +- P1 は最新の OS や HWA への対応が C++ SDK のリリースのトリガーになる場合があります +- P2 は最新の OS や HWA への対応が C++ SDK のリリースのトリガーになりません +- P3 と P4 は C++ SDK メジャーリリースには含まれません +- P3 と P4 は ``support/`` ブランチでタグを打ちます +- P1 と P2 と P3 は Sora のメジャーリリースに追従します +- P4 は優先実装でのみ ``master`` ブランチへ追従します +- P4 は優先実装でのみアップデートを行います + +## 独自タグについて + +- P1 と P2 以外はそれぞれで独自タグを利用します +- タグの一番最後はリリース回数 +- リリース回数以外の文字列が変化したらリリース回数は 0 にもどす +- `{sora-cpp-sdk-version}-{platform-name}-{platform-version}.{release}` +- `2024.1.0-jetson-jetpack-5.1.3.0` +- `2024.1.0-jetson-jetpack-5.1.3.1` +- `2024.1.0-jetson-jetpack-5.1.3.2` +- `2024.1.0-jetson-jetpack-5.1.4.0` +- `2024.1.0-jetson-jetpack-5.1.4.1` +- `2024.1.0-jetson-jetpack-5.1.4.2` +- `2024.1.1-jetson-jetpack-5.1.4.0` +- `2024.1.1-jetson-jetpack-5.1.4.1` + +## P1 + +- Apple macOS / iOS / iPadOS +- Google Android + +### 方針 + +- `develop` ブランチで開発 +- `main` ブランチでリリース +- 最新の OS がリリースされたタイミングで対応 +- 最新のハードウェアアクセラレーターに対応 +- Sora メジャーリリースへ追従 +- リリースのタイミングで検証 + +## P2 + +- Intel VPL x86_64 + - Ubuntu 24.04 + - Ubuntu 22.04 + - Windows 11 +- NVIDIA Video Codec SDK x86_64 + - Ubuntu 24.04 + - Ubuntu 22.04 + - Windows 11 + +### 方針 + +- `develop` ブランチで開発 +- `main` ブランチでリリース +- 最新の OS がリリースされたタイミングでは対応しない +- 最新のハードウェアアクセラレーターに対応しない +- Sora メジャーリリースへの追従 +- リリースのタイミングでの検証は最低限 + +## P3 + +- NVIDIA Jetson JetPack 6 arm64 + - ブランチ: `support/jetson-jetpack-6` + - タグ: `{sora-cpp-sdk-version}-jetson-jetpack-{platform-version}.{release}` + - `2024.1.0-jetson-jetpack-6.0.0.0` +- Microsoft HoloLens 2 + - ブランチ: `support/hololens2` + - タグ: `{sora-cpp-sdk-version}-hololens2.{release}` + - `2024.1.0-hololens2.0` + +### 方針 + +- ``support`` ブランチで開発 +- 独自タグでリリースされる +- Sora メジャーリリースに追従する +- リリースのタイミングでの検証は最低限 + +## P4 + +- NVIDIA Jetson JetPack 6 arm64 + - ブランチ: `support/jetson-jetpack-7` + - タグ: `{sora-cpp-sdk-version}-jetson-jetpack-{platform-version}.{release}` + - `2024.1.0-jetson-jetpack-5.1.3.0` + +### 方針 + +- ``support`` ブランチで開発 +- 独自タグでリリースされる +- Sora メジャーリリースに追従しない +- リリースのタイミングでの検証は最低限 +- 優先実装でのみ Sora メジャーリリースへ追従 +- 優先実装でのみアップデートを行う From a4e2156a70bba515bf0c68816563c8c9cd1f0462 Mon Sep 17 00:00:00 2001 From: V Date: Wed, 12 Jun 2024 11:30:21 +0900 Subject: [PATCH 03/34] Update maintenance_policy.md --- doc/maintenance_policy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/maintenance_policy.md b/doc/maintenance_policy.md index a3783776..2c352f82 100644 --- a/doc/maintenance_policy.md +++ b/doc/maintenance_policy.md @@ -17,7 +17,7 @@ P1 が一番プライオリティが高いです。 - P3 と P4 は C++ SDK メジャーリリースには含まれません - P3 と P4 は ``support/`` ブランチでタグを打ちます - P1 と P2 と P3 は Sora のメジャーリリースに追従します -- P4 は優先実装でのみ ``master`` ブランチへ追従します +- P4 は優先実装でのみ ``main`` ブランチへ追従します - P4 は優先実装でのみアップデートを行います ## 独自タグについて From 29901d6048d4fca2120e08d0ffeeda62f0454584 Mon Sep 17 00:00:00 2001 From: voluntas Date: Wed, 12 Jun 2024 11:32:02 +0900 Subject: [PATCH 04/34] JetPack 5 --- doc/maintenance_policy.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/maintenance_policy.md b/doc/maintenance_policy.md index 2c352f82..38ea10c1 100644 --- a/doc/maintenance_policy.md +++ b/doc/maintenance_policy.md @@ -89,8 +89,8 @@ P1 が一番プライオリティが高いです。 ## P4 -- NVIDIA Jetson JetPack 6 arm64 - - ブランチ: `support/jetson-jetpack-7` +- NVIDIA Jetson JetPack 5 arm64 + - ブランチ: `support/jetson-jetpack-5` - タグ: `{sora-cpp-sdk-version}-jetson-jetpack-{platform-version}.{release}` - `2024.1.0-jetson-jetpack-5.1.3.0` From ca09fbf61b7dbebc15ae70b2b7f00195d0ab8035 Mon Sep 17 00:00:00 2001 From: melpon Date: Fri, 14 Jun 2024 03:35:09 +0900 Subject: [PATCH 05/34] =?UTF-8?q?NVIDIA=20Video=20Codec=20SDK=20=E3=82=92?= =?UTF-8?q?=20H265=20=E3=81=AB=E5=AF=BE=E5=BF=9C=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .vscode/c_cpp_properties.json | 3 +- CHANGES.md | 2 + CMakeLists.txt | 8 +- include/sora/cuda_context.h | 1 + .../sora/hwenc_nvcodec/nvcodec_h264_encoder.h | 24 --- .../hwenc_nvcodec/nvcodec_video_encoder.h | 25 +++ src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp | 9 +- ..._encoder.cpp => nvcodec_video_encoder.cpp} | 153 +++++++++++------- ...uda.cpp => nvcodec_video_encoder_cuda.cpp} | 80 ++++----- ...er_cuda.h => nvcodec_video_encoder_cuda.h} | 14 +- src/sora_video_encoder_factory.cpp | 41 +++-- 11 files changed, 198 insertions(+), 162 deletions(-) delete mode 100644 include/sora/hwenc_nvcodec/nvcodec_h264_encoder.h create mode 100644 include/sora/hwenc_nvcodec/nvcodec_video_encoder.h rename src/hwenc_nvcodec/{nvcodec_h264_encoder.cpp => nvcodec_video_encoder.cpp} (79%) rename src/hwenc_nvcodec/{nvcodec_h264_encoder_cuda.cpp => nvcodec_video_encoder_cuda.cpp} (71%) rename src/hwenc_nvcodec/{nvcodec_h264_encoder_cuda.h => nvcodec_video_encoder_cuda.h} (64%) diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json index 9e91c09c..c48c0204 100644 --- a/.vscode/c_cpp_properties.json +++ b/.vscode/c_cpp_properties.json @@ -97,7 +97,8 @@ "USE_VPL_ENCODER", "RTC_ENABLE_H265" ], - "compilerPath": "${workspaceFolder}/_install/ubuntu-22.04_x86_64/release/llvm/clang/bin/clang++", + // "compilerPath": "${workspaceFolder}/_install/ubuntu-22.04_x86_64/release/llvm/clang/bin/clang++", + "compilerPath": "/usr/bin/clang++-18", "compilerArgs": ["-nostdinc++"], "cStandard": "gnu17", "cppStandard": "gnu++17", diff --git a/CHANGES.md b/CHANGES.md index 3a513de1..1d009842 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -45,6 +45,8 @@ - @melpon - [ADD] Intel VPL で AV1 デコーダを動くようにする - @melpon +- [ADD] NVIDIA Video Codec SDK を H265 に対応する + - @melpon ## 2024.6.1 (2024-04-16) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1638f3d7..c8346228 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -249,7 +249,7 @@ if (SORA_TARGET_OS STREQUAL "windows") if (USE_NVCODEC_ENCODER) target_sources(sora PRIVATE - src/hwenc_nvcodec/nvcodec_h264_encoder.cpp + src/hwenc_nvcodec/nvcodec_video_encoder.cpp third_party/NvCodec/NvCodec/NvEncoder/NvEncoder.cpp third_party/NvCodec/NvCodec/NvEncoder/NvEncoderD3D11.cpp src/hwenc_nvcodec/nvcodec_video_decoder.cpp) @@ -459,9 +459,9 @@ elseif (SORA_TARGET_OS STREQUAL "ubuntu") target_sources(sora PRIVATE src/cuda_context_cuda.cpp - src/hwenc_nvcodec/nvcodec_h264_encoder.cpp + src/hwenc_nvcodec/nvcodec_video_encoder.cpp src/hwenc_nvcodec/nvcodec_v4l2_capturer.cpp - src/hwenc_nvcodec/nvcodec_h264_encoder_cuda.cpp + src/hwenc_nvcodec/nvcodec_video_encoder_cuda.cpp src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp src/hwenc_nvcodec/nvcodec_video_decoder.cpp third_party/NvCodec/NvCodec/NvDecoder/NvDecoder.cpp @@ -476,7 +476,7 @@ elseif (SORA_TARGET_OS STREQUAL "ubuntu") # これらのソースは CUDA としてコンパイルする set_source_files_properties( src/cuda_context_cuda.cpp - src/hwenc_nvcodec/nvcodec_h264_encoder_cuda.cpp + src/hwenc_nvcodec/nvcodec_video_encoder_cuda.cpp src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp third_party/NvCodec/NvCodec/NvDecoder/NvDecoder.cpp third_party/NvCodec/NvCodec/NvEncoder/NvEncoderCuda.cpp diff --git a/include/sora/cuda_context.h b/include/sora/cuda_context.h index 9cc82fab..dce68512 100644 --- a/include/sora/cuda_context.h +++ b/include/sora/cuda_context.h @@ -19,6 +19,7 @@ class CudaContext { enum class CudaVideoCodec { H264, + H265, VP8, VP9, JPEG, diff --git a/include/sora/hwenc_nvcodec/nvcodec_h264_encoder.h b/include/sora/hwenc_nvcodec/nvcodec_h264_encoder.h deleted file mode 100644 index 3bce4edb..00000000 --- a/include/sora/hwenc_nvcodec/nvcodec_h264_encoder.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef SORA_HWENC_NVCODEC_NVCODEC_H264_ENCODER_H_ -#define SORA_HWENC_NVCODEC_NVCODEC_H264_ENCODER_H_ - -#include - -// WebRTC -#include -#include - -#include "sora/cuda_context.h" - -namespace sora { - -class NvCodecH264Encoder : public webrtc::VideoEncoder { - public: - static bool IsSupported(std::shared_ptr cuda_context); - static std::unique_ptr Create( - const cricket::VideoCodec& codec, - std::shared_ptr cuda_context); -}; - -} // namespace sora - -#endif diff --git a/include/sora/hwenc_nvcodec/nvcodec_video_encoder.h b/include/sora/hwenc_nvcodec/nvcodec_video_encoder.h new file mode 100644 index 00000000..75b72abe --- /dev/null +++ b/include/sora/hwenc_nvcodec/nvcodec_video_encoder.h @@ -0,0 +1,25 @@ +#ifndef SORA_HWENC_NVCODEC_NVCODEC_VIDEO_ENCODER_H_ +#define SORA_HWENC_NVCODEC_NVCODEC_VIDEO_ENCODER_H_ + +#include + +// WebRTC +#include +#include + +#include "sora/cuda_context.h" + +namespace sora { + +class NvCodecVideoEncoder : public webrtc::VideoEncoder { + public: + static bool IsSupported(std::shared_ptr cuda_context, + CudaVideoCodec codec); + static std::unique_ptr Create( + std::shared_ptr cuda_context, + CudaVideoCodec codec); +}; + +} // namespace sora + +#endif diff --git a/src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp b/src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp index 2f0b3015..354b199f 100644 --- a/src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp +++ b/src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp @@ -8,10 +8,11 @@ namespace sora { static cudaVideoCodec ToCudaVideoCodec(CudaVideoCodec codec) { - return codec == CudaVideoCodec::H264 ? cudaVideoCodec_H264 - : codec == CudaVideoCodec::VP8 ? cudaVideoCodec_VP8 - : codec == CudaVideoCodec::VP9 ? cudaVideoCodec_VP9 - : cudaVideoCodec_JPEG; + return codec == CudaVideoCodec::H264 ? cudaVideoCodec_H264 + : codec == CudaVideoCodec::H265 ? cudaVideoCodec_HEVC + : codec == CudaVideoCodec::VP8 ? cudaVideoCodec_VP8 + : codec == CudaVideoCodec::VP9 ? cudaVideoCodec_VP9 + : cudaVideoCodec_JPEG; } #define CUDA_DRVAPI_CALL(call) \ diff --git a/src/hwenc_nvcodec/nvcodec_h264_encoder.cpp b/src/hwenc_nvcodec/nvcodec_video_encoder.cpp similarity index 79% rename from src/hwenc_nvcodec/nvcodec_h264_encoder.cpp rename to src/hwenc_nvcodec/nvcodec_video_encoder.cpp index 114b97df..ed05d326 100644 --- a/src/hwenc_nvcodec/nvcodec_h264_encoder.cpp +++ b/src/hwenc_nvcodec/nvcodec_video_encoder.cpp @@ -1,6 +1,6 @@ #include "sora/fix_cuda_noinline_macro_error.h" -#include "sora/hwenc_nvcodec/nvcodec_h264_encoder.h" +#include "sora/hwenc_nvcodec/nvcodec_video_encoder.h" #ifdef _WIN32 #include @@ -15,6 +15,7 @@ // WebRTC #include #include +#include #include #include #include @@ -29,7 +30,7 @@ #include #endif #ifdef __linux__ -#include "nvcodec_h264_encoder_cuda.h" +#include "nvcodec_video_encoder_cuda.h" #endif #ifdef __linux__ @@ -51,13 +52,14 @@ struct nal_entry { using Microsoft::WRL::ComPtr; #endif -class NvCodecH264EncoderImpl : public NvCodecH264Encoder { +class NvCodecVideoEncoderImpl : public NvCodecVideoEncoder { public: - NvCodecH264EncoderImpl(const cricket::VideoCodec& codec, - std::shared_ptr cuda_context); - ~NvCodecH264EncoderImpl() override; + NvCodecVideoEncoderImpl(std::shared_ptr cuda_context, + CudaVideoCodec codec); + ~NvCodecVideoEncoderImpl() override; - static bool IsSupported(std::shared_ptr cuda_context); + static bool IsSupported(std::shared_ptr cuda_context, + CudaVideoCodec codec); int32_t InitEncode(const webrtc::VideoCodec* codec_settings, int32_t number_of_cores, @@ -73,6 +75,7 @@ class NvCodecH264EncoderImpl : public NvCodecH264Encoder { webrtc::VideoEncoder::EncoderInfo GetEncoderInfo() const override; static std::unique_ptr CreateEncoder( + CudaVideoCodec codec, int width, int height, int framerate, @@ -85,7 +88,7 @@ class NvCodecH264EncoderImpl : public NvCodecH264Encoder { #endif #ifdef __linux__ , - NvCodecH264EncoderCuda* cuda, + NvCodecVideoEncoderCuda* cuda, bool is_nv12 #endif ); @@ -100,8 +103,10 @@ class NvCodecH264EncoderImpl : public NvCodecH264Encoder { int32_t InitNvEnc(); int32_t ReleaseNvEnc(); webrtc::H264BitstreamParser h264_bitstream_parser_; + webrtc::H265BitstreamParser h265_bitstream_parser_; std::shared_ptr cuda_context_; + CudaVideoCodec codec_; std::unique_ptr nv_encoder_; #ifdef _WIN32 Microsoft::WRL::ComPtr id3d11_device_; @@ -109,7 +114,7 @@ class NvCodecH264EncoderImpl : public NvCodecH264Encoder { Microsoft::WRL::ComPtr id3d11_texture_; #endif #ifdef __linux__ - std::unique_ptr cuda_; + std::unique_ptr cuda_; bool is_nv12_ = false; #endif bool reconfigure_needed_ = false; @@ -122,10 +127,10 @@ class NvCodecH264EncoderImpl : public NvCodecH264Encoder { webrtc::EncodedImage encoded_image_; }; -NvCodecH264EncoderImpl::NvCodecH264EncoderImpl( - const cricket::VideoCodec& codec, - std::shared_ptr cuda_context) - : cuda_context_(cuda_context), bitrate_adjuster_(0.5, 0.95) { +NvCodecVideoEncoderImpl::NvCodecVideoEncoderImpl( + std::shared_ptr cuda_context, + CudaVideoCodec codec) + : cuda_context_(cuda_context), codec_(codec), bitrate_adjuster_(0.5, 0.95) { #ifdef _WIN32 ComPtr idxgi_factory; RTC_CHECK(!FAILED(CreateDXGIFactory1(__uuidof(IDXGIFactory1), @@ -147,18 +152,17 @@ NvCodecH264EncoderImpl::NvCodecH264EncoderImpl( RTC_LOG(LS_INFO) << __FUNCTION__ << "GPU in use: " << szDesc; #endif #ifdef __linux__ - cuda_.reset(new NvCodecH264EncoderCuda(cuda_context_)); + cuda_.reset(new NvCodecVideoEncoderCuda(cuda_context_)); #endif } -NvCodecH264EncoderImpl::~NvCodecH264EncoderImpl() {} +NvCodecVideoEncoderImpl::~NvCodecVideoEncoderImpl() {} -int32_t NvCodecH264EncoderImpl::InitEncode( +int32_t NvCodecVideoEncoderImpl::InitEncode( const webrtc::VideoCodec* codec_settings, int32_t number_of_cores, size_t max_payload_size) { RTC_DCHECK(codec_settings); - RTC_DCHECK_EQ(codec_settings->codecType, webrtc::kVideoCodecH264); int32_t release_ret = Release(); if (release_ret != WEBRTC_VIDEO_CODEC_OK) { @@ -178,18 +182,18 @@ int32_t NvCodecH264EncoderImpl::InitEncode( return InitNvEnc(); } -int32_t NvCodecH264EncoderImpl::RegisterEncodeCompleteCallback( +int32_t NvCodecVideoEncoderImpl::RegisterEncodeCompleteCallback( webrtc::EncodedImageCallback* callback) { std::lock_guard lock(mutex_); callback_ = callback; return WEBRTC_VIDEO_CODEC_OK; } -int32_t NvCodecH264EncoderImpl::Release() { +int32_t NvCodecVideoEncoderImpl::Release() { return ReleaseNvEnc(); } -int32_t NvCodecH264EncoderImpl::Encode( +int32_t NvCodecVideoEncoderImpl::Encode( const webrtc::VideoFrame& frame, const std::vector* frame_types) { //RTC_LOG(LS_ERROR) << __FUNCTION__ << " Start"; @@ -374,12 +378,21 @@ int32_t NvCodecH264EncoderImpl::Encode( } webrtc::CodecSpecificInfo codec_specific; - codec_specific.codecType = webrtc::kVideoCodecH264; - codec_specific.codecSpecific.H264.packetization_mode = - webrtc::H264PacketizationMode::NonInterleaved; - - h264_bitstream_parser_.ParseBitstream(encoded_image_); - encoded_image_.qp_ = h264_bitstream_parser_.GetLastSliceQp().value_or(-1); + if (codec_ == CudaVideoCodec::H264) { + codec_specific.codecType = webrtc::kVideoCodecH264; + codec_specific.codecSpecific.H264.packetization_mode = + webrtc::H264PacketizationMode::NonInterleaved; + + h264_bitstream_parser_.ParseBitstream(encoded_image_); + encoded_image_.qp_ = h264_bitstream_parser_.GetLastSliceQp().value_or(-1); + } else if (codec_ == CudaVideoCodec::H265) { + codec_specific.codecType = webrtc::kVideoCodecH265; + codec_specific.codecSpecific.H265.packetization_mode = + webrtc::H265PacketizationMode::NonInterleaved; + + h265_bitstream_parser_.ParseBitstream(encoded_image_); + encoded_image_.qp_ = h265_bitstream_parser_.GetLastSliceQp().value_or(-1); + } webrtc::EncodedImageCallback::Result result = callback_->OnEncodedImage(encoded_image_, &codec_specific); @@ -394,7 +407,7 @@ int32_t NvCodecH264EncoderImpl::Encode( return WEBRTC_VIDEO_CODEC_OK; } -void NvCodecH264EncoderImpl::SetRates( +void NvCodecVideoEncoderImpl::SetRates( const webrtc::VideoEncoder::RateControlParameters& parameters) { if (!nv_encoder_) { RTC_LOG(LS_WARNING) << "SetRates() while uninitialized."; @@ -419,25 +432,26 @@ void NvCodecH264EncoderImpl::SetRates( reconfigure_needed_ = true; } -webrtc::VideoEncoder::EncoderInfo NvCodecH264EncoderImpl::GetEncoderInfo() +webrtc::VideoEncoder::EncoderInfo NvCodecVideoEncoderImpl::GetEncoderInfo() const { webrtc::VideoEncoder::EncoderInfo info; info.supports_native_handle = true; - info.implementation_name = "NvCodec H264"; + info.implementation_name = "NvCodec"; info.scaling_settings = webrtc::VideoEncoder::ScalingSettings( kLowH264QpThreshold, kHighH264QpThreshold); return info; } -int32_t NvCodecH264EncoderImpl::InitNvEnc() { +int32_t NvCodecVideoEncoderImpl::InitNvEnc() { #ifdef _WIN32 - nv_encoder_ = CreateEncoder(width_, height_, framerate_, target_bitrate_bps_, - max_bitrate_bps_, id3d11_device_.Get(), - id3d11_texture_.GetAddressOf()); + nv_encoder_ = CreateEncoder( + codec_, width_, height_, framerate_, target_bitrate_bps_, + max_bitrate_bps_, id3d11_device_.Get(), id3d11_texture_.GetAddressOf()); #endif #ifdef __linux__ - nv_encoder_ = CreateEncoder(width_, height_, framerate_, target_bitrate_bps_, - max_bitrate_bps_, cuda_.get(), is_nv12_); + nv_encoder_ = + CreateEncoder(codec_, width_, height_, framerate_, target_bitrate_bps_, + max_bitrate_bps_, cuda_.get(), is_nv12_); #endif if (nv_encoder_ == nullptr) { @@ -449,7 +463,7 @@ int32_t NvCodecH264EncoderImpl::InitNvEnc() { return WEBRTC_VIDEO_CODEC_OK; } -int32_t NvCodecH264EncoderImpl::ReleaseNvEnc() { +int32_t NvCodecVideoEncoderImpl::ReleaseNvEnc() { if (nv_encoder_) { try { nv_encoder_->EndEncode(v_packet_); @@ -465,7 +479,8 @@ int32_t NvCodecH264EncoderImpl::ReleaseNvEnc() { return WEBRTC_VIDEO_CODEC_OK; } -std::unique_ptr NvCodecH264EncoderImpl::CreateEncoder( +std::unique_ptr NvCodecVideoEncoderImpl::CreateEncoder( + CudaVideoCodec codec, int width, int height, int framerate, @@ -478,7 +493,7 @@ std::unique_ptr NvCodecH264EncoderImpl::CreateEncoder( #endif #ifdef __linux__ , - NvCodecH264EncoderCuda* cuda, + NvCodecVideoEncoderCuda* cuda, bool is_nv12 #endif ) { @@ -523,9 +538,15 @@ std::unique_ptr NvCodecH264EncoderImpl::CreateEncoder( NV_ENC_CONFIG encode_config = {NV_ENC_CONFIG_VER}; initialize_params.encodeConfig = &encode_config; try { - encoder->CreateDefaultEncoderParams( - &initialize_params, NV_ENC_CODEC_H264_GUID, NV_ENC_PRESET_P3_GUID, - NV_ENC_TUNING_INFO_LOW_LATENCY); + if (codec == CudaVideoCodec::H264) { + encoder->CreateDefaultEncoderParams( + &initialize_params, NV_ENC_CODEC_H264_GUID, NV_ENC_PRESET_P3_GUID, + NV_ENC_TUNING_INFO_LOW_LATENCY); + } else if (codec == CudaVideoCodec::H265) { + encoder->CreateDefaultEncoderParams( + &initialize_params, NV_ENC_CODEC_HEVC_GUID, NV_ENC_PRESET_P2_GUID, + NV_ENC_TUNING_INFO_LOW_LATENCY); + } //initialize_params.enablePTD = 1; initialize_params.frameRateDen = 1; @@ -548,14 +569,22 @@ std::unique_ptr NvCodecH264EncoderImpl::CreateEncoder( encode_config.frameIntervalP = 1; encode_config.rcParams.enableAQ = 1; - //encode_config.encodeCodecConfig.h264Config.outputAUD = 1; - //encode_config.encodeCodecConfig.h264Config.level = NV_ENC_LEVEL_H264_31; - //encode_config.encodeCodecConfig.h264Config.entropyCodingMode = NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC; - encode_config.encodeCodecConfig.h264Config.idrPeriod = - NVENC_INFINITE_GOPLENGTH; - encode_config.encodeCodecConfig.h264Config.repeatSPSPPS = 1; - encode_config.encodeCodecConfig.h264Config.sliceMode = 0; - encode_config.encodeCodecConfig.h264Config.sliceModeData = 0; + if (codec == CudaVideoCodec::H264) { + //encode_config.encodeCodecConfig.h264Config.outputAUD = 1; + //encode_config.encodeCodecConfig.h264Config.level = NV_ENC_LEVEL_H264_31; + //encode_config.encodeCodecConfig.h264Config.entropyCodingMode = NV_ENC_H264_ENTROPY_CODING_MODE_CAVLC; + encode_config.encodeCodecConfig.h264Config.idrPeriod = + NVENC_INFINITE_GOPLENGTH; + encode_config.encodeCodecConfig.h264Config.repeatSPSPPS = 1; + encode_config.encodeCodecConfig.h264Config.sliceMode = 0; + encode_config.encodeCodecConfig.h264Config.sliceModeData = 0; + } else if (codec == CudaVideoCodec::H265) { + encode_config.encodeCodecConfig.hevcConfig.idrPeriod = + NVENC_INFINITE_GOPLENGTH; + encode_config.encodeCodecConfig.hevcConfig.repeatSPSPPS = 1; + encode_config.encodeCodecConfig.hevcConfig.sliceMode = 0; + encode_config.encodeCodecConfig.hevcConfig.sliceModeData = 0; + } encoder->CreateEncoder(&initialize_params); @@ -570,8 +599,8 @@ std::unique_ptr NvCodecH264EncoderImpl::CreateEncoder( return encoder; } -bool NvCodecH264Encoder::IsSupported( - std::shared_ptr cuda_context) { +bool NvCodecVideoEncoder::IsSupported(std::shared_ptr cuda_context, + CudaVideoCodec codec) { try { NvEncoder::TryLoadNvEncApi(); @@ -614,15 +643,15 @@ bool NvCodecH264Encoder::IsSupported( D3D11_SDK_VERSION, id3d11_device.GetAddressOf(), NULL, id3d11_context.GetAddressOf()))); - auto encoder = NvCodecH264EncoderImpl::CreateEncoder( - 640, 480, 30, 100 * 1000, 500 * 1000, id3d11_device.Get(), + auto encoder = NvCodecVideoEncoderImpl::CreateEncoder( + codec, 640, 480, 30, 100 * 1000, 500 * 1000, id3d11_device.Get(), id3d11_texture.GetAddressOf()); #endif #ifdef __linux__ - auto cuda = std::unique_ptr( - new NvCodecH264EncoderCuda(cuda_context)); - auto encoder = NvCodecH264EncoderImpl::CreateEncoder( - 640, 480, 30, 100 * 1000, 500 * 1000, cuda.get(), true); + auto cuda = std::unique_ptr( + new NvCodecVideoEncoderCuda(cuda_context)); + auto encoder = NvCodecVideoEncoderImpl::CreateEncoder( + codec, 640, 480, 30, 100 * 1000, 500 * 1000, cuda.get(), true); #endif if (encoder == nullptr) { return false; @@ -635,11 +664,11 @@ bool NvCodecH264Encoder::IsSupported( } } -std::unique_ptr NvCodecH264Encoder::Create( - const cricket::VideoCodec& codec, - std::shared_ptr cuda_context) { - return std::unique_ptr( - new NvCodecH264EncoderImpl(codec, cuda_context)); +std::unique_ptr NvCodecVideoEncoder::Create( + std::shared_ptr cuda_context, + CudaVideoCodec codec) { + return std::unique_ptr( + new NvCodecVideoEncoderImpl(cuda_context, codec)); } } // namespace sora diff --git a/src/hwenc_nvcodec/nvcodec_h264_encoder_cuda.cpp b/src/hwenc_nvcodec/nvcodec_video_encoder_cuda.cpp similarity index 71% rename from src/hwenc_nvcodec/nvcodec_h264_encoder_cuda.cpp rename to src/hwenc_nvcodec/nvcodec_video_encoder_cuda.cpp index e5ba12a0..a9914d77 100644 --- a/src/hwenc_nvcodec/nvcodec_h264_encoder_cuda.cpp +++ b/src/hwenc_nvcodec/nvcodec_video_encoder_cuda.cpp @@ -1,6 +1,6 @@ #include "sora/fix_cuda_noinline_macro_error.h" -#include "nvcodec_h264_encoder_cuda.h" +#include "nvcodec_video_encoder_cuda.h" #include @@ -13,10 +13,10 @@ namespace sora { -class NvCodecH264EncoderCudaImpl { +class NvCodecVideoEncoderCudaImpl { public: - NvCodecH264EncoderCudaImpl(std::shared_ptr ctx); - ~NvCodecH264EncoderCudaImpl(); + NvCodecVideoEncoderCudaImpl(std::shared_ptr ctx); + ~NvCodecVideoEncoderCudaImpl(); void Copy(NvEncoder* nv_encoder, const void* ptr, int width, int height); NvEncoder* CreateNvEncoder(int width, int height, bool is_nv12); @@ -25,21 +25,22 @@ class NvCodecH264EncoderCudaImpl { std::shared_ptr cuda_context_; }; -NvCodecH264EncoderCuda::NvCodecH264EncoderCuda(std::shared_ptr ctx) - : impl_(new NvCodecH264EncoderCudaImpl(ctx)) {} -NvCodecH264EncoderCuda::~NvCodecH264EncoderCuda() { +NvCodecVideoEncoderCuda::NvCodecVideoEncoderCuda( + std::shared_ptr ctx) + : impl_(new NvCodecVideoEncoderCudaImpl(ctx)) {} +NvCodecVideoEncoderCuda::~NvCodecVideoEncoderCuda() { delete impl_; } -void NvCodecH264EncoderCuda::Copy(NvEncoder* nv_encoder, - const void* ptr, - int width, - int height) { +void NvCodecVideoEncoderCuda::Copy(NvEncoder* nv_encoder, + const void* ptr, + int width, + int height) { impl_->Copy(nv_encoder, ptr, width, height); } -NvEncoder* NvCodecH264EncoderCuda::CreateNvEncoder(int width, - int height, - bool is_nv12) { +NvEncoder* NvCodecVideoEncoderCuda::CreateNvEncoder(int width, + int height, + bool is_nv12) { return impl_->CreateNvEncoder(width, height, is_nv12); } @@ -63,79 +64,68 @@ void ShowEncoderCapability() { std::cout << "GPU " << iGpu << " - " << szDeviceName << std::endl << std::endl; std::cout - << "\tH264:\t\t" - << " " + << "\tH264:\t\t" << " " << (enc.GetCapabilityValue(NV_ENC_CODEC_H264_GUID, NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES) ? "yes" : "no") << std::endl - << "\tH264_444:\t" - << " " + << "\tH264_444:\t" << " " << (enc.GetCapabilityValue(NV_ENC_CODEC_H264_GUID, NV_ENC_CAPS_SUPPORT_YUV444_ENCODE) ? "yes" : "no") << std::endl - << "\tH264_ME:\t" - << " " + << "\tH264_ME:\t" << " " << (enc.GetCapabilityValue(NV_ENC_CODEC_H264_GUID, NV_ENC_CAPS_SUPPORT_MEONLY_MODE) ? "yes" : "no") << std::endl - << "\tH264_WxH:\t" - << " " + << "\tH264_WxH:\t" << " " << (enc.GetCapabilityValue(NV_ENC_CODEC_H264_GUID, NV_ENC_CAPS_WIDTH_MAX)) << "*" << (enc.GetCapabilityValue(NV_ENC_CODEC_H264_GUID, NV_ENC_CAPS_HEIGHT_MAX)) << std::endl - << "\tHEVC:\t\t" - << " " + << "\tHEVC:\t\t" << " " << (enc.GetCapabilityValue(NV_ENC_CODEC_HEVC_GUID, NV_ENC_CAPS_SUPPORTED_RATECONTROL_MODES) ? "yes" : "no") << std::endl - << "\tHEVC_Main10:\t" - << " " + << "\tHEVC_Main10:\t" << " " << (enc.GetCapabilityValue(NV_ENC_CODEC_HEVC_GUID, NV_ENC_CAPS_SUPPORT_10BIT_ENCODE) ? "yes" : "no") << std::endl - << "\tHEVC_Lossless:\t" - << " " + << "\tHEVC_Lossless:\t" << " " << (enc.GetCapabilityValue(NV_ENC_CODEC_HEVC_GUID, NV_ENC_CAPS_SUPPORT_LOSSLESS_ENCODE) ? "yes" : "no") << std::endl - << "\tHEVC_SAO:\t" - << " " + << "\tHEVC_SAO:\t" << " " << (enc.GetCapabilityValue(NV_ENC_CODEC_HEVC_GUID, NV_ENC_CAPS_SUPPORT_SAO) ? "yes" : "no") << std::endl - << "\tHEVC_444:\t" - << " " + << "\tHEVC_444:\t" << " " << (enc.GetCapabilityValue(NV_ENC_CODEC_HEVC_GUID, NV_ENC_CAPS_SUPPORT_YUV444_ENCODE) ? "yes" : "no") << std::endl - << "\tHEVC_ME:\t" - << " " + << "\tHEVC_ME:\t" << " " << (enc.GetCapabilityValue(NV_ENC_CODEC_HEVC_GUID, NV_ENC_CAPS_SUPPORT_MEONLY_MODE) ? "yes" : "no") << std::endl - << "\tHEVC_WxH:\t" - << " " + << "\tHEVC_WxH:\t" << " " << (enc.GetCapabilityValue(NV_ENC_CODEC_HEVC_GUID, NV_ENC_CAPS_WIDTH_MAX)) << "*" @@ -150,16 +140,16 @@ void ShowEncoderCapability() { } } -NvCodecH264EncoderCudaImpl::NvCodecH264EncoderCudaImpl( +NvCodecVideoEncoderCudaImpl::NvCodecVideoEncoderCudaImpl( std::shared_ptr ctx) { ShowEncoderCapability(); cuda_context_ = ctx; } -NvCodecH264EncoderCudaImpl::~NvCodecH264EncoderCudaImpl() {} -void NvCodecH264EncoderCudaImpl::Copy(NvEncoder* nv_encoder, - const void* ptr, - int width, - int height) { +NvCodecVideoEncoderCudaImpl::~NvCodecVideoEncoderCudaImpl() {} +void NvCodecVideoEncoderCudaImpl::Copy(NvEncoder* nv_encoder, + const void* ptr, + int width, + int height) { const NvEncInputFrame* input_frame = nv_encoder->GetNextInputFrame(); CUcontext context = GetCudaContext(cuda_context_); NvEncoderCuda::CopyToDeviceFrame( @@ -168,9 +158,9 @@ void NvCodecH264EncoderCudaImpl::Copy(NvEncoder* nv_encoder, input_frame->bufferFormat, input_frame->chromaOffsets, input_frame->numChromaPlanes); } -NvEncoder* NvCodecH264EncoderCudaImpl::CreateNvEncoder(int width, - int height, - bool is_nv12) { +NvEncoder* NvCodecVideoEncoderCudaImpl::CreateNvEncoder(int width, + int height, + bool is_nv12) { NV_ENC_BUFFER_FORMAT nvenc_format = is_nv12 ? NV_ENC_BUFFER_FORMAT_NV12 : NV_ENC_BUFFER_FORMAT_IYUV; CUcontext context = GetCudaContext(cuda_context_); diff --git a/src/hwenc_nvcodec/nvcodec_h264_encoder_cuda.h b/src/hwenc_nvcodec/nvcodec_video_encoder_cuda.h similarity index 64% rename from src/hwenc_nvcodec/nvcodec_h264_encoder_cuda.h rename to src/hwenc_nvcodec/nvcodec_video_encoder_cuda.h index 424aa42d..1757dd3a 100644 --- a/src/hwenc_nvcodec/nvcodec_h264_encoder_cuda.h +++ b/src/hwenc_nvcodec/nvcodec_video_encoder_cuda.h @@ -1,5 +1,5 @@ -#ifndef SORA_HWENC_NVCODEC_NVCODEC_H264_ENCODER_CUDA_H_ -#define SORA_HWENC_NVCODEC_NVCODEC_H264_ENCODER_CUDA_H_ +#ifndef SORA_HWENC_NVCODEC_NVCODEC_VIDEO_ENCODER_CUDA_H_ +#define SORA_HWENC_NVCODEC_NVCODEC_VIDEO_ENCODER_CUDA_H_ // CUDA と WebRTC のヘッダを混ぜてコンパイルすると大量のエラーが発生したので、 // CUDA の処理だけさせる単純な CUDA ファイルを用意する @@ -12,19 +12,19 @@ class NvEncoder; namespace sora { -class NvCodecH264EncoderCudaImpl; +class NvCodecVideoEncoderCudaImpl; -class NvCodecH264EncoderCuda { +class NvCodecVideoEncoderCuda { public: - NvCodecH264EncoderCuda(std::shared_ptr ctx); - ~NvCodecH264EncoderCuda(); + NvCodecVideoEncoderCuda(std::shared_ptr ctx); + ~NvCodecVideoEncoderCuda(); void Copy(NvEncoder* nv_encoder, const void* ptr, int width, int height); // 念のため も include せずポインタを利用する NvEncoder* CreateNvEncoder(int width, int height, bool is_nv12); private: - NvCodecH264EncoderCudaImpl* impl_; + NvCodecVideoEncoderCudaImpl* impl_; }; } // namespace sora diff --git a/src/sora_video_encoder_factory.cpp b/src/sora_video_encoder_factory.cpp index be500d80..a42592e6 100644 --- a/src/sora_video_encoder_factory.cpp +++ b/src/sora_video_encoder_factory.cpp @@ -28,7 +28,7 @@ #endif #if defined(USE_NVCODEC_ENCODER) -#include "sora/hwenc_nvcodec/nvcodec_h264_encoder.h" +#include "sora/hwenc_nvcodec/nvcodec_video_encoder.h" #endif #if defined(USE_VPL_ENCODER) @@ -183,17 +183,27 @@ SoraVideoEncoderFactoryConfig GetDefaultVideoEncoderFactoryConfig( #endif #if defined(USE_NVCODEC_ENCODER) - if (NvCodecH264Encoder::IsSupported(cuda_context)) { - config.encoders.insert( - config.encoders.begin(), - VideoEncoderConfig( - webrtc::kVideoCodecH264, - [cuda_context = cuda_context]( - auto format) -> std::unique_ptr { - return NvCodecH264Encoder::Create( - cricket::CreateVideoCodec(format), cuda_context); - }, - 16)); + if (NvCodecVideoEncoder::IsSupported(cuda_context, CudaVideoCodec::H264)) { + config.encoders.insert(config.encoders.begin(), + VideoEncoderConfig( + webrtc::kVideoCodecH264, + [cuda_context = cuda_context](auto format) + -> std::unique_ptr { + return NvCodecVideoEncoder::Create( + cuda_context, CudaVideoCodec::H264); + }, + 16)); + } + if (NvCodecVideoEncoder::IsSupported(cuda_context, CudaVideoCodec::H265)) { + config.encoders.insert(config.encoders.begin(), + VideoEncoderConfig( + webrtc::kVideoCodecH265, + [cuda_context = cuda_context](auto format) + -> std::unique_ptr { + return NvCodecVideoEncoder::Create( + cuda_context, CudaVideoCodec::H265); + }, + 16)); } #endif @@ -277,9 +287,10 @@ SoraVideoEncoderFactoryConfig GetSoftwareOnlyVideoEncoderFactoryConfig( })); } #if !defined(__arm__) || defined(__aarch64__) || defined(__ARM_NEON__) - config.encoders.push_back(VideoEncoderConfig( - webrtc::kVideoCodecAV1, - [](auto format) { return webrtc::CreateLibaomAv1Encoder(webrtc::CreateEnvironment()); })); + config.encoders.push_back( + VideoEncoderConfig(webrtc::kVideoCodecAV1, [](auto format) { + return webrtc::CreateLibaomAv1Encoder(webrtc::CreateEnvironment()); + })); #endif return config; } From 9477daa03e2591b97d3eeda1e3be30a7b67583c4 Mon Sep 17 00:00:00 2001 From: melpon Date: Fri, 14 Jun 2024 04:00:51 +0900 Subject: [PATCH 06/34] =?UTF-8?q?=E8=A8=AD=E5=AE=9A=E5=BF=98=E3=82=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/sora_video_decoder_factory.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/sora_video_decoder_factory.cpp b/src/sora_video_decoder_factory.cpp index bfc62bac..f817a720 100644 --- a/src/sora_video_decoder_factory.cpp +++ b/src/sora_video_decoder_factory.cpp @@ -156,6 +156,17 @@ SoraVideoDecoderFactoryConfig GetDefaultVideoDecoderFactoryConfig( cuda_context, CudaVideoCodec::H264)); })); } + if (NvCodecVideoDecoder::IsSupported(cuda_context, + sora::CudaVideoCodec::H265)) { + config.decoders.insert( + config.decoders.begin(), + VideoDecoderConfig(webrtc::kVideoCodecH265, + [cuda_context = cuda_context](auto format) { + return std::unique_ptr( + absl::make_unique( + cuda_context, CudaVideoCodec::H265)); + })); + } #endif #if USE_VPL_ENCODER From 6880d9ea980a5f285ae690e329bd3811f3bce438 Mon Sep 17 00:00:00 2001 From: voluntas Date: Sun, 16 Jun 2024 12:50:58 +0900 Subject: [PATCH 07/34] =?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 +- examples/VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 126db063..ac0b2c2d 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.2 +SORA_CPP_SDK_VERSION=2024.7.0-canary.3 WEBRTC_BUILD_VERSION=m125.6422.2.1 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.28.1 diff --git a/examples/VERSION b/examples/VERSION index 8a2121c4..2eb62b3d 100644 --- a/examples/VERSION +++ b/examples/VERSION @@ -1,4 +1,4 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.2 +SORA_CPP_SDK_VERSION=2024.7.0-canary.3 WEBRTC_BUILD_VERSION=m125.6422.2.1 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.28.1 From 731abd0648b166b1f149dec6c0b7ec5e3c859df0 Mon Sep 17 00:00:00 2001 From: melpon Date: Tue, 18 Jun 2024 14:23:59 +0900 Subject: [PATCH 08/34] =?UTF-8?q?AV1=20=E3=81=AE=E5=80=A4=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/sora/cuda_context.h | 1 + src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp | 1 + 2 files changed, 2 insertions(+) diff --git a/include/sora/cuda_context.h b/include/sora/cuda_context.h index dce68512..0fe455ab 100644 --- a/include/sora/cuda_context.h +++ b/include/sora/cuda_context.h @@ -22,6 +22,7 @@ enum class CudaVideoCodec { H265, VP8, VP9, + AV1, JPEG, }; diff --git a/src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp b/src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp index 354b199f..da2e5849 100644 --- a/src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp +++ b/src/hwenc_nvcodec/nvcodec_decoder_cuda.cpp @@ -12,6 +12,7 @@ static cudaVideoCodec ToCudaVideoCodec(CudaVideoCodec codec) { : codec == CudaVideoCodec::H265 ? cudaVideoCodec_HEVC : codec == CudaVideoCodec::VP8 ? cudaVideoCodec_VP8 : codec == CudaVideoCodec::VP9 ? cudaVideoCodec_VP9 + : codec == CudaVideoCodec::AV1 ? cudaVideoCodec_AV1 : cudaVideoCodec_JPEG; } From 4107a3eee1efa45ff6b6db148dff41a79280ee2c Mon Sep 17 00:00:00 2001 From: melpon Date: Mon, 24 Jun 2024 06:49:05 +0900 Subject: [PATCH 09/34] =?UTF-8?q?Ubuntu=2024.04=20=E5=AF=BE=E5=BF=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 85 +++++++++++++++++++++++++------------ CHANGES.md | 4 +- CMakeLists.txt | 5 +++ VERSION | 2 +- run.py | 16 ++++++- 5 files changed, 82 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 57df77c4..4952c394 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -156,17 +156,26 @@ jobs: strategy: fail-fast: false matrix: - name: - - ubuntu-20.04_x86_64 - - ubuntu-22.04_x86_64 - - android - name: Build sora-cpp-sdk for ${{ matrix.name }} - runs-on: ${{ matrix.name == 'ubuntu-22.04_x86_64' && 'ubuntu-22.04' || 'ubuntu-20.04' }} + platform: + - name: ubuntu-20.04_x86_64 + runs-on: ubuntu-20.04 + os: ubuntu + - name: ubuntu-22.04_x86_64 + runs-on: ubuntu-22.04 + os: ubuntu + - name: ubuntu-24.04_x86_64 + runs-on: ubuntu-24.04 + os: ubuntu + - name: android + runs-on: ubuntu-22.04 + os: android + name: Build sora-cpp-sdk for ${{ matrix.platform.name }} + runs-on: ${{ matrix.platform.runs-on }} env: TEST_SIGNALING_URL: ${{ secrets.TEST_SIGNALING_URL }} TEST_CHANNEL_ID_PREFIX: ${{ secrets.TEST_CHANNEL_ID_PREFIX }} TEST_SECRET_KEY: ${{ secrets.TEST_SECRET_KEY }} - TEST_MATRIX_NAME: ${{ matrix.name }} + TEST_MATRIX_NAME: ${{ matrix.platform.name }} steps: - uses: actions/checkout@v4 - name: Disk cleanup @@ -177,7 +186,10 @@ jobs: sudo du -h -d1 /usr/local/share sudo du -h -d1 /usr/local/lib sudo du -h -d1 /usr/share - docker rmi `docker images -q -a` + RMI=`docker images -q -a` + if [ -n "$RMI" ]; then + docker rmi $RMI + fi # 4.6G sudo rm -rf /usr/local/.ghcup # 1.7G @@ -185,8 +197,26 @@ jobs: # 1.4G sudo rm -rf /usr/share/dotnet df -h - - name: Install deps for ${{ matrix.name }} - if: matrix.name == 'ubuntu-20.04_x86_64' || matrix.name == 'ubuntu-22.04_x86_64' + # Ubuntu 24.04 だと libtinfo5 が見つからない問題があるので、その修正 + # ref: https://qiita.com/gengen16k/items/88cf3c18a40a94205fab + - name: Fix CUDA issues for Ubuntu 24.04 + if: matrix.platform.name == 'ubuntu-24.04_x86_64' + run: | + sudo tee /etc/apt/sources.list.d/jammy.list << EOF + deb http://archive.ubuntu.com/ubuntu/ jammy universe + EOF + + sudo tee /etc/apt/preferences.d/pin-jammy <> $GITHUB_OUTPUT echo "boost_name=${BOOST_PACKAGE_NAME}" >> $GITHUB_OUTPUT id: package_name @@ -229,33 +259,33 @@ jobs: uses: actions/upload-artifact@v4 with: name: ${{ steps.package_name.outputs.name }} - path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.name }} + path: _package/${{ matrix.platform.name }}/release/${{ steps.package_name.outputs.name }} - name: Upload Boost Artifact uses: actions/upload-artifact@v4 with: name: ${{ steps.package_name.outputs.boost_name }} - path: _package/${{ matrix.name }}/release/${{ steps.package_name.outputs.boost_name }} + path: _package/${{ matrix.platform.name }}/release/${{ steps.package_name.outputs.boost_name }} - name: Upload Environment uses: actions/upload-artifact@v4 with: - name: ${{ matrix.name }}.env - path: _package/${{ matrix.name }}/release/sora.env + name: ${{ matrix.platform.name }}.env + path: _package/${{ matrix.platform.name }}/release/sora.env # Examples のビルド - name: Build Examples run: | cd examples - mkdir examples_${{ matrix.name }} + mkdir examples_${{ matrix.platform.name }} for app in sdl_sample sumomo messaging_recvonly_sample; do - python3 $app/${{ matrix.name }}/run.py --local-sora-cpp-sdk-dir .. - cp _build/${{ matrix.name }}/release/$app/$app examples_${{ matrix.name }} + python3 $app/${{ matrix.platform.name }}/run.py --local-sora-cpp-sdk-dir .. + cp _build/${{ matrix.platform.name }}/release/$app/$app examples_${{ matrix.platform.name }} done - if: matrix.name == 'ubuntu-20.04_x86_64' || matrix.name == 'ubuntu-22.04_x86_64' + if: matrix.platform.os == 'ubuntu' - name: Upload Examples Artifact uses: actions/upload-artifact@v4 with: - name: examples_${{ matrix.name }} - path: examples/examples_${{ matrix.name }} - if: matrix.name == 'ubuntu-20.04_x86_64' || matrix.name == 'ubuntu-22.04_x86_64' + name: examples_${{ matrix.platform.name }} + path: examples/examples_${{ matrix.platform.name }} + if: matrix.platform.os == 'ubuntu' create-release: name: Create Release @@ -282,6 +312,9 @@ jobs: - uses: ./.github/actions/download with: platform: ubuntu-22.04_x86_64 + - uses: ./.github/actions/download + with: + platform: ubuntu-24.04_x86_64 - uses: ./.github/actions/download with: platform: android diff --git a/CHANGES.md b/CHANGES.md index 1d009842..5a6e5ef3 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -31,7 +31,7 @@ - @enm10k - [UPDATE] CLI11 を 2.4.2 にあげる - @enm10k -- [UPDATE] libwebrtc を m125.6422.2.1 にあげる +- [UPDATE] libwebrtc を m125.6422.2.5 にあげる - Android の test アプリがリンクできなくなったため、リンカーを Android NDK のものから libwebrtc のものに変更 - リンカーのバージョンの違いによる互換性の問題でエラーが発生していた - @melpon @enm10k @@ -47,6 +47,8 @@ - @melpon - [ADD] NVIDIA Video Codec SDK を H265 に対応する - @melpon +- [ADD] Ubuntu 24.04 に対応する + - @melpon ## 2024.6.1 (2024-04-16) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8346228..21e76e52 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,11 @@ elseif (SORA_TARGET STREQUAL "ubuntu-22.04_x86_64") set(SORA_TARGET_OS_VERSION "22.04") set(SORA_TARGET_ARCH "x86_64") set(SORA_TARGET_DEF "SORA_CPP_SDK_UBUNTU_2204") +elseif (SORA_TARGET STREQUAL "ubuntu-24.04_x86_64") + set(SORA_TARGET_OS "ubuntu") + set(SORA_TARGET_OS_VERSION "24.04") + set(SORA_TARGET_ARCH "x86_64") + set(SORA_TARGET_DEF "SORA_CPP_SDK_UBUNTU_2404") endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) diff --git a/VERSION b/VERSION index ac0b2c2d..2a7e333f 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ SORA_CPP_SDK_VERSION=2024.7.0-canary.3 -WEBRTC_BUILD_VERSION=m125.6422.2.1 +WEBRTC_BUILD_VERSION=m125.6422.2.5 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.28.1 CUDA_VERSION=11.8.0-1 diff --git a/run.py b/run.py index 0ceb8d1c..587d6fd8 100644 --- a/run.py +++ b/run.py @@ -72,7 +72,11 @@ def get_common_cmake_args( args.append(f"-DCMAKE_OBJCXX_COMPILER_TARGET={target}") args.append(f"-DCMAKE_SYSROOT={sysroot}") if platform.target.os == "ubuntu": - if platform.target.package_name in ("ubuntu-20.04_x86_64", "ubuntu-22.04_x86_64"): + if platform.target.package_name in ( + "ubuntu-20.04_x86_64", + "ubuntu-22.04_x86_64", + "ubuntu-24.04_x86_64", + ): args.append("-DCMAKE_C_COMPILER=clang-18") args.append("-DCMAKE_CXX_COMPILER=clang++-18") else: @@ -464,6 +468,7 @@ def install_deps( "macos_arm64", "ubuntu-20.04_x86_64", "ubuntu-22.04_x86_64", + "ubuntu-24.04_x86_64", "ios", "android", ] @@ -491,6 +496,8 @@ def main(): platform = Platform("ubuntu", "20.04", "x86_64") elif args.target == "ubuntu-22.04_x86_64": platform = Platform("ubuntu", "22.04", "x86_64") + elif args.target == "ubuntu-24.04_x86_64": + platform = Platform("ubuntu", "24.04", "x86_64") elif args.target == "ios": platform = Platform("ios", None, None) elif args.target == "android": @@ -557,7 +564,11 @@ def main(): if platform.target.os == "windows": cmake_args.append(f"-DCMAKE_SYSTEM_VERSION={WINDOWS_SDK_VERSION}") if platform.target.os == "ubuntu": - if platform.target.package_name in ("ubuntu-20.04_x86_64", "ubuntu-22.04_x86_64"): + if platform.target.package_name in ( + "ubuntu-20.04_x86_64", + "ubuntu-22.04_x86_64", + "ubuntu-24.04_x86_64", + ): cmake_args.append("-DCMAKE_C_COMPILER=clang-18") cmake_args.append("-DCMAKE_CXX_COMPILER=clang++-18") else: @@ -760,6 +771,7 @@ def main(): if platform.target.package_name in ( "ubuntu-20.04_x86_64", "ubuntu-22.04_x86_64", + "ubuntu-24.04_x86_64", ): cmake_args.append("-DCMAKE_C_COMPILER=clang-18") cmake_args.append("-DCMAKE_CXX_COMPILER=clang++-18") From 32f160901e2fe9cbd796aa6bb0a18d2838696b39 Mon Sep 17 00:00:00 2001 From: melpon Date: Mon, 24 Jun 2024 07:05:26 +0900 Subject: [PATCH 10/34] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4952c394..bba8befc 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -219,15 +219,19 @@ jobs: if: matrix.platform.os == 'ubuntu' run: | source VERSION - # clang-18 と CUDA を入れる sudo apt-get update sudo apt-get install -y software-properties-common + # X11 + sudo apt-get install libx11-dev + + # CUDA wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb sudo dpkg -i cuda-keyring_*all.deb sudo apt-get update DEBIAN_FRONTEND=noninteractive sudo apt-get -y install cuda=$CUDA_VERSION + # clang-18 wget https://apt.llvm.org/llvm.sh chmod a+x llvm.sh sudo ./llvm.sh 18 From 6bccd2f5d822abe458125b6215c4fb2924a9ddb6 Mon Sep 17 00:00:00 2001 From: melpon Date: Mon, 24 Jun 2024 07:22:50 +0900 Subject: [PATCH 11/34] =?UTF-8?q?examples=20=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ubuntu-24.04_x86_64/CMakeLists.txt | 41 ++++ .../ubuntu-24.04_x86_64/run.py | 189 ++++++++++++++++ .../ubuntu-24.04_x86_64/CMakeLists.txt | 43 ++++ .../sdl_sample/ubuntu-24.04_x86_64/run.py | 207 ++++++++++++++++++ .../sumomo/ubuntu-24.04_x86_64/CMakeLists.txt | 43 ++++ examples/sumomo/ubuntu-24.04_x86_64/run.py | 207 ++++++++++++++++++ 6 files changed, 730 insertions(+) create mode 100644 examples/messaging_recvonly_sample/ubuntu-24.04_x86_64/CMakeLists.txt create mode 100644 examples/messaging_recvonly_sample/ubuntu-24.04_x86_64/run.py create mode 100644 examples/sdl_sample/ubuntu-24.04_x86_64/CMakeLists.txt create mode 100644 examples/sdl_sample/ubuntu-24.04_x86_64/run.py create mode 100644 examples/sumomo/ubuntu-24.04_x86_64/CMakeLists.txt create mode 100644 examples/sumomo/ubuntu-24.04_x86_64/run.py diff --git a/examples/messaging_recvonly_sample/ubuntu-24.04_x86_64/CMakeLists.txt b/examples/messaging_recvonly_sample/ubuntu-24.04_x86_64/CMakeLists.txt new file mode 100644 index 00000000..48fbba9f --- /dev/null +++ b/examples/messaging_recvonly_sample/ubuntu-24.04_x86_64/CMakeLists.txt @@ -0,0 +1,41 @@ +cmake_minimum_required(VERSION 3.23) + +# Only interpret if() arguments as variables or keywords when unquoted. +cmake_policy(SET CMP0054 NEW) +# MSVC runtime library flags are selected by an abstraction. +cmake_policy(SET CMP0091 NEW) + +set(WEBRTC_INCLUDE_DIR "" CACHE PATH "WebRTC のインクルードディレクトリ") +set(WEBRTC_LIBRARY_DIR "" CACHE PATH "WebRTC のライブラリディレクトリ") +set(WEBRTC_LIBRARY_NAME "webrtc" CACHE STRING "WebRTC のライブラリ名") +set(BOOST_ROOT "" CACHE PATH "Boost のルートディレクトリ") +set(SORA_DIR "" CACHE PATH "Sora のルートディレクトリ") +set(CLI11_DIR "" CACHE PATH "CLI11 のルートディレクトリ") + +project(sora-sdl-sample C CXX) + +list(APPEND CMAKE_PREFIX_PATH ${SORA_DIR}) +list(APPEND CMAKE_MODULE_PATH ${SORA_DIR}/share/cmake) + +set(Boost_USE_STATIC_LIBS ON) + +find_package(Boost REQUIRED COMPONENTS json filesystem) +find_package(WebRTC REQUIRED) +find_package(Sora REQUIRED) +find_package(Threads REQUIRED) +find_package(Libva REQUIRED) +find_package(Libdrm REQUIRED) + +add_executable(messaging_recvonly_sample) +set_target_properties(messaging_recvonly_sample PROPERTIES CXX_STANDARD 20 C_STANDARD 20) +set_target_properties(messaging_recvonly_sample PROPERTIES POSITION_INDEPENDENT_CODE ON) +target_sources(messaging_recvonly_sample PRIVATE ../src/messaging_recvonly_sample.cpp) + +target_compile_options(messaging_recvonly_sample + PRIVATE + "$<$:-nostdinc++>" + "$<$:-isystem${LIBCXX_INCLUDE_DIR}>" +) +target_include_directories(messaging_recvonly_sample PRIVATE ${CLI11_DIR}/include) +target_link_libraries(messaging_recvonly_sample PRIVATE Sora::sora) +target_compile_definitions(messaging_recvonly_sample PRIVATE CLI11_HAS_FILESYSTEM=0) diff --git a/examples/messaging_recvonly_sample/ubuntu-24.04_x86_64/run.py b/examples/messaging_recvonly_sample/ubuntu-24.04_x86_64/run.py new file mode 100644 index 00000000..a9b1f861 --- /dev/null +++ b/examples/messaging_recvonly_sample/ubuntu-24.04_x86_64/run.py @@ -0,0 +1,189 @@ +import argparse +import multiprocessing +import os +import sys +from typing import List, Optional + +PROJECT_DIR = os.path.abspath(os.path.dirname(__file__)) +BASE_DIR = os.path.join(PROJECT_DIR, "..", "..") +BUILDBASE_DIR = os.path.join(BASE_DIR, "..") +sys.path.insert(0, BUILDBASE_DIR) + + +from buildbase import ( # noqa: E402 + add_path, + add_sora_arguments, + add_webrtc_build_arguments, + build_sora, + build_webrtc, + cd, + cmake_path, + cmd, + get_sora_info, + get_webrtc_info, + install_cli11, + install_cmake, + install_llvm, + install_sora_and_deps, + install_webrtc, + mkdir_p, + read_version_file, +) + + +def install_deps( + source_dir, + build_dir, + install_dir, + debug, + local_webrtc_build_dir: Optional[str], + local_webrtc_build_args: List[str], + local_sora_cpp_sdk_dir: Optional[str], + local_sora_cpp_sdk_args: List[str], +): + with cd(BASE_DIR): + version = read_version_file("VERSION") + + # WebRTC + if local_webrtc_build_dir is None: + install_webrtc_args = { + "version": version["WEBRTC_BUILD_VERSION"], + "version_file": os.path.join(install_dir, "webrtc.version"), + "source_dir": source_dir, + "install_dir": install_dir, + "platform": "ubuntu-24.04_x86_64", + } + install_webrtc(**install_webrtc_args) + else: + build_webrtc_args = { + "platform": "ubuntu-24.04_x86_64", + "local_webrtc_build_dir": local_webrtc_build_dir, + "local_webrtc_build_args": local_webrtc_build_args, + "debug": debug, + } + build_webrtc(**build_webrtc_args) + + webrtc_info = get_webrtc_info( + "ubuntu-24.04_x86_64", local_webrtc_build_dir, install_dir, debug + ) + + if local_webrtc_build_dir is None: + webrtc_version = read_version_file(webrtc_info.version_file) + + # LLVM + tools_url = webrtc_version["WEBRTC_SRC_TOOLS_URL"] + tools_commit = webrtc_version["WEBRTC_SRC_TOOLS_COMMIT"] + libcxx_url = webrtc_version["WEBRTC_SRC_THIRD_PARTY_LIBCXX_SRC_URL"] + libcxx_commit = webrtc_version["WEBRTC_SRC_THIRD_PARTY_LIBCXX_SRC_COMMIT"] + buildtools_url = webrtc_version["WEBRTC_SRC_BUILDTOOLS_URL"] + buildtools_commit = webrtc_version["WEBRTC_SRC_BUILDTOOLS_COMMIT"] + install_llvm_args = { + "version": f"{tools_url}.{tools_commit}." + f"{libcxx_url}.{libcxx_commit}." + f"{buildtools_url}.{buildtools_commit}", + "version_file": os.path.join(install_dir, "llvm.version"), + "install_dir": install_dir, + "tools_url": tools_url, + "tools_commit": tools_commit, + "libcxx_url": libcxx_url, + "libcxx_commit": libcxx_commit, + "buildtools_url": buildtools_url, + "buildtools_commit": buildtools_commit, + } + install_llvm(**install_llvm_args) + + # Sora C++ SDK, Boost + if local_sora_cpp_sdk_dir is None: + install_sora_and_deps("ubuntu-24.04_x86_64", source_dir, install_dir) + else: + build_sora( + "ubuntu-24.04_x86_64", + local_sora_cpp_sdk_dir, + local_sora_cpp_sdk_args, + debug, + local_webrtc_build_dir, + ) + + # CMake + install_cmake_args = { + "version": version["CMAKE_VERSION"], + "version_file": os.path.join(install_dir, "cmake.version"), + "source_dir": source_dir, + "install_dir": install_dir, + "platform": "linux-x86_64", + "ext": "tar.gz", + } + install_cmake(**install_cmake_args) + add_path(os.path.join(install_dir, "cmake", "bin")) + + # CLI11 + install_cli11_args = { + "version": version["CLI11_VERSION"], + "version_file": os.path.join(install_dir, "cli11.version"), + "install_dir": install_dir, + } + install_cli11(**install_cli11_args) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--debug", action="store_true") + add_webrtc_build_arguments(parser) + add_sora_arguments(parser) + + args = parser.parse_args() + + configuration_dir = "debug" if args.debug else "release" + platform = "ubuntu-24.04_x86_64" + source_dir = os.path.join(BASE_DIR, "_source", platform, configuration_dir) + build_dir = os.path.join(BASE_DIR, "_build", platform, configuration_dir) + install_dir = os.path.join(BASE_DIR, "_install", platform, configuration_dir) + mkdir_p(source_dir) + mkdir_p(build_dir) + mkdir_p(install_dir) + + install_deps( + source_dir, + build_dir, + install_dir, + args.debug, + args.local_webrtc_build_dir, + args.local_webrtc_build_args, + args.local_sora_cpp_sdk_dir, + args.local_sora_cpp_sdk_args, + ) + + configuration = "Debug" if args.debug else "Release" + + sample_build_dir = os.path.join(build_dir, "messaging_recvonly_sample") + mkdir_p(sample_build_dir) + with cd(sample_build_dir): + webrtc_info = get_webrtc_info( + "ubuntu-24.04_x86_64", args.local_webrtc_build_dir, install_dir, args.debug + ) + sora_info = get_sora_info(platform, args.local_sora_cpp_sdk_dir, install_dir, args.debug) + + cmake_args = [] + cmake_args.append(f"-DCMAKE_BUILD_TYPE={configuration}") + cmake_args.append(f"-DBOOST_ROOT={cmake_path(sora_info.boost_install_dir)}") + cmake_args.append(f"-DWEBRTC_INCLUDE_DIR={cmake_path(webrtc_info.webrtc_include_dir)}") + cmake_args.append(f"-DWEBRTC_LIBRARY_DIR={cmake_path(webrtc_info.webrtc_library_dir)}") + cmake_args.append(f"-DSORA_DIR={cmake_path(sora_info.sora_install_dir)}") + cmake_args.append(f"-DCLI11_DIR={cmake_path(os.path.join(install_dir, 'cli11'))}") + + # クロスコンパイルの設定。 + # 本来は toolchain ファイルに書く内容 + cmake_args += [ + f"-DCMAKE_C_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang')}", + f"-DCMAKE_CXX_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang++')}", + f"-DLIBCXX_INCLUDE_DIR={cmake_path(os.path.join(webrtc_info.libcxx_dir, 'include'))}", + ] + + cmd(["cmake", os.path.join(PROJECT_DIR)] + cmake_args) + cmd( + ["cmake", "--build", ".", f"-j{multiprocessing.cpu_count()}", "--config", configuration] + ) + + +if __name__ == "__main__": + main() diff --git a/examples/sdl_sample/ubuntu-24.04_x86_64/CMakeLists.txt b/examples/sdl_sample/ubuntu-24.04_x86_64/CMakeLists.txt new file mode 100644 index 00000000..7d57c4a5 --- /dev/null +++ b/examples/sdl_sample/ubuntu-24.04_x86_64/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.23) + +# Only interpret if() arguments as variables or keywords when unquoted. +cmake_policy(SET CMP0054 NEW) +# MSVC runtime library flags are selected by an abstraction. +cmake_policy(SET CMP0091 NEW) + +set(WEBRTC_INCLUDE_DIR "" CACHE PATH "WebRTC のインクルードディレクトリ") +set(WEBRTC_LIBRARY_DIR "" CACHE PATH "WebRTC のライブラリディレクトリ") +set(WEBRTC_LIBRARY_NAME "webrtc" CACHE STRING "WebRTC のライブラリ名") +set(BOOST_ROOT "" CACHE PATH "Boost のルートディレクトリ") +set(SORA_DIR "" CACHE PATH "Sora のルートディレクトリ") +set(SDL2_DIR "" CACHE PATH "SDL2 のルートディレクトリ") +set(CLI11_DIR "" CACHE PATH "CLI11 のルートディレクトリ") + +project(sora-sdl-sample C CXX) + +list(APPEND CMAKE_PREFIX_PATH ${SORA_DIR} ${SDL2_DIR}) +list(APPEND CMAKE_MODULE_PATH ${SORA_DIR}/share/cmake) + +set(Boost_USE_STATIC_LIBS ON) + +find_package(Boost REQUIRED COMPONENTS json filesystem) +find_package(WebRTC REQUIRED) +find_package(Sora REQUIRED) +find_package(SDL2 REQUIRED) +find_package(Threads REQUIRED) +find_package(Libva REQUIRED) +find_package(Libdrm REQUIRED) + +add_executable(sdl_sample) +set_target_properties(sdl_sample PROPERTIES CXX_STANDARD 20 C_STANDARD 20) +set_target_properties(sdl_sample PROPERTIES POSITION_INDEPENDENT_CODE ON) +target_sources(sdl_sample PRIVATE ../src/sdl_sample.cpp ../src/sdl_renderer.cpp) + +target_compile_options(sdl_sample + PRIVATE + "$<$:-nostdinc++>" + "$<$:-isystem${LIBCXX_INCLUDE_DIR}>" +) +target_include_directories(sdl_sample PRIVATE ${CLI11_DIR}/include) +target_link_libraries(sdl_sample PRIVATE Sora::sora SDL2::SDL2 SDL2::SDL2main) +target_compile_definitions(sdl_sample PRIVATE CLI11_HAS_FILESYSTEM=0) diff --git a/examples/sdl_sample/ubuntu-24.04_x86_64/run.py b/examples/sdl_sample/ubuntu-24.04_x86_64/run.py new file mode 100644 index 00000000..899e5e15 --- /dev/null +++ b/examples/sdl_sample/ubuntu-24.04_x86_64/run.py @@ -0,0 +1,207 @@ +import argparse +import multiprocessing +import os +import sys +from typing import List, Optional + +PROJECT_DIR = os.path.abspath(os.path.dirname(__file__)) +BASE_DIR = os.path.join(PROJECT_DIR, "..", "..") +BUILDBASE_DIR = os.path.join(BASE_DIR, "..") +sys.path.insert(0, BUILDBASE_DIR) + + +from buildbase import ( # noqa: E402 + add_path, + add_sora_arguments, + add_webrtc_build_arguments, + build_sora, + build_webrtc, + cd, + cmake_path, + cmd, + get_sora_info, + get_webrtc_info, + install_cli11, + install_cmake, + install_llvm, + install_sdl2, + install_sora_and_deps, + install_webrtc, + mkdir_p, + read_version_file, +) + + +def install_deps( + source_dir, + build_dir, + install_dir, + debug, + local_webrtc_build_dir: Optional[str], + local_webrtc_build_args: List[str], + local_sora_cpp_sdk_dir: Optional[str], + local_sora_cpp_sdk_args: List[str], +): + with cd(BASE_DIR): + version = read_version_file("VERSION") + + # WebRTC + if local_webrtc_build_dir is None: + install_webrtc_args = { + "version": version["WEBRTC_BUILD_VERSION"], + "version_file": os.path.join(install_dir, "webrtc.version"), + "source_dir": source_dir, + "install_dir": install_dir, + "platform": "ubuntu-24.04_x86_64", + } + install_webrtc(**install_webrtc_args) + else: + build_webrtc_args = { + "platform": "ubuntu-24.04_x86_64", + "local_webrtc_build_dir": local_webrtc_build_dir, + "local_webrtc_build_args": local_webrtc_build_args, + "debug": debug, + } + build_webrtc(**build_webrtc_args) + + webrtc_info = get_webrtc_info( + "ubuntu-24.04_x86_64", local_webrtc_build_dir, install_dir, debug + ) + + if local_webrtc_build_dir is None: + webrtc_version = read_version_file(webrtc_info.version_file) + + # LLVM + tools_url = webrtc_version["WEBRTC_SRC_TOOLS_URL"] + tools_commit = webrtc_version["WEBRTC_SRC_TOOLS_COMMIT"] + libcxx_url = webrtc_version["WEBRTC_SRC_THIRD_PARTY_LIBCXX_SRC_URL"] + libcxx_commit = webrtc_version["WEBRTC_SRC_THIRD_PARTY_LIBCXX_SRC_COMMIT"] + buildtools_url = webrtc_version["WEBRTC_SRC_BUILDTOOLS_URL"] + buildtools_commit = webrtc_version["WEBRTC_SRC_BUILDTOOLS_COMMIT"] + install_llvm_args = { + "version": f"{tools_url}.{tools_commit}." + f"{libcxx_url}.{libcxx_commit}." + f"{buildtools_url}.{buildtools_commit}", + "version_file": os.path.join(install_dir, "llvm.version"), + "install_dir": install_dir, + "tools_url": tools_url, + "tools_commit": tools_commit, + "libcxx_url": libcxx_url, + "libcxx_commit": libcxx_commit, + "buildtools_url": buildtools_url, + "buildtools_commit": buildtools_commit, + } + install_llvm(**install_llvm_args) + + # Sora C++ SDK, Boost + if local_sora_cpp_sdk_dir is None: + install_sora_and_deps("ubuntu-24.04_x86_64", source_dir, install_dir) + else: + build_sora( + "ubuntu-24.04_x86_64", + local_sora_cpp_sdk_dir, + local_sora_cpp_sdk_args, + debug, + local_webrtc_build_dir, + ) + + # CMake + install_cmake_args = { + "version": version["CMAKE_VERSION"], + "version_file": os.path.join(install_dir, "cmake.version"), + "source_dir": source_dir, + "install_dir": install_dir, + "platform": "linux-x86_64", + "ext": "tar.gz", + } + install_cmake(**install_cmake_args) + add_path(os.path.join(install_dir, "cmake", "bin")) + + # SDL2 + install_sdl2_args = { + "version": version["SDL2_VERSION"], + "version_file": os.path.join(install_dir, "sdl2.version"), + "source_dir": source_dir, + "build_dir": build_dir, + "install_dir": install_dir, + "debug": debug, + "platform": "linux", + "cmake_args": [ + f"-DCMAKE_C_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang')}", + f"-DCMAKE_CXX_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang++')}", + ], + } + install_sdl2(**install_sdl2_args) + + # CLI11 + install_cli11_args = { + "version": version["CLI11_VERSION"], + "version_file": os.path.join(install_dir, "cli11.version"), + "install_dir": install_dir, + } + install_cli11(**install_cli11_args) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--debug", action="store_true") + add_webrtc_build_arguments(parser) + add_sora_arguments(parser) + + args = parser.parse_args() + + configuration_dir = "debug" if args.debug else "release" + platform = "ubuntu-24.04_x86_64" + source_dir = os.path.join(BASE_DIR, "_source", platform, configuration_dir) + build_dir = os.path.join(BASE_DIR, "_build", platform, configuration_dir) + install_dir = os.path.join(BASE_DIR, "_install", platform, configuration_dir) + mkdir_p(source_dir) + mkdir_p(build_dir) + mkdir_p(install_dir) + + install_deps( + source_dir, + build_dir, + install_dir, + args.debug, + args.local_webrtc_build_dir, + args.local_webrtc_build_args, + args.local_sora_cpp_sdk_dir, + args.local_sora_cpp_sdk_args, + ) + + configuration = "Debug" if args.debug else "Release" + + sample_build_dir = os.path.join(build_dir, "sdl_sample") + mkdir_p(sample_build_dir) + with cd(sample_build_dir): + webrtc_info = get_webrtc_info( + "ubuntu-24.04_x86_64", args.local_webrtc_build_dir, install_dir, args.debug + ) + sora_info = get_sora_info(platform, args.local_sora_cpp_sdk_dir, install_dir, args.debug) + + cmake_args = [] + cmake_args.append(f"-DCMAKE_BUILD_TYPE={configuration}") + cmake_args.append(f"-DBOOST_ROOT={cmake_path(sora_info.boost_install_dir)}") + cmake_args.append(f"-DWEBRTC_INCLUDE_DIR={cmake_path(webrtc_info.webrtc_include_dir)}") + cmake_args.append(f"-DWEBRTC_LIBRARY_DIR={cmake_path(webrtc_info.webrtc_library_dir)}") + cmake_args.append(f"-DSORA_DIR={cmake_path(sora_info.sora_install_dir)}") + cmake_args.append(f"-DCLI11_DIR={cmake_path(os.path.join(install_dir, 'cli11'))}") + cmake_args.append(f"-DSDL2_DIR={cmake_path(os.path.join(install_dir, 'sdl2'))}") + + # クロスコンパイルの設定。 + # 本来は toolchain ファイルに書く内容 + cmake_args += [ + f"-DCMAKE_C_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang')}", + f"-DCMAKE_CXX_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang++')}", + f"-DLIBCXX_INCLUDE_DIR={cmake_path(os.path.join(webrtc_info.libcxx_dir, 'include'))}", + ] + + cmd(["cmake", os.path.join(PROJECT_DIR)] + cmake_args) + cmd( + ["cmake", "--build", ".", f"-j{multiprocessing.cpu_count()}", "--config", configuration] + ) + + +if __name__ == "__main__": + main() diff --git a/examples/sumomo/ubuntu-24.04_x86_64/CMakeLists.txt b/examples/sumomo/ubuntu-24.04_x86_64/CMakeLists.txt new file mode 100644 index 00000000..c41f6cbc --- /dev/null +++ b/examples/sumomo/ubuntu-24.04_x86_64/CMakeLists.txt @@ -0,0 +1,43 @@ +cmake_minimum_required(VERSION 3.23) + +# Only interpret if() arguments as variables or keywords when unquoted. +cmake_policy(SET CMP0054 NEW) +# MSVC runtime library flags are selected by an abstraction. +cmake_policy(SET CMP0091 NEW) + +set(WEBRTC_INCLUDE_DIR "" CACHE PATH "WebRTC のインクルードディレクトリ") +set(WEBRTC_LIBRARY_DIR "" CACHE PATH "WebRTC のライブラリディレクトリ") +set(WEBRTC_LIBRARY_NAME "webrtc" CACHE STRING "WebRTC のライブラリ名") +set(BOOST_ROOT "" CACHE PATH "Boost のルートディレクトリ") +set(SORA_DIR "" CACHE PATH "Sora のルートディレクトリ") +set(SDL2_DIR "" CACHE PATH "SDL2 のルートディレクトリ") +set(CLI11_DIR "" CACHE PATH "CLI11 のルートディレクトリ") + +project(sora-sdl-sample C CXX) + +list(APPEND CMAKE_PREFIX_PATH ${SORA_DIR} ${SDL2_DIR}) +list(APPEND CMAKE_MODULE_PATH ${SORA_DIR}/share/cmake) + +set(Boost_USE_STATIC_LIBS ON) + +find_package(Boost REQUIRED COMPONENTS json filesystem) +find_package(WebRTC REQUIRED) +find_package(Sora REQUIRED) +find_package(SDL2 REQUIRED) +find_package(Threads REQUIRED) +find_package(Libva REQUIRED) +find_package(Libdrm REQUIRED) + +add_executable(sumomo) +set_target_properties(sumomo PROPERTIES CXX_STANDARD 20 C_STANDARD 20) +set_target_properties(sumomo PROPERTIES POSITION_INDEPENDENT_CODE ON) +target_sources(sumomo PRIVATE ../src/sumomo.cpp ../src/sdl_renderer.cpp) + +target_compile_options(sumomo + PRIVATE + "$<$:-nostdinc++>" + "$<$:-isystem${LIBCXX_INCLUDE_DIR}>" +) +target_include_directories(sumomo PRIVATE ${CLI11_DIR}/include) +target_link_libraries(sumomo PRIVATE Sora::sora SDL2::SDL2 SDL2::SDL2main) +target_compile_definitions(sumomo PRIVATE CLI11_HAS_FILESYSTEM=0) diff --git a/examples/sumomo/ubuntu-24.04_x86_64/run.py b/examples/sumomo/ubuntu-24.04_x86_64/run.py new file mode 100644 index 00000000..993abd72 --- /dev/null +++ b/examples/sumomo/ubuntu-24.04_x86_64/run.py @@ -0,0 +1,207 @@ +import argparse +import multiprocessing +import os +import sys +from typing import List, Optional + +PROJECT_DIR = os.path.abspath(os.path.dirname(__file__)) +BASE_DIR = os.path.join(PROJECT_DIR, "..", "..") +BUILDBASE_DIR = os.path.join(BASE_DIR, "..") +sys.path.insert(0, BUILDBASE_DIR) + + +from buildbase import ( # noqa: E402 + add_path, + add_sora_arguments, + add_webrtc_build_arguments, + build_sora, + build_webrtc, + cd, + cmake_path, + cmd, + get_sora_info, + get_webrtc_info, + install_cli11, + install_cmake, + install_llvm, + install_sdl2, + install_sora_and_deps, + install_webrtc, + mkdir_p, + read_version_file, +) + + +def install_deps( + source_dir, + build_dir, + install_dir, + debug, + local_webrtc_build_dir: Optional[str], + local_webrtc_build_args: List[str], + local_sora_cpp_sdk_dir: Optional[str], + local_sora_cpp_sdk_args: List[str], +): + with cd(BASE_DIR): + version = read_version_file("VERSION") + + # WebRTC + if local_webrtc_build_dir is None: + install_webrtc_args = { + "version": version["WEBRTC_BUILD_VERSION"], + "version_file": os.path.join(install_dir, "webrtc.version"), + "source_dir": source_dir, + "install_dir": install_dir, + "platform": "ubuntu-24.04_x86_64", + } + install_webrtc(**install_webrtc_args) + else: + build_webrtc_args = { + "platform": "ubuntu-24.04_x86_64", + "local_webrtc_build_dir": local_webrtc_build_dir, + "local_webrtc_build_args": local_webrtc_build_args, + "debug": debug, + } + build_webrtc(**build_webrtc_args) + + webrtc_info = get_webrtc_info( + "ubuntu-24.04_x86_64", local_webrtc_build_dir, install_dir, debug + ) + + if local_webrtc_build_dir is None: + webrtc_version = read_version_file(webrtc_info.version_file) + + # LLVM + tools_url = webrtc_version["WEBRTC_SRC_TOOLS_URL"] + tools_commit = webrtc_version["WEBRTC_SRC_TOOLS_COMMIT"] + libcxx_url = webrtc_version["WEBRTC_SRC_THIRD_PARTY_LIBCXX_SRC_URL"] + libcxx_commit = webrtc_version["WEBRTC_SRC_THIRD_PARTY_LIBCXX_SRC_COMMIT"] + buildtools_url = webrtc_version["WEBRTC_SRC_BUILDTOOLS_URL"] + buildtools_commit = webrtc_version["WEBRTC_SRC_BUILDTOOLS_COMMIT"] + install_llvm_args = { + "version": f"{tools_url}.{tools_commit}." + f"{libcxx_url}.{libcxx_commit}." + f"{buildtools_url}.{buildtools_commit}", + "version_file": os.path.join(install_dir, "llvm.version"), + "install_dir": install_dir, + "tools_url": tools_url, + "tools_commit": tools_commit, + "libcxx_url": libcxx_url, + "libcxx_commit": libcxx_commit, + "buildtools_url": buildtools_url, + "buildtools_commit": buildtools_commit, + } + install_llvm(**install_llvm_args) + + # Sora C++ SDK, Boost + if local_sora_cpp_sdk_dir is None: + install_sora_and_deps("ubuntu-24.04_x86_64", source_dir, install_dir) + else: + build_sora( + "ubuntu-24.04_x86_64", + local_sora_cpp_sdk_dir, + local_sora_cpp_sdk_args, + debug, + local_webrtc_build_dir, + ) + + # CMake + install_cmake_args = { + "version": version["CMAKE_VERSION"], + "version_file": os.path.join(install_dir, "cmake.version"), + "source_dir": source_dir, + "install_dir": install_dir, + "platform": "linux-x86_64", + "ext": "tar.gz", + } + install_cmake(**install_cmake_args) + add_path(os.path.join(install_dir, "cmake", "bin")) + + # SDL2 + install_sdl2_args = { + "version": version["SDL2_VERSION"], + "version_file": os.path.join(install_dir, "sdl2.version"), + "source_dir": source_dir, + "build_dir": build_dir, + "install_dir": install_dir, + "debug": debug, + "platform": "linux", + "cmake_args": [ + f"-DCMAKE_C_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang')}", + f"-DCMAKE_CXX_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang++')}", + ], + } + install_sdl2(**install_sdl2_args) + + # CLI11 + install_cli11_args = { + "version": version["CLI11_VERSION"], + "version_file": os.path.join(install_dir, "cli11.version"), + "install_dir": install_dir, + } + install_cli11(**install_cli11_args) + + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument("--debug", action="store_true") + add_webrtc_build_arguments(parser) + add_sora_arguments(parser) + + args = parser.parse_args() + + configuration_dir = "debug" if args.debug else "release" + platform = "ubuntu-24.04_x86_64" + source_dir = os.path.join(BASE_DIR, "_source", platform, configuration_dir) + build_dir = os.path.join(BASE_DIR, "_build", platform, configuration_dir) + install_dir = os.path.join(BASE_DIR, "_install", platform, configuration_dir) + mkdir_p(source_dir) + mkdir_p(build_dir) + mkdir_p(install_dir) + + install_deps( + source_dir, + build_dir, + install_dir, + args.debug, + args.local_webrtc_build_dir, + args.local_webrtc_build_args, + args.local_sora_cpp_sdk_dir, + args.local_sora_cpp_sdk_args, + ) + + configuration = "Debug" if args.debug else "Release" + + sample_build_dir = os.path.join(build_dir, "sumomo") + mkdir_p(sample_build_dir) + with cd(sample_build_dir): + webrtc_info = get_webrtc_info( + "ubuntu-24.04_x86_64", args.local_webrtc_build_dir, install_dir, args.debug + ) + sora_info = get_sora_info(platform, args.local_sora_cpp_sdk_dir, install_dir, args.debug) + + cmake_args = [] + cmake_args.append(f"-DCMAKE_BUILD_TYPE={configuration}") + cmake_args.append(f"-DBOOST_ROOT={cmake_path(sora_info.boost_install_dir)}") + cmake_args.append(f"-DWEBRTC_INCLUDE_DIR={cmake_path(webrtc_info.webrtc_include_dir)}") + cmake_args.append(f"-DWEBRTC_LIBRARY_DIR={cmake_path(webrtc_info.webrtc_library_dir)}") + cmake_args.append(f"-DSORA_DIR={cmake_path(sora_info.sora_install_dir)}") + cmake_args.append(f"-DCLI11_DIR={cmake_path(os.path.join(install_dir, 'cli11'))}") + cmake_args.append(f"-DSDL2_DIR={cmake_path(os.path.join(install_dir, 'sdl2'))}") + + # クロスコンパイルの設定。 + # 本来は toolchain ファイルに書く内容 + cmake_args += [ + f"-DCMAKE_C_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang')}", + f"-DCMAKE_CXX_COMPILER={os.path.join(webrtc_info.clang_dir, 'bin', 'clang++')}", + f"-DLIBCXX_INCLUDE_DIR={cmake_path(os.path.join(webrtc_info.libcxx_dir, 'include'))}", + ] + + cmd(["cmake", os.path.join(PROJECT_DIR)] + cmake_args) + cmd( + ["cmake", "--build", ".", f"-j{multiprocessing.cpu_count()}", "--config", configuration] + ) + + +if __name__ == "__main__": + main() From 6f9ff430d8cdf9301738bec6a20c213c782a124c Mon Sep 17 00:00:00 2001 From: melpon Date: Mon, 24 Jun 2024 07:36:36 +0900 Subject: [PATCH 12/34] =?UTF-8?q?=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7?= =?UTF-8?q?=E3=83=B3=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/VERSION b/examples/VERSION index 2eb62b3d..355ac474 100644 --- a/examples/VERSION +++ b/examples/VERSION @@ -1,5 +1,5 @@ SORA_CPP_SDK_VERSION=2024.7.0-canary.3 -WEBRTC_BUILD_VERSION=m125.6422.2.1 +WEBRTC_BUILD_VERSION=m125.6422.2.5 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.28.1 SDL2_VERSION=2.30.3 From f39b4f3f82e527a74b1923c8da1338a9f2320aa5 Mon Sep 17 00:00:00 2001 From: melpon Date: Mon, 24 Jun 2024 07:52:22 +0900 Subject: [PATCH 13/34] =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bba8befc..75208c38 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -223,7 +223,7 @@ jobs: sudo apt-get install -y software-properties-common # X11 - sudo apt-get install libx11-dev + sudo apt-get install libx11-dev libxext-dev # CUDA wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-keyring_1.0-1_all.deb From 10f992f9df36c372af7509de10fafe2439eed2ab Mon Sep 17 00:00:00 2001 From: melpon Date: Mon, 24 Jun 2024 08:14:01 +0900 Subject: [PATCH 14/34] =?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 +- examples/VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 2a7e333f..3231eea1 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.3 +SORA_CPP_SDK_VERSION=2024.7.0-canary.4 WEBRTC_BUILD_VERSION=m125.6422.2.5 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.28.1 diff --git a/examples/VERSION b/examples/VERSION index 355ac474..88cc5161 100644 --- a/examples/VERSION +++ b/examples/VERSION @@ -1,4 +1,4 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.3 +SORA_CPP_SDK_VERSION=2024.7.0-canary.4 WEBRTC_BUILD_VERSION=m125.6422.2.5 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.28.1 From c86ca11f39be885b7f30f8bd034ff14241fc37d8 Mon Sep 17 00:00:00 2001 From: torikizi Date: Thu, 27 Jun 2024 17:33:06 +0900 Subject: [PATCH 15/34] =?UTF-8?q?=E5=85=A8=E4=BD=93=E7=9A=84=E3=81=AB=20`$?= =?UTF-8?q?=20`=20=E3=82=92=E5=89=8A=E9=99=A4=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/vpl.md | 24 ++++----- examples/sumomo/README.md | 110 +++++++++++++++++++------------------- 2 files changed, 68 insertions(+), 66 deletions(-) diff --git a/doc/vpl.md b/doc/vpl.md index 5c844e6c..9e403fae 100644 --- a/doc/vpl.md +++ b/doc/vpl.md @@ -14,7 +14,7 @@ Intel VPL には Intel VPL (ライブラリの Intel VPL と区別するため Intel Media SDK は既に開発が終了しており、後継の Intel VPL ランタイムに開発が移行しているため、 これから VPL を利用する場合は、 Intel VPL ランタイムに対応したチップを利用することを推奨します。 -https://www.intel.com/content/www/us/en/developer/tools/vpl/overview.html#gs.73uoi4 の Specifications のセクションより、ランタイムと対応するチップの一覧を以下に引用します。 + の Specifications のセクションより、ランタイムと対応するチップの一覧を以下に引用します。 - [Intel VPL](https://github.com/oneapi-src/oneVPL-intel-gpu) - Intel® Iris® Xe graphics @@ -37,11 +37,11 @@ Windows では環境によってドライバーの有無が異なるため、以 - Win + R キーを押下 > `ファイル名を指定して実行` のダイアログが開くので `dxdiag` と入力して `OK` ボタンを押下 > DirectX 診断ツールが起動するので、 `ディスプレイ` のタブからインストールされているドライバーを確認 Intel のドライバーが確認できない場合は、以下のページから適切なドライバーをインストールしてください。 -https://www.intel.co.jp/content/www/jp/ja/download-center/home.html + ### Ubuntu 22.04 -https://dgpu-docs.intel.com/driver/client/overview.html を参考に必要なドライバーとソフトウェアをインストールします。 + を参考に必要なドライバーとソフトウェアをインストールします。 #### Intel VPL ランタイムを利用する手順 @@ -49,14 +49,14 @@ Intel VPL ランタイムを利用する場合は libmfxgen1 ではなく libmfx ```bash # Intel の apt リポジトリを追加 -$ wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \ +wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \ sudo gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg -$ echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | \ +echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | \ sudo tee /etc/apt/sources.list.d/intel-gpu-jammy.list -$ sudo apt update +sudo apt update # パッケージのインストール -$ sudo apt install -y \ +sudo apt install -y \ intel-opencl-icd intel-level-zero-gpu level-zero \ intel-media-va-driver-non-free libmfx1 libmfx-gen1.2 libvpl2 \ libegl-mesa0 libegl1-mesa libegl1-mesa-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri \ @@ -70,14 +70,14 @@ $ sudo apt install -y \ ```bash # Intel の apt リポジトリを追加 -$ wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \ +wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \ sudo gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg -$ echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | \ +echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | \ sudo tee /etc/apt/sources.list.d/intel-gpu-jammy.list -$ sudo apt update +sudo apt update # パッケージのインストール -$ sudo apt install -y \ +sudo apt install -y \ intel-opencl-icd intel-level-zero-gpu level-zero \ intel-media-va-driver-non-free libmfx1 libmfxgen1 libvpl2 \ libegl-mesa0 libegl1-mesa libegl1-mesa-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri \ @@ -93,7 +93,7 @@ $ sudo apt install -y \ 以下は `vainfo` を実行した出力の例です。 対応しているプロファイルやエントリーポイントは環境によって異なります。 -``` +```console $ vainfo Trying display: wayland libva info: VA-API version 1.20.0 diff --git a/examples/sumomo/README.md b/examples/sumomo/README.md index c929e4cc..9b6fd448 100644 --- a/examples/sumomo/README.md +++ b/examples/sumomo/README.md @@ -26,7 +26,7 @@ develop ブランチは開発ブランチであり、ビルドが失敗するこ ```shell git clone -b main https://github.com/shiguredo/sora-cpp-sdk.git -$ cd sora-cpp-sdk/examples +cd sora-cpp-sdk/examples ``` ### Sumomo をビルドする @@ -65,7 +65,7 @@ $ cd sora-cpp-sdk/examples ##### ビルド ```shell -$ python3 sumomo/macos_arm64/run.py +python3 sumomo/macos_arm64/run.py ``` 成功した場合、`_build/macos_arm64/release/sumomo` に `sumomo` が作成されます。 @@ -82,18 +82,18 @@ _build/macos_arm64/release/sumomo 必要なパッケージをインストールしてください。 ```shell -$ sudo apt install libxext-dev -$ sudo apt install libx11-dev -$ sudo apt install libdrm-dev -$ sudo apt install libva-dev -$ sudo apt install pkg-config -$ sudo apt install python3 +sudo apt install libxext-dev +sudo apt install libx11-dev +sudo apt install libdrm-dev +sudo apt install libva-dev +sudo apt install pkg-config +sudo apt install python3 ``` ##### ビルド ```shell -$ python3 sumomo/ubuntu-20.04_x86_64/run.py +python3 sumomo/ubuntu-20.04_x86_64/run.py ``` 成功した場合、`_build/ubuntu-20.04_x86_64/release/sumomo` に `sumomo` が作成されます。 @@ -110,18 +110,18 @@ _build/ubuntu-20.04_x86_64/release/sumomo/ 必要なパッケージをインストールしてください。 ```shell -$ sudo apt install libxext-dev -$ sudo apt install libx11-dev -$ sudo apt install libdrm-dev -$ sudo apt install libva-dev -$ sudo apt install pkg-config -$ sudo apt install python3 +sudo apt install libxext-dev +sudo apt install libx11-dev +sudo apt install libdrm-dev +sudo apt install libva-dev +sudo apt install pkg-config +sudo apt install python3 ``` ##### ビルド ```shell -$ python3 sumomo/ubuntu-22.04_x86_64/run.py +python3 sumomo/ubuntu-22.04_x86_64/run.py ``` 成功した場合、以下のファイルが作成されます。`_build/ubuntu-22.04_x86_64/release/sumomo` に `sumomo` が作成されます。 @@ -140,21 +140,21 @@ _build/ubuntu-22.04_x86_64/release/sumomo/ 必要なパッケージをインストールしてください。 ```shell -$ sudo apt install multistrap -$ sudo apt install binutils-aarch64-linux-gnu -$ sudo apt install python3 +sudo apt install multistrap +sudo apt install binutils-aarch64-linux-gnu +sudo apt install python3 ``` multistrap に insecure なリポジトリからの取得を許可する設定を行います。 ```shell -$ sudo sed -e 's/Apt::Get::AllowUnauthenticated=true/Apt::Get::AllowUnauthenticated=true";\n$config_str .= " -o Acquire::AllowInsecureRepositories=true/' -i /usr/sbin/multistrap +sudo sed -e 's/Apt::Get::AllowUnauthenticated=true/Apt::Get::AllowUnauthenticated=true";\n$config_str .= " -o Acquire::AllowInsecureRepositories=true/' -i /usr/sbin/multistrap ``` ##### ビルド ```shell -$ python3 sumomo/ubuntu-20.04_armv8_jetson/run.py +python3 sumomo/ubuntu-20.04_armv8_jetson/run.py ``` 成功した場合、以下のファイルが作成されます。`_build/ubuntu-20.04_armv8_jetson/release/sumomo` に `sumomo` が作成されます。 @@ -172,13 +172,15 @@ _build/ubuntu-20.04_armv8_jetson/release/sumomo/ 以下は Sora サーバのシグナリング URL `wss://sora.example.com/signaling` の `sora` チャンネルに `sendrecv` で接続する例です。 Windows の場合 + ```powershell > .\sumomo.exe --signaling-url wss://sora.example.com/signaling --role sendrecv --channel-id sora --multistream true --use-sdl ``` Windows 以外の場合 + ```shell -$ ./sumomo --signaling-url wss://sora.example.com/signaling --role sendrecv --channel-id sora --multistream true --use-sdl +./sumomo --signaling-url wss://sora.example.com/signaling --role sendrecv --channel-id sora --multistream true --use-sdl ``` #### 必須オプション @@ -186,77 +188,77 @@ $ ./sumomo --signaling-url wss://sora.example.com/signaling --role sendrecv --ch - `--signaling-url` : Sora サーバのシグナリング URL (必須) - `--channel-id` : [channel_id](https://sora-doc.shiguredo.jp/SIGNALING#ee30e9) (必須) - `--role` : [role](https://sora-doc.shiguredo.jp/SIGNALING#6d21b9) (必須) - - sendrecv / sendonly / recvonly のいずれかを指定 + - sendrecv / sendonly / recvonly のいずれかを指定 #### Momo Sample 実行に関するオプション - `--log-level` : 実行時にターミナルに出力するログのレベル - - `verbose->0,info->1,warning->2,error->3,none->4` の値が指定可能です + - `verbose->0,info->1,warning->2,error->3,none->4` の値が指定可能です - `--resolution` : 映像配信する際の解像度 - - 解像度は `QVGA, VGA, HD, FHD, 4K, or [WIDTH]x[HEIGHT]` の値が指定可能です - - 未指定の場合は `VGA` が設定されます + - 解像度は `QVGA, VGA, HD, FHD, 4K, or [WIDTH]x[HEIGHT]` の値が指定可能です + - 未指定の場合は `VGA` が設定されます - `--hw-mjpeg-decoder` : HW MJPEG デコーダーの利用 (true/false) - - 未指定の場合は false が設定されます - - NVIDIA Jetson のみで利用できます + - 未指定の場合は false が設定されます + - NVIDIA Jetson のみで利用できます #### Sora に関するオプション 設定内容については [Sora のドキュメント](https://sora-doc.shiguredo.jp/SIGNALING) も参考にしてください。 -- `--client-id` : [client_id](https://sora-doc.shiguredo.jp/SIGNALING#d00933) +- `--client-id` : [client_id](https://sora-doc.shiguredo.jp/SIGNALING#d00933) - `--video` : 映像の利用 (true/false) - - 未指定の場合は true が設定されます + - 未指定の場合は true が設定されます - `--audio` : 音声の利用 (true/false) - - 未指定の場合は true が設定されます + - 未指定の場合は true が設定されます - `--video-codec-type` : [ビデオコーデック指定](https://sora-doc.shiguredo.jp/SIGNALING#d47f4d) - - VP8 / VP9 / AV1 / H264 / H265 が指定可能ですが利用可能なコーデックはプラットフォームに依存します - - 未指定の場合は Sora のデフォルトである VP9 が利用されます + - VP8 / VP9 / AV1 / H264 / H265 が指定可能ですが利用可能なコーデックはプラットフォームに依存します + - 未指定の場合は Sora のデフォルトである VP9 が利用されます - `--audio-codec-type` : [オーディオコーデック指定](https://sora-doc.shiguredo.jp/SIGNALING#0fcf4e) - - OPUS が指定可能です - - 未指定の場合は Sora のデフォルトである OPUS が利用されます + - OPUS が指定可能です + - 未指定の場合は Sora のデフォルトである OPUS が利用されます - `--video-bit-rate` : [ビデオビットレート指定](https://sora-doc.shiguredo.jp/SIGNALING#5667cf) - - 0 - 30000 の値が指定可能です - - 0 は未指定と見なされます + - 0 - 30000 の値が指定可能です + - 0 は未指定と見なされます - `--audio-bit-rate` : [オーディオビットレート指定](https://sora-doc.shiguredo.jp/SIGNALING#414142) - - 0 - 510 の値が指定可能です - - 0 は未指定と見なされます + - 0 - 510 の値が指定可能です + - 0 は未指定と見なされます - `--metadata` : [メタデータ](https://sora-doc.shiguredo.jp/SIGNALING#414142) - - JSON 形式の文字列を指定してください + - JSON 形式の文字列を指定してください - `--multistream` : [マルチストリーム](https://sora-doc.shiguredo.jp/SIGNALING#808bc2) 機能の利用 (true/false) - - 未指定の場合は Sora の設定 (デフォルト: true) が設定されます + - 未指定の場合は Sora の設定 (デフォルト: true) が設定されます - `--spotlight` : [スポットライト](https://sora-doc.shiguredo.jp/SIGNALING#8f6c79) 機能の利用 (true/false) - - 未指定の場合は Sora の設定 (デフォルト: false) が設定されます + - 未指定の場合は Sora の設定 (デフォルト: false) が設定されます - `--spotlight-number` : [spotlight_number](https://sora-doc.shiguredo.jp/SPOTLIGHT#c66032) - - 0 - 8 の値が指定可能です - - 0 は未指定と見なされます + - 0 - 8 の値が指定可能です + - 0 は未指定と見なされます - `--simulcast` : [サイマルキャスト](https://sora-doc.shiguredo.jp/SIGNALING#584185) 機能の利用 (true/false) - - 未指定の場合は Sora の設定 (デフォルト: false) が設定されます + - 未指定の場合は Sora の設定 (デフォルト: false) が設定されます - `--data-channel-signaling` : [DataChannel 経由のシグナリング](https://sora-doc.shiguredo.jp/DATA_CHANNEL_SIGNALING) を行います (true/false) - - 未指定の場合は Sora の設定 (デフォルト: false) が設定されます + - 未指定の場合は Sora の設定 (デフォルト: false) が設定されます - `--ignore-disconnect-websocket` - - 未指定の場合は Sora の設定 (デフォルト: false) が設定されます + - 未指定の場合は Sora の設定 (デフォルト: false) が設定されます #### proxy に関するオプション - `--proxy-url` : プロキシの url - - 例) http://proxy.example.com:3128 + - 例) - `--proxy-username` : プロキシ認証に使用するユーザー名 - `--proxy-password` : プロキシ認証に使用するパスワード #### SDL に関するオプション - `--use-sdl` - - [SDL (Simple DirectMedia Layer)](https://www.libsdl.org/) を利用して映像を表示します + - [SDL (Simple DirectMedia Layer)](https://www.libsdl.org/) を利用して映像を表示します - `--window-width` - - 映像を表示するウインドウの横幅を指定します + - 映像を表示するウインドウの横幅を指定します - `--window-height` - - 映像を表示するウインドウの縦幅を指定します + - 映像を表示するウインドウの縦幅を指定します - `--fullscreen` - - 映像を表示するウインドウをフルスクリーンにします + - 映像を表示するウインドウをフルスクリーンにします - `--show-me` - - 送信している自分の映像を表示します + - 送信している自分の映像を表示します #### その他のオプション - `--help` - - ヘルプを表示します + - ヘルプを表示します From 068e287da15479851c25f22070a6d7cb06abfe49 Mon Sep 17 00:00:00 2001 From: voluntas Date: Sun, 30 Jun 2024 19:47:04 +0900 Subject: [PATCH 16/34] =?UTF-8?q?cmake=20=E3=81=AE=E3=83=90=E3=83=BC?= =?UTF-8?q?=E3=82=B8=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 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 3231eea1..e0e0549c 100644 --- a/VERSION +++ b/VERSION @@ -1,7 +1,7 @@ SORA_CPP_SDK_VERSION=2024.7.0-canary.4 WEBRTC_BUILD_VERSION=m125.6422.2.5 BOOST_VERSION=1.85.0 -CMAKE_VERSION=3.28.1 +CMAKE_VERSION=3.29.6 CUDA_VERSION=11.8.0-1 ANDROID_NDK_VERSION=r26b ANDROID_NATIVE_API_LEVEL=29 From 21794fbe3950d41037ce8f5695d958be31603bcf Mon Sep 17 00:00:00 2001 From: torikizi Date: Sun, 30 Jun 2024 20:44:04 +0900 Subject: [PATCH 17/34] =?UTF-8?q?Android=20test=20=E3=81=AE=20cmake=20?= =?UTF-8?q?=E3=81=AE=E3=83=90=E3=83=BC=E3=82=B8=E3=83=A7=E3=83=B3=E3=82=82?= =?UTF-8?q?=E4=B8=8A=E3=81=92=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- test/android/app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/android/app/build.gradle b/test/android/app/build.gradle index 5300aaa1..cc159cf7 100644 --- a/test/android/app/build.gradle +++ b/test/android/app/build.gradle @@ -65,7 +65,7 @@ android { externalNativeBuild { cmake { path file('src/main/cpp/CMakeLists.txt') - version '3.28.1' + version '3.29.6' } } buildFeatures { From 986159011541b42075edfb37eb2902400dd7e03d Mon Sep 17 00:00:00 2001 From: voluntas Date: Sun, 30 Jun 2024 21:03:01 +0900 Subject: [PATCH 18/34] =?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 e0e0549c..46cfe9b4 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.4 +SORA_CPP_SDK_VERSION=2024.7.0-canary.5 WEBRTC_BUILD_VERSION=m125.6422.2.5 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.29.6 From 867c8726ca5bf3b07a68400611efc1f73391a146 Mon Sep 17 00:00:00 2001 From: torikizi Date: Tue, 9 Jul 2024 15:52:20 +0900 Subject: [PATCH 19/34] =?UTF-8?q?SDL=20=E3=83=90=E3=83=BC=E3=82=B8?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=82=92=202.30.5=20=E3=81=AB=E4=B8=8A?= =?UTF-8?q?=E3=81=92=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/VERSION b/examples/VERSION index 88cc5161..72e2940a 100644 --- a/examples/VERSION +++ b/examples/VERSION @@ -2,5 +2,5 @@ SORA_CPP_SDK_VERSION=2024.7.0-canary.4 WEBRTC_BUILD_VERSION=m125.6422.2.5 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.28.1 -SDL2_VERSION=2.30.3 +SDL2_VERSION=2.30.5 CLI11_VERSION=v2.4.2 From e258c93d631017a9fa805027cc8a5d0077d20efc Mon Sep 17 00:00:00 2001 From: torikizi Date: Tue, 16 Jul 2024 10:31:37 +0900 Subject: [PATCH 20/34] =?UTF-8?q?WEBRTC=5FBUILD=5FVERSION=20=E3=82=92=20m1?= =?UTF-8?q?26.6478.1.1=20=E3=81=AB=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 46cfe9b4..233bd816 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ SORA_CPP_SDK_VERSION=2024.7.0-canary.5 -WEBRTC_BUILD_VERSION=m125.6422.2.5 +WEBRTC_BUILD_VERSION=m126.6478.1.1 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.29.6 CUDA_VERSION=11.8.0-1 From 726a6164642d1e63935b710a715056234cb26195 Mon Sep 17 00:00:00 2001 From: torikizi Date: Tue, 16 Jul 2024 10:37:10 +0900 Subject: [PATCH 21/34] =?UTF-8?q?CHANGES=20=E3=81=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 5a6e5ef3..b5af6be0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -31,10 +31,10 @@ - @enm10k - [UPDATE] CLI11 を 2.4.2 にあげる - @enm10k -- [UPDATE] libwebrtc を m125.6422.2.5 にあげる +- [UPDATE] libwebrtc を m126.6478.1.1 にあげる - Android の test アプリがリンクできなくなったため、リンカーを Android NDK のものから libwebrtc のものに変更 - リンカーのバージョンの違いによる互換性の問題でエラーが発生していた - - @melpon @enm10k + - @melpon @enm10k @torikizi - [ADD] sumomo に `--openh264` と `--use-hardware-encoder` オプションを追加 - @melpon - [ADD] sumomo に `--video-h264-params` と `--video-h265-params` オプションを追加 From a12caa51341191f64eb9b1ec1fd1c7e6b7a89de3 Mon Sep 17 00:00:00 2001 From: torikizi Date: Tue, 16 Jul 2024 13:08:39 +0900 Subject: [PATCH 22/34] =?UTF-8?q?examples=20=E3=81=AE=20VERSION=20?= =?UTF-8?q?=E3=82=82=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 --- examples/VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/VERSION b/examples/VERSION index 72e2940a..21c151de 100644 --- a/examples/VERSION +++ b/examples/VERSION @@ -1,5 +1,5 @@ SORA_CPP_SDK_VERSION=2024.7.0-canary.4 -WEBRTC_BUILD_VERSION=m125.6422.2.5 +WEBRTC_BUILD_VERSION=m126.6478.1.1 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.28.1 SDL2_VERSION=2.30.5 From d99cc0f69bec75ffa7f79e633df8dd2f032fca07 Mon Sep 17 00:00:00 2001 From: melpon Date: Mon, 22 Jul 2024 18:39:12 +0900 Subject: [PATCH 23/34] =?UTF-8?q?VPL=20=E3=81=A7=E3=81=AE=20VP9=20?= =?UTF-8?q?=E3=81=AF=E6=9C=AA=E3=82=B5=E3=83=9D=E3=83=BC=E3=83=88=E3=81=A8?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hwenc_vpl/vpl_video_encoder.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/hwenc_vpl/vpl_video_encoder.cpp b/src/hwenc_vpl/vpl_video_encoder.cpp index 57cafae7..0ab78549 100644 --- a/src/hwenc_vpl/vpl_video_encoder.cpp +++ b/src/hwenc_vpl/vpl_video_encoder.cpp @@ -669,6 +669,13 @@ bool VplVideoEncoder::IsSupported(std::shared_ptr session, return false; } + // FIXME(melpon): IsSupported(VP9) == true になるにも関わらず、実際に使ってみると + // 実行時エラーでクラッシュするため、とりあえず VP9 だったら未サポートとして返す。 + // (VPL の問題なのか使い方の問題なのかは不明) + if (codec == webrtc::kVideoCodecVP9) { + return false; + } + auto encoder = VplVideoEncoderImpl::CreateEncoder( session, ToMfxCodec(codec), 1920, 1080, 30, 10, 20, false); bool result = encoder != nullptr; From 524d49b24c7bb22f77618d23668ada5aadfaba48 Mon Sep 17 00:00:00 2001 From: miosakuma Date: Mon, 22 Jul 2024 19:30:06 +0900 Subject: [PATCH 24/34] =?UTF-8?q?README=20=E3=81=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9e226901..9281c3d3 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,8 @@ Please read before u - Google Android HWA - VP8 / VP9 / H.264 / H.265 - [Intel VPL](https://github.com/intel/libvpl) (Intel Media SDK の後継) - - VP9 / H.264 / H.265 / AV1 + - H.264 / H.265 / AV1 + - AV1 は デコードのみ - H.265 は Windows と Ubuntu 22.04 のみ ## ライブラリのバイナリ提供について From 1843312b1b7cb4a5ac16ad68f09c72783128792d Mon Sep 17 00:00:00 2001 From: melpon Date: Tue, 23 Jul 2024 12:49:13 +0900 Subject: [PATCH 25/34] =?UTF-8?q?WebSocket=20=E3=81=A7=E3=81=AE=E6=8E=A5?= =?UTF-8?q?=E7=B6=9A=E6=99=82=E3=81=AB=20User-Agent=20=E3=83=98=E3=83=83?= =?UTF-8?q?=E3=83=80=E3=83=BC=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 2 ++ include/sora/sora_signaling.h | 7 +++++-- include/sora/version.h | 6 ++++++ include/sora/websocket.h | 5 +++++ src/sora_signaling.cpp | 3 +++ src/version.cpp | 6 ++++++ src/websocket.cpp | 31 +++++++++++++++++++++++++++---- 7 files changed, 54 insertions(+), 6 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index b5af6be0..0efdb2a4 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -49,6 +49,8 @@ - @melpon - [ADD] Ubuntu 24.04 に対応する - @melpon +- [ADD] WebSocket での接続時に User-Agent ヘッダーを追加する + - @melpon ## 2024.6.1 (2024-04-16) diff --git a/include/sora/sora_signaling.h b/include/sora/sora_signaling.h index d0545890..82c303e0 100644 --- a/include/sora/sora_signaling.h +++ b/include/sora/sora_signaling.h @@ -15,8 +15,9 @@ #include #include -#include "data_channel.h" -#include "websocket.h" +#include "sora/data_channel.h" +#include "sora/version.h" +#include "sora/websocket.h" namespace sora { @@ -134,6 +135,8 @@ struct SoraSignalingConfig { rtc::PacketSocketFactory* socket_factory = nullptr; bool disable_signaling_url_randomization = false; + + boost::optional user_agent; }; class SoraSignaling : public std::enable_shared_from_this, diff --git a/include/sora/version.h b/include/sora/version.h index 29a5884b..6e556b50 100644 --- a/include/sora/version.h +++ b/include/sora/version.h @@ -3,13 +3,19 @@ #include +// Boost +#include + namespace sora { +typedef boost::optional http_header_value; + class Version { public: static std::string GetClientName(); static std::string GetLibwebrtcName(); static std::string GetEnvironmentName(); + static http_header_value GetDefaultUserAgent(); }; } // namespace sora diff --git a/include/sora/websocket.h b/include/sora/websocket.h index 50ce6ed3..4208de62 100644 --- a/include/sora/websocket.h +++ b/include/sora/websocket.h @@ -16,6 +16,7 @@ #include #include "url_parts.h" +#include "version.h" namespace sora { @@ -67,6 +68,8 @@ class Websocket { Websocket(boost::asio::ip::tcp::socket socket); ~Websocket(); + void SetUserAgent(http_header_value user_agent); + // WebSocket クライアントの接続確立 void Connect(const std::string& url, connect_callback_t on_connect); @@ -144,6 +147,8 @@ class Websocket { boost::asio::deadline_timer close_timeout_timer_; + http_header_value user_agent_; + bool https_proxy_ = false; std::string proxy_url_; std::string proxy_username_; diff --git a/src/sora_signaling.cpp b/src/sora_signaling.cpp index 1e17f49f..29aade78 100644 --- a/src/sora_signaling.cpp +++ b/src/sora_signaling.cpp @@ -1178,6 +1178,9 @@ void SoraSignaling::DoConnect() { } else { ws.reset(new Websocket(*config_.io_context)); } + if (config_.user_agent != boost::none) { + ws->SetUserAgent(*config_.user_agent); + } ws->Connect(url, std::bind(&SoraSignaling::OnConnect, shared_from_this(), std::placeholders::_1, url, ws)); connecting_wss_.push_back(ws); diff --git a/src/version.cpp b/src/version.cpp index ac6f9316..cef3be3e 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -49,6 +49,8 @@ #endif +#define DEFAULT_USER_AGENT "Mozilla/5.0 (Sora C++ SDK/" SORA_CPP_SDK_VERSION ")" + namespace sora { std::string Version::GetClientName() { @@ -186,4 +188,8 @@ std::string Version::GetEnvironmentName() { return environment; } +http_header_value Version::GetDefaultUserAgent() { + return std::string(DEFAULT_USER_AGENT); +} + } // namespace sora diff --git a/src/websocket.cpp b/src/websocket.cpp index c6400337..5b60a404 100644 --- a/src/websocket.cpp +++ b/src/websocket.cpp @@ -14,6 +14,7 @@ #include #include "sora/ssl_verifier.h" +#include "sora/version.h" namespace sora { @@ -47,7 +48,8 @@ Websocket::Websocket(boost::asio::io_context& ioc) : ws_(new websocket_t(ioc)), resolver_(new boost::asio::ip::tcp::resolver(ioc)), strand_(ws_->get_executor()), - close_timeout_timer_(ioc) { + close_timeout_timer_(ioc), + user_agent_(Version::GetDefaultUserAgent()) { ws_->write_buffer_bytes(8192); } Websocket::Websocket(Websocket::ssl_tag, @@ -58,7 +60,8 @@ Websocket::Websocket(Websocket::ssl_tag, : resolver_(new boost::asio::ip::tcp::resolver(ioc)), strand_(ioc.get_executor()), close_timeout_timer_(ioc), - insecure_(insecure) { + insecure_(insecure), + user_agent_(Version::GetDefaultUserAgent()) { ssl_ctx_ = CreateSSLContext(client_cert, client_key); wss_.reset(new ssl_websocket_t(ioc, *ssl_ctx_)); InitWss(wss_.get(), insecure); @@ -66,7 +69,8 @@ Websocket::Websocket(Websocket::ssl_tag, Websocket::Websocket(boost::asio::ip::tcp::socket socket) : ws_(new websocket_t(std::move(socket))), strand_(ws_->get_executor()), - close_timeout_timer_(ws_->get_executor()) { + close_timeout_timer_(ws_->get_executor()), + user_agent_(Version::GetDefaultUserAgent()) { ws_->write_buffer_bytes(8192); } Websocket::Websocket(https_proxy_tag, @@ -84,7 +88,8 @@ Websocket::Websocket(https_proxy_tag, proxy_socket_(new boost::asio::ip::tcp::socket(ioc)), proxy_url_(std::move(proxy_url)), proxy_username_(std::move(proxy_username)), - proxy_password_(std::move(proxy_password)) { + proxy_password_(std::move(proxy_password)), + user_agent_(Version::GetDefaultUserAgent()) { ssl_ctx_ = CreateSSLContext(client_cert, client_key); } @@ -92,6 +97,10 @@ Websocket::~Websocket() { RTC_LOG(LS_INFO) << "Websocket::~Websocket this=" << (void*)this; } +void Websocket::SetUserAgent(http_header_value user_agent) { + user_agent_ = user_agent; +} + bool Websocket::IsSSL() const { return https_proxy_ || wss_ != nullptr; } @@ -161,6 +170,20 @@ void Websocket::Connect(const std::string& url, connect_callback_t on_connect) { } } + // ヘッダーの設定 + auto set_headers = [this](boost::beast::websocket::request_type& req) { + if (user_agent_ != boost::none) { + req.set(boost::beast::http::field::user_agent, *user_agent_); + } + }; + if (IsSSL()) { + wss_->set_option( + boost::beast::websocket::stream_base::decorator(set_headers)); + } else { + ws_->set_option( + boost::beast::websocket::stream_base::decorator(set_headers)); + } + on_connect_ = std::move(on_connect); // DNS ルックアップ From f84afae602649c5196d90b8fb9657406e4afe0c1 Mon Sep 17 00:00:00 2001 From: torikizi Date: Tue, 23 Jul 2024 15:51:41 +0900 Subject: [PATCH 26/34] =?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 +- examples/VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 233bd816..47053c73 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.5 +SORA_CPP_SDK_VERSION=2024.7.0-canary.6 WEBRTC_BUILD_VERSION=m126.6478.1.1 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.29.6 diff --git a/examples/VERSION b/examples/VERSION index 21c151de..919bd84f 100644 --- a/examples/VERSION +++ b/examples/VERSION @@ -1,4 +1,4 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.4 +SORA_CPP_SDK_VERSION=2024.7.0-canary.6 WEBRTC_BUILD_VERSION=m126.6478.1.1 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.28.1 From 796f48e8e6e51f19140d8a66981016589ed21a02 Mon Sep 17 00:00:00 2001 From: miosakuma Date: Tue, 23 Jul 2024 18:40:40 +0900 Subject: [PATCH 27/34] =?UTF-8?q?VPL=20=E3=81=A7=E3=81=AE=20AV1=20?= =?UTF-8?q?=E3=82=92=E6=9C=AA=E3=82=B5=E3=83=9D=E3=83=BC=E3=83=88=E3=81=A8?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hwenc_vpl/vpl_video_encoder.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/hwenc_vpl/vpl_video_encoder.cpp b/src/hwenc_vpl/vpl_video_encoder.cpp index 0ab78549..8b6b79b7 100644 --- a/src/hwenc_vpl/vpl_video_encoder.cpp +++ b/src/hwenc_vpl/vpl_video_encoder.cpp @@ -676,6 +676,13 @@ bool VplVideoEncoder::IsSupported(std::shared_ptr session, return false; } + // FIXME(miosakuma): Intel Core Ultra 7 では IsSupported(AV1) == true となるが、 + // 実際に使ってみると映像が送信されないため、一時的に AV1 だったら未サポートとして返す。 + // (VPL の問題なのか使い方の問題なのかは不明) + if (codec == webrtc::kVideoCodecAV1) { + return false; + } + auto encoder = VplVideoEncoderImpl::CreateEncoder( session, ToMfxCodec(codec), 1920, 1080, 30, 10, 20, false); bool result = encoder != nullptr; From 13415c5b5869f98d0a5a573b495536f3f8666827 Mon Sep 17 00:00:00 2001 From: torikizi Date: Wed, 24 Jul 2024 14:37:05 +0900 Subject: [PATCH 28/34] =?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 +- examples/VERSION | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 47053c73..941182ea 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.6 +SORA_CPP_SDK_VERSION=2024.7.0-canary.7 WEBRTC_BUILD_VERSION=m126.6478.1.1 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.29.6 diff --git a/examples/VERSION b/examples/VERSION index 919bd84f..197a2a46 100644 --- a/examples/VERSION +++ b/examples/VERSION @@ -1,4 +1,4 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.6 +SORA_CPP_SDK_VERSION=2024.7.0-canary.7 WEBRTC_BUILD_VERSION=m126.6478.1.1 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.28.1 From 37683a6c41b2346419ba26c194172cace34e865f Mon Sep 17 00:00:00 2001 From: torikizi Date: Thu, 25 Jul 2024 10:38:02 +0900 Subject: [PATCH 29/34] =?UTF-8?q?VPL=20=E3=83=89=E3=82=AD=E3=83=A5?= =?UTF-8?q?=E3=83=A1=E3=83=B3=E3=83=88=E3=81=AE=E6=89=8B=E9=A0=86=E3=82=92?= =?UTF-8?q?=E8=A6=8B=E7=9B=B4=E3=81=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/vpl.md | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/doc/vpl.md b/doc/vpl.md index 9e403fae..09676686 100644 --- a/doc/vpl.md +++ b/doc/vpl.md @@ -41,21 +41,31 @@ Intel のドライバーが確認できない場合は、以下のページか ### Ubuntu 22.04 - を参考に必要なドライバーとソフトウェアをインストールします。 +Ubuntu 22.04 で Intel VPL を利用するためには、ドライバーとライブラリをインストールする必要があります。 +公式ドキュメントの を参考に必要なドライバーとライブラリをインストールします。 -#### Intel VPL ランタイムを利用する手順 +#### Intel VPL ランタイムをインストールする -Intel VPL ランタイムを利用する場合は libmfxgen1 ではなく libmfx-gen1.2 を使う必要があるため、ドキュメントのコマンドを一部読み替えて実行します。 +##### Intel の apt リポジトリを追加 + +パッケージのインストールには Intel の apt リポジトリを追加する必要があります。 ```bash -# Intel の apt リポジトリを追加 + wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \ sudo gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | \ sudo tee /etc/apt/sources.list.d/intel-gpu-jammy.list sudo apt update +``` + +##### パッケージのインストール -# パッケージのインストール +公式ドキュメントでは libmfxgen1 をインストールする手順が記載されていますが、Intel VPL ランタイムを使用するには libmfx-gen1.2 が必要です。 + +以下の実行例のように、 libmfx-gen1.2 をインストールしてください。 + +```bash sudo apt install -y \ intel-opencl-icd intel-level-zero-gpu level-zero \ intel-media-va-driver-non-free libmfx1 libmfx-gen1.2 libvpl2 \ @@ -64,19 +74,29 @@ sudo apt install -y \ mesa-vdpau-drivers mesa-vulkan-drivers va-driver-all vainfo hwinfo clinfo ``` +##### 再起動 + +パッケージのインストールが完了したら、再起動してください。 + #### Intel Media SDK を利用する手順 -ドキュメントの通りです。 +Intel のチップセットの世代によって、 Intel Media SDK を利用する必要がある場合があります。 + +以下の手順で Intel Media SDK をインストールしてください。 + +##### Intel の apt リポジトリを追加 ```bash -# Intel の apt リポジトリを追加 wget -qO - https://repositories.intel.com/gpu/intel-graphics.key | \ sudo gpg --dearmor --output /usr/share/keyrings/intel-graphics.gpg echo "deb [arch=amd64,i386 signed-by=/usr/share/keyrings/intel-graphics.gpg] https://repositories.intel.com/gpu/ubuntu jammy client" | \ sudo tee /etc/apt/sources.list.d/intel-gpu-jammy.list sudo apt update +``` + +###### パッケージのインストール -# パッケージのインストール +```bash sudo apt install -y \ intel-opencl-icd intel-level-zero-gpu level-zero \ intel-media-va-driver-non-free libmfx1 libmfxgen1 libvpl2 \ From d18ef077dd8838fd38c454c35cfd5bda6b3ecbbf Mon Sep 17 00:00:00 2001 From: torikizi Date: Thu, 25 Jul 2024 11:10:00 +0900 Subject: [PATCH 30/34] =?UTF-8?q?WEBRTC=5FBUILD=5FVERSION=20=E3=82=92=20m1?= =?UTF-8?q?27=20=E3=81=AB=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 | 4 ++-- examples/VERSION | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 941182ea..ef538f3d 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.7 -WEBRTC_BUILD_VERSION=m126.6478.1.1 +SORA_CPP_SDK_VERSION=2024.7.0-canary.8 +WEBRTC_BUILD_VERSION=m127.6533.1.1 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.29.6 CUDA_VERSION=11.8.0-1 diff --git a/examples/VERSION b/examples/VERSION index 197a2a46..ae1c33b7 100644 --- a/examples/VERSION +++ b/examples/VERSION @@ -1,5 +1,5 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.7 -WEBRTC_BUILD_VERSION=m126.6478.1.1 +SORA_CPP_SDK_VERSION=2024.7.0-canary.8 +WEBRTC_BUILD_VERSION=m127.6533.1.1 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.28.1 SDL2_VERSION=2.30.5 From b4fb7eaefb6859fd9de0142ba36f02625de36834 Mon Sep 17 00:00:00 2001 From: melpon Date: Thu, 25 Jul 2024 11:20:09 +0900 Subject: [PATCH 31/34] =?UTF-8?q?m127=20=E3=81=AE=E3=83=93=E3=83=AB?= =?UTF-8?q?=E3=83=89=E3=82=A8=E3=83=A9=E3=83=BC=E3=82=92=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/open_h264_video_encoder.cpp | 2 +- src/sora_signaling.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/open_h264_video_encoder.cpp b/src/open_h264_video_encoder.cpp index 90a330f9..e24b73cb 100644 --- a/src/open_h264_video_encoder.cpp +++ b/src/open_h264_video_encoder.cpp @@ -512,7 +512,7 @@ int32_t OpenH264VideoEncoder::InitEncode( } } - SimulcastRateAllocator init_allocator(codec_); + SimulcastRateAllocator init_allocator(env_, codec_); VideoBitrateAllocation allocation = init_allocator.Allocate(VideoBitrateAllocationParameters( DataRate::KilobitsPerSec(codec_.startBitrate), codec_.maxFramerate)); diff --git a/src/sora_signaling.cpp b/src/sora_signaling.cpp index 29aade78..4cc8dd3f 100644 --- a/src/sora_signaling.cpp +++ b/src/sora_signaling.cpp @@ -4,7 +4,7 @@ #include #include #include -#include +#include #include #include "sora/data_channel.h" @@ -447,7 +447,7 @@ void SoraSignaling::DoSendUpdate(const std::string& sdp, std::string type) { } } -class RawCryptString : public rtc::CryptStringImpl { +class RawCryptString : public rtc::revive::CryptStringImpl { public: RawCryptString(const std::string& str) : str_(str) {} size_t GetLength() const override { return str_.size(); } @@ -535,7 +535,7 @@ SoraSignaling::CreatePeerConnection(boost::json::value jconfig) { pi.username = config_.proxy_username; } if (!config_.proxy_password.empty()) { - pi.password = rtc::CryptString(RawCryptString(config_.proxy_password)); + pi.password = rtc::revive::CryptString(RawCryptString(config_.proxy_password)); } std::string proxy_agent = "Sora C++ SDK"; if (!config_.proxy_agent.empty()) { From 9980397f37e64fa61b89e252fcd4846acf4e9244 Mon Sep 17 00:00:00 2001 From: miosakuma Date: Thu, 25 Jul 2024 15:38:46 +0900 Subject: [PATCH 32/34] =?UTF-8?q?README=20=E3=81=AB=E5=8B=95=E4=BD=9C?= =?UTF-8?q?=E6=9C=AA=E6=A4=9C=E8=A8=BC=E3=81=AE=E7=92=B0=E5=A2=83=E3=81=AB?= =?UTF-8?q?=E3=81=A4=E3=81=84=E3=81=A6=E8=A8=98=E8=BC=89=E3=81=99=E3=82=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9281c3d3..94f3c5c0 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Please read before u - NVIDIA Video Codec SDK (NVENC / NVDEC) - VP9 / H.264 - NVIDIA Jetson Video HWA - - VP9 / AV1 / H.264 + - VP9 / AV1 / H.264 / H.265 - Apple macOS / iOS Video Toolbox - H.264 / H.265 - Google Android HWA @@ -32,6 +32,7 @@ Please read before u - H.264 / H.265 / AV1 - AV1 は デコードのみ - H.265 は Windows と Ubuntu 22.04 のみ + - Media SDK での動作は未検証です ## ライブラリのバイナリ提供について @@ -56,7 +57,12 @@ _hololens2 は無視してください_ - Ubuntu 22.04 ARMv8 Jetson (JetPack 6.0.0 以降) - Jetson AGX Orin - Jetson Orin NX + - 動作未検証です +- Ubuntu 20.04 x86_64 + - 動作未検証です - Ubuntu 22.04 x86_64 +- Ubuntu 24.04 x86_64 + - 動作未検証です - Android 7 arm64 以降 - iOS 13 arm64 以降 From b7935560f4ac3df9fec8d1d53868ca1a7029ff9d Mon Sep 17 00:00:00 2001 From: miosakuma Date: Fri, 26 Jul 2024 18:39:08 +0900 Subject: [PATCH 33/34] =?UTF-8?q?README=20=E3=81=AE=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 94f3c5c0..c2272579 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Please read before u - 各プラットフォームで利用可能な HWA への対応 - NVIDIA Video Codec SDK (NVENC / NVDEC) - - VP9 / H.264 + - VP9 / H.264 / H.265 - NVIDIA Jetson Video HWA - VP9 / AV1 / H.264 / H.265 - Apple macOS / iOS Video Toolbox From f2748cd05f96542c53582408e6e081b9523df4c1 Mon Sep 17 00:00:00 2001 From: miosakuma Date: Mon, 29 Jul 2024 12:48:05 +0900 Subject: [PATCH 34/34] =?UTF-8?q?2024.7.0=20=E3=83=AA=E3=83=AA=E3=83=BC?= =?UTF-8?q?=E3=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 2 ++ VERSION | 2 +- examples/VERSION | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 0efdb2a4..030ec8e6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -11,6 +11,8 @@ ## develop +## 2024.7.0 (2024-07-29) + - [CHANGE] `--sora-dir`, `--sora-args` を `--local-sora-cpp-sdk-dir` と `--local-sora-cpp-sdk-args` に変更する - @melpon - [CHANGE] `--webrtc-build-dir`, `--webrtc-build-args` を `--local-webrtc-build-dir` と `--local-webrtc-build-args` に変更する diff --git a/VERSION b/VERSION index ef538f3d..b443bc95 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.8 +SORA_CPP_SDK_VERSION=2024.7.0 WEBRTC_BUILD_VERSION=m127.6533.1.1 BOOST_VERSION=1.85.0 CMAKE_VERSION=3.29.6 diff --git a/examples/VERSION b/examples/VERSION index ae1c33b7..520a1b4a 100644 --- a/examples/VERSION +++ b/examples/VERSION @@ -1,6 +1,6 @@ -SORA_CPP_SDK_VERSION=2024.7.0-canary.8 +SORA_CPP_SDK_VERSION=2024.7.0 WEBRTC_BUILD_VERSION=m127.6533.1.1 BOOST_VERSION=1.85.0 -CMAKE_VERSION=3.28.1 +CMAKE_VERSION=3.29.6 SDL2_VERSION=2.30.5 CLI11_VERSION=v2.4.2