Skip to content

Commit

Permalink
Merge branch 'release/2022.8.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Jul 28, 2022
2 parents 7e70a3b + 9fa1060 commit 5e48283
Show file tree
Hide file tree
Showing 33 changed files with 452 additions and 508 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
if: matrix.name == 'ubuntu-20.04_x86_64'
run: |
source VERSION
# clang-12 と CUDA と libdrm-dev を入れる
# clang-12 と CUDA と libva-dev, libdrm-dev を入れる
sudo apt-get update
sudo apt-get install -y software-properties-common
# CUDA 10 なので ubuntu1804 で正しい
Expand All @@ -112,7 +112,7 @@ jobs:
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install cuda=$CUDA_VERSION clang-12 libdrm-dev
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install cuda=$CUDA_VERSION clang-12 libva-dev libdrm-dev
- name: Install deps for Jetson series
if: matrix.name == 'ubuntu-20.04_armv8_jetson'
run: |
Expand Down Expand Up @@ -156,7 +156,7 @@ jobs:
if: matrix.name == 'ubuntu-22.04_x86_64'
run: |
source VERSION
# clang-12 と CUDA と libdrm-dev を入れる
# clang-12 と CUDA と libva-dev, libdrm-dev を入れる
sudo apt-get update
sudo apt-get install -y software-properties-common
# CUDA 10 なので ubuntu1804 で正しい
Expand All @@ -165,7 +165,7 @@ jobs:
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/ /"
sudo apt-get update
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install cuda=$CUDA_VERSION clang-12 libdrm-dev
DEBIAN_FRONTEND=noninteractive sudo apt-get -y install cuda=$CUDA_VERSION clang-12 libva-dev libdrm-dev
- run: python3 run.py --test --package ${{ matrix.name }}
- name: Get package name
run: |
Expand Down
6 changes: 3 additions & 3 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/release/webrtc/include/third_party/zlib",
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/release/llvm/libcxx/include",
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/release/libva/include",
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/release/msdk/include",
"${workspaceFolder}/_install/ubuntu-20.04_x86_64/release/vpl/include",
"${workspaceFolder}/_build/ubuntu-20.04_x86_64/release/sora",
"${workspaceFolder}/NvCodec/include",
"${workspaceFolder}/NvCodec/NvCodec",
Expand Down Expand Up @@ -120,7 +120,7 @@
"includePath": [
"${workspaceFolder}/_install/windows_x86_64/release/boost/include",
"${workspaceFolder}/_install/windows_x86_64/release/cuda/nvcc/include",
"${workspaceFolder}/_install/windows_x86_64/release/msdk/include",
"${workspaceFolder}/_install/windows_x86_64/release/vpl/include",
"${workspaceFolder}/_install/windows_x86_64/release/webrtc/include",
"${workspaceFolder}/_install/windows_x86_64/release/webrtc/include/third_party/abseil-cpp",
"${workspaceFolder}/_install/windows_x86_64/release/webrtc/include/third_party/boringssl/src/include",
Expand All @@ -135,7 +135,7 @@
"SORA_CPP_SDK_WINDOWS",
"WEBRTC_WIN",
"USE_NVCODEC_ENCODER=1",
"USE_MSDK_ENCODER=1"
"USE_VPL_ENCODER=1"
],
"cStandard": "gnu17",
"cppStandard": "gnu++17",
Expand Down
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@

## develop

## 2022.8.0 (2022-07-28)

- [CHANGE] Intel Media SDK を利用したハードウェアエンコーダ/デコーダを削除
- @melpon
- [ADD] oneVPL を利用したハードウェアエンコーダ/デコーダを追加
- @melpon

## 2022.7.8 (2022-07-25)

- [FIX] NVDEC のデコードの画像サイズが変わった時に即時で追従するように修正
Expand Down
54 changes: 32 additions & 22 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ elseif (SORA_TARGET STREQUAL "ubuntu-20.04_armv8_jetson")
endif()

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
if (USE_VPL_ENCODER)
list(APPEND CMAKE_PREFIX_PATH ${VPL_ROOT_DIR}/lib/cmake/vpl)
endif()

set(Boost_USE_STATIC_LIBS ON)
if (WIN32)
Expand All @@ -73,7 +76,6 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
# libsora.a を作る

add_library(sora STATIC)
add_library(sora::sora ALIAS sora)
set_target_properties(sora PROPERTIES CXX_STANDARD 17 C_STANDARD 17)

string(SUBSTRING "${SORA_CPP_SDK_COMMIT}" 0 8 SORA_CPP_SDK_COMMIT_SHORT)
Expand Down Expand Up @@ -142,7 +144,7 @@ target_compile_definitions(sora
PRIVATE
USE_NVCODEC_ENCODER=$<BOOL:${USE_NVCODEC_ENCODER}>
USE_JETSON_ENCODER=$<BOOL:${USE_JETSON_ENCODER}>
USE_MSDK_ENCODER=$<BOOL:${USE_MSDK_ENCODER}>
USE_VPL_ENCODER=$<BOOL:${USE_VPL_ENCODER}>
)

# 指定したライブラリを自身の静的ライブラリにバンドルする
Expand Down Expand Up @@ -289,17 +291,17 @@ if (SORA_TARGET_OS STREQUAL "windows")
list(APPEND BUNDLE_STATIC_LIBS ${CUDA_TOOLKIT_ROOT_DIR}/lib/x64/cudart_static.lib)
endif()

if (USE_MSDK_ENCODER)
if (USE_VPL_ENCODER)
find_package(VPL REQUIRED)
target_sources(sora
PRIVATE
src/hwenc_msdk/msdk_session_impl.cpp
src/hwenc_msdk/msdk_video_decoder.cpp
src/hwenc_msdk/msdk_video_encoder.cpp
src/hwenc_vpl/vpl_session_impl.cpp
src/hwenc_vpl/vpl_video_decoder.cpp
src/hwenc_vpl/vpl_video_encoder.cpp
)
target_include_directories(sora PRIVATE ${MSDK_ROOT_DIR}/include)
target_link_libraries(sora PRIVATE "$<BUILD_INTERFACE:${MSDK_ROOT_DIR}/lib/libmfx.lib>")
# mfx を要求したくないので sora.lib に含める
list(APPEND BUNDLE_STATIC_LIBS ${MSDK_ROOT_DIR}/lib/libmfx.lib)
target_link_libraries(sora PRIVATE "$<BUILD_INTERFACE:VPL::dispatcher>")
# vpl を要求したくないので sora.lib に含める
list(APPEND BUNDLE_STATIC_LIBS ${VPL_ROOT_DIR}/lib/vpl.lib)
endif()

elseif (SORA_TARGET_OS STREQUAL "macos")
Expand Down Expand Up @@ -449,22 +451,24 @@ elseif (SORA_TARGET_OS STREQUAL "ubuntu")
list(APPEND BUNDLE_STATIC_LIBS /usr/local/cuda/lib64/libcudart_static.a)
endif()

if (USE_MSDK_ENCODER)
find_package(Msdk REQUIRED)
if (USE_VPL_ENCODER)
find_package(Libdrm REQUIRED)
find_package(Libva REQUIRED)
find_package(VPL REQUIRED)
target_include_directories(sora PRIVATE /usr/local/cuda/include)
target_sources(sora
PRIVATE
src/hwenc_msdk/msdk_session_impl.cpp
src/hwenc_msdk/msdk_video_decoder.cpp
src/hwenc_msdk/msdk_video_encoder.cpp
src/hwenc_msdk/vaapi_utils_drm.cpp
src/hwenc_msdk/vaapi_utils.cpp
src/hwenc_vpl/vpl_session_impl.cpp
src/hwenc_vpl/vpl_video_decoder.cpp
src/hwenc_vpl/vpl_video_encoder.cpp
src/hwenc_vpl/vaapi_utils_drm.cpp
src/hwenc_vpl/vaapi_utils.cpp
)
target_link_libraries(sora PRIVATE "$<BUILD_INTERFACE:Msdk::mfx>")
# drm は依存に含める
target_link_libraries(sora PUBLIC Libdrm::drm)
# mfx を要求したくないので libsora.a に含める
list(APPEND BUNDLE_STATIC_LIBS $<TARGET_FILE:Msdk::mfx> $<TARGET_FILE:Libva::va> $<TARGET_FILE:Libva::va_drm>)
target_link_libraries(sora PRIVATE "$<BUILD_INTERFACE:VPL::dispatcher>")
# va と drm は依存に含める
target_link_libraries(sora PUBLIC Libdrm::drm Libva::va Libva::va_drm)
# vpl を要求したくないので libsora.a に含める
list(APPEND BUNDLE_STATIC_LIBS $<TARGET_FILE:VPL::dispatcher>)
endif()

elseif (SORA_TARGET_OS STREQUAL "jetson")
Expand Down Expand Up @@ -546,6 +550,9 @@ endif()
# 静的ライブラリを sora.lib に含める
if (BUNDLE_STATIC_LIBS)
bundle_static_library(sora "${BUNDLE_STATIC_LIBS}" bundled_sora)
add_library(Sora::sora ALIAS bundled_sora)
else()
add_library(Sora::sora ALIAS sora)
endif()

include(GNUInstallDirs)
Expand All @@ -563,6 +570,9 @@ install(EXPORT sora-config
install(FILES cmake/FindWebRTC.cmake cmake/FindLibdrm.cmake
DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake
)
install(FILES cmake/FindWebRTC.cmake cmake/FindLibva.cmake
DESTINATION ${CMAKE_INSTALL_DATADIR}/cmake
)
install(FILES LICENSE NOTICE.md
DESTINATION ${CMAKE_INSTALL_PREFIX}
)
Expand Down
5 changes: 4 additions & 1 deletion DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ sudo apt-get -y install cuda=10.2.89-1
# sudo apt-get update
# sudo apt-get -y install cuda=10.2 clang-12
```
- libva-dev
- libdrm-dev
- ubuntu-20.04_x86_64, ubuntu-22.04_x86_64 の実行に必要な依存
- libva2
- libdrm2
- (もし Intel Media SDK を有効にしたいなら)libmfx1
- (もし内部実装が Intel Media SDK の oneVPL を有効にしたいなら)libmfx1
- (もし内部実装が oneVPL GPU の oneVPL を有効にしたいなら)libmfx-gen1.2 (Ubuntu 22.04 のみ利用可)
8 changes: 6 additions & 2 deletions NOTICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,14 @@ shall be binding upon assignees.
###############################################################################
```

## Intel Media SDK
## oneVPL

https://github.com/oneapi-src/oneVPL

```
Copyright (c) 2017 Intel Corporation
MIT License
Copyright (c) 2020 Intel Corporation
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Please read https://github.com/shiguredo/oss/blob/master/README.en.md before use
- NVIDIA Jetson Video HWA
- Apple macOS / iOS Video Toolbox
- Google Android HWA
- Intel Media SDK
- oneVPL

## ライブラリのバイナリ提供について

Expand Down
5 changes: 2 additions & 3 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
SORA_CPP_SDK_VERSION=2022.7.8
SORA_CPP_SDK_VERSION=2022.8.0
WEBRTC_BUILD_VERSION=m103.5060.5.0
BOOST_VERSION=1.79.0
CMAKE_VERSION=3.23.1
CUDA_VERSION=10.2.89-1
ANDROID_NDK_VERSION=r23b
ANDROID_NATIVE_API_LEVEL=24
ANDROID_SDK_CMDLINE_TOOLS_VERSION=8092744
LIBVA_VERSION=2.7.0
MSDK_VERSION=intel-mediasdk-20.1.1
VPL_VERSION=v2022.1.0
6 changes: 3 additions & 3 deletions cmake/FindLibva.cmake
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
find_package(Libdrm REQUIRED)

find_path(LIBVA_INCLUDE_DIR NAMES va/va.h PATHS "${LIBVA_ROOT_DIR}/include" NO_DEFAULT_PATH)
find_library(LIBVA_LIBRARY NAMES va PATHS "${LIBVA_ROOT_DIR}/lib" NO_DEFAULT_PATH)
find_library(LIBVA_DRM_LIBRARY NAMES va-drm PATHS "${LIBVA_ROOT_DIR}/lib" NO_DEFAULT_PATH)
find_path(LIBVA_INCLUDE_DIR NAMES va/va.h)
find_library(LIBVA_LIBRARY NAMES va)
find_library(LIBVA_DRM_LIBRARY NAMES va-drm)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libva DEFAULT_MSG LIBVA_INCLUDE_DIR LIBVA_LIBRARY LIBVA_DRM_LIBRARY)
Expand Down
20 changes: 0 additions & 20 deletions cmake/FindMsdk.cmake

This file was deleted.

4 changes: 4 additions & 0 deletions doc/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ GitHub Actions のビルドが失敗していたり、
### NVIDIA Jetson Orin (Ubuntu 20.04 arm64) でビルドできません

Ubuntu 20.04 x86_64 でクロスコンパイルしたバイナリを利用するようにしてください。

## NVIDIA 搭載の Windows で width height のいずれかが 128 未満のサイズの VP9 の映像を受信できません

NVIDIA VIDEO CODEC SDK のハードウェアデコーダでは width height のいずれかが 128 未満である場合 VP9 の映像をデコードできません。 width height のいずれかが 128 未満のサイズの映像を受信したい場合は VP9 以外のコーデックを利用するようにしてください。
14 changes: 0 additions & 14 deletions include/sora/hwenc_msdk/msdk_session.h

This file was deleted.

25 changes: 0 additions & 25 deletions include/sora/hwenc_msdk/msdk_video_decoder.h

This file was deleted.

25 changes: 0 additions & 25 deletions include/sora/hwenc_msdk/msdk_video_encoder.h

This file was deleted.

14 changes: 14 additions & 0 deletions include/sora/hwenc_vpl/vpl_session.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#ifndef SORA_HWENC_VPL_VPL_SESSION_H_
#define SORA_HWENC_VPL_VPL_SESSION_H_

#include <memory>

namespace sora {

struct VplSession {
static std::shared_ptr<VplSession> Create();
};

} // namespace sora

#endif
25 changes: 25 additions & 0 deletions include/sora/hwenc_vpl/vpl_video_decoder.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef SORA_HWENC_VPL_VPL_VIDEO_DECODER_H_
#define SORA_HWENC_VPL_VPL_VIDEO_DECODER_H_

#include <memory>

// WebRTC
#include <api/video/video_codec_type.h>
#include <api/video_codecs/video_decoder.h>

#include "vpl_session.h"

namespace sora {

class VplVideoDecoder : public webrtc::VideoDecoder {
public:
static bool IsSupported(std::shared_ptr<VplSession> session,
webrtc::VideoCodecType codec);
static std::unique_ptr<VplVideoDecoder> Create(
std::shared_ptr<VplSession> session,
webrtc::VideoCodecType codec);
};

} // namespace sora

#endif
Loading

0 comments on commit 5e48283

Please sign in to comment.