Skip to content

Commit

Permalink
Merge branch 'release/2023.3.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Apr 2, 2023
2 parents 585a742 + 649d9a1 commit e10f756
Show file tree
Hide file tree
Showing 25 changed files with 930 additions and 402 deletions.
12 changes: 8 additions & 4 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:base"
],
"schedule": [
"every weekend"
"config:base",
":timezone(Asia/Tokyo)",
":combinePatchMinorReleases",
":prHourlyLimitNone",
":prConcurrentLimit10",
"group:recommended",
"group:allNonMajor",
"schedule:weekly"
]
}
21 changes: 21 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,27 @@

## develop

## 2023.3.0 (2023-04-02)

- [CHANGE] SoraSignalingConfig から audio_codec_lyra_params を削除して、代わりに audio_codec_lyra_bitrate と audio_codec_lyra_usedtx を追加
- @melpon
- [UPDATE] Lyra で接続する時に、チャンネル全体で同じバージョンの Lyra を使っているかをチェックする
- @melpon
- [UPDATE] JetPack 5.1 に対応する
- @tnoho @melpon
- [UPDATE] oneVPL を v2023.1.3 に上げる
- @voluntas
- [UPDATE] CMake を 3.25.3 に上げる
- @melpon
- [UPDATE] 例外が有効になっていなかった一部の依存ライブラリも例外を有効にする
- @melpon
- [UPDATE] WebRTC を m111.5563.4.4 に上げる
- @melpon
- [ADD] 2022.11.0 で無効にしていた Jetson の HW MJPEG デコーダを有効にする
- @tnoho @melpon
- [FIX] WS 切断時のタイムアウトが起きた際に無効な関数オブジェクトを呼んでいたのを修正
- @melpon

## 2023.2.0 (2023-03-05)

- [UPDATE] NVIDIA Video Codec SDK を 12.0 に上げる
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ elseif (SORA_TARGET_OS STREQUAL "jetson")
src/hwenc_jetson/jetson_v4l2_capturer.cpp
src/hwenc_jetson/jetson_video_encoder.cpp
src/hwenc_jetson/jetson_video_decoder.cpp
${CMAKE_SYSROOT}/usr/src/jetson_multimedia_api/samples/common/classes/NvBufSurface.cpp
${CMAKE_SYSROOT}/usr/src/jetson_multimedia_api/samples/common/classes/NvBuffer.cpp
${CMAKE_SYSROOT}/usr/src/jetson_multimedia_api/samples/common/classes/NvElement.cpp
${CMAKE_SYSROOT}/usr/src/jetson_multimedia_api/samples/common/classes/NvElementProfiler.cpp
Expand All @@ -541,8 +542,8 @@ elseif (SORA_TARGET_OS STREQUAL "jetson")
${CMAKE_SYSROOT}/usr/src/jetson_multimedia_api/samples/common/classes/NvLogging.cpp
${CMAKE_SYSROOT}/usr/src/jetson_multimedia_api/samples/common/classes/NvV4l2Element.cpp
${CMAKE_SYSROOT}/usr/src/jetson_multimedia_api/samples/common/classes/NvV4l2ElementPlane.cpp
${CMAKE_SYSROOT}/usr/src/jetson_multimedia_api/samples/common/classes/NvVideoEncoder.cpp
${CMAKE_SYSROOT}/usr/src/jetson_multimedia_api/samples/common/classes/NvVideoDecoder.cpp
${CMAKE_SYSROOT}/usr/src/jetson_multimedia_api/samples/common/classes/NvVideoEncoder.cpp
)

target_include_directories(sora PRIVATE ${CMAKE_SYSROOT}/usr/src/jetson_multimedia_api/include)
Expand All @@ -564,6 +565,7 @@ elseif (SORA_TARGET_OS STREQUAL "jetson")
#nvddk_2d_v2
nvjpeg
nvbufsurface
nvbufsurftransform
#nvos
)
endif(USE_JETSON_ENCODER)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Please read https://github.com/shiguredo/oss/blob/master/README.en.md before use
- VP8 / VP9 / H.264
- [Intel oneVPL](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onevpl.html) (Intel Media SDK の後継)
- VP9 / AV1 / H.264
- [google/lyra: A Very Low\-Bitrate Codec for Speech Compression](https://github.com/google/lyra) 対応
- 各プラットフォームへの [google/lyra: A Very Low\-Bitrate Codec for Speech Compression](https://github.com/google/lyra) 対応

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

Expand Down
9 changes: 5 additions & 4 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
SORA_CPP_SDK_VERSION=2023.2.0
WEBRTC_BUILD_VERSION=m111.5563.4.2
SORA_CPP_SDK_VERSION=2023.3.0
WEBRTC_BUILD_VERSION=m111.5563.4.4
BOOST_VERSION=1.81.0
CMAKE_VERSION=3.23.1
CMAKE_VERSION=3.25.3
BAZEL_VERSION=5.3.2
LYRA_VERSION=1.3.0
LYRA_COMPATIBLE_VERSION=1.3.0
CUDA_VERSION=10.2.89-1
ANDROID_NDK_VERSION=r25b
ANDROID_NATIVE_API_LEVEL=29
ANDROID_SDK_CMDLINE_TOOLS_VERSION=8092744
VPL_VERSION=v2023.1.1
VPL_VERSION=v2023.1.3
10 changes: 9 additions & 1 deletion doc/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,18 @@ GitHub Actions でビルドを行い確認していますので、まずは GitH
GitHub Actions のビルドが失敗していたり、
ビルド済みバイナリがうまく動作しない場合は Discord へご連絡ください。

### NVIDIA Jetson Orin (Ubuntu 20.04 arm64) でビルドできません
## 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 以外のコーデックを利用するようにしてください。

## Windows の Chrome で Jetson の H.264 映像を受信すると色が緑色になります

Chrome のハードウェアアクセラレーションによって、 Windows 環境でのみ Jetson の H.264 映像を受信すると映像の色が緑色になってしまうことを確認しています。解決策として Chrome の ハードウェアアクセラレーションを無効にすることで、映像の色が緑色になるのを回避できます。設定方法を以下に記載します。

`Chrome の設定 -> システム -> ハードウェア アクセラレーションが使用可能な場合は使用する` の順で Chrome の設定ページを開き、スクリーンショットの赤枠の部分をOFF に切り替えて Chrome を再起動してください。

[![Image from Gyazo](https://i.gyazo.com/15fd370b7b21c4e0990e9516a8981840.png)](https://gyazo.com/15fd370b7b21c4e0990e9516a8981840)
67 changes: 60 additions & 7 deletions include/sora/hwenc_jetson/jetson_v4l2_capturer.h
Original file line number Diff line number Diff line change
@@ -1,26 +1,79 @@
#ifndef SORA_HWENC_JETSON_JETSON_V4L2_CAPTURER_H_
#define SORA_HWENC_JETSON_JETSON_V4L2_CAPTURER_H_

#include <stddef.h>
#include <stdint.h>

#include <memory>

// Linux
#include <linux/videodev2.h>

// WebRTC
#include <modules/video_capture/video_capture_defines.h>
#include <modules/video_capture/video_capture_impl.h>
#include <rtc_base/platform_thread.h>
#include <rtc_base/synchronization/mutex.h>

#include "jetson_jpeg_decoder_pool.h"
#include "sora/scalable_track_source.h"
#include "sora/v4l2/v4l2_video_capturer.h"

namespace sora {

class JetsonV4L2Capturer : public V4L2VideoCapturer {
class JetsonV4L2Capturer : public ScalableVideoTrackSource {
public:
JetsonV4L2Capturer(const V4L2VideoCapturerConfig& config);
static rtc::scoped_refptr<V4L2VideoCapturer> Create(
static rtc::scoped_refptr<JetsonV4L2Capturer> Create(
const V4L2VideoCapturerConfig& config);
JetsonV4L2Capturer(const V4L2VideoCapturerConfig& config);
~JetsonV4L2Capturer();

private:
static void LogDeviceList(
webrtc::VideoCaptureModule::DeviceInfo* device_info);

int32_t Init(const char* deviceUniqueId,
const std::string& specifiedVideoDevice);
int32_t StartCapture(const V4L2VideoCapturerConfig& config);

int32_t StopCapture();
bool AllocateVideoBuffers();
bool DeAllocateVideoBuffers();
void OnCaptured(v4l2_buffer* buf);

int32_t _deviceFd;
int32_t _currentWidth;
int32_t _currentHeight;
int32_t _currentPixelFormat;
int32_t _currentFrameRate;
webrtc::VideoType _captureVideoType;
struct Buffer {
void* start;
size_t length;
int fd;
};
Buffer* _pool;

private:
static rtc::scoped_refptr<V4L2VideoCapturer> Create(
static rtc::scoped_refptr<JetsonV4L2Capturer> Create(
webrtc::VideoCaptureModule::DeviceInfo* device_info,
const V4L2VideoCapturerConfig& config,
size_t capture_device_index);
bool FindDevice(const char* deviceUniqueIdUTF8, const std::string& device);

enum { kNoOfV4L2Bufffers = 4 };

static void CaptureThread(void*);
bool CaptureProcess();

rtc::PlatformThread _captureThread;
webrtc::Mutex capture_lock_;
bool quit_ RTC_GUARDED_BY(capture_lock_);
std::string _videoDevice;

bool AllocateVideoBuffers() override;
bool DeAllocateVideoBuffers() override;
void OnCaptured(uint8_t* data, uint32_t bytesused) override;
int32_t _buffersAllocatedByDevice;
bool _useNative;
bool _captureStarted;

std::shared_ptr<JetsonJpegDecoderPool> jpeg_decoder_pool_;
};
Expand Down
20 changes: 2 additions & 18 deletions include/sora/hwenc_jetson/jetson_video_encoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

class NvBuffer;
class NvV4l2Element;
//class NvVideoConverter;
class NvVideoEncoder;
struct v4l2_ctrl_videoenc_outputbuf_metadata_;

Expand Down Expand Up @@ -94,21 +93,7 @@ class JetsonVideoEncoder : public webrtc::VideoEncoder {

int32_t JetsonConfigure();
void JetsonRelease();
void SendEOS(NvV4l2Element* element);
static bool ConvertFinishedCallbackFunction(struct v4l2_buffer* v4l2_buf,
NvBuffer* buffer,
NvBuffer* shared_buffer,
void* data);
bool ConvertFinishedCallback(struct v4l2_buffer* v4l2_buf,
NvBuffer* buffer,
NvBuffer* shared_buffer);
static bool EncodeOutputCallbackFunction(struct v4l2_buffer* v4l2_buf,
NvBuffer* buffer,
NvBuffer* shared_buffer,
void* data);
bool EncodeOutputCallback(struct v4l2_buffer* v4l2_buf,
NvBuffer* buffer,
NvBuffer* shared_buffer);
void SendEOS();
static bool EncodeFinishedCallbackFunction(struct v4l2_buffer* v4l2_buf,
NvBuffer* buffer,
NvBuffer* shared_buffer,
Expand All @@ -125,7 +110,6 @@ class JetsonVideoEncoder : public webrtc::VideoEncoder {

webrtc::VideoCodec codec_;
webrtc::EncodedImageCallback* callback_;
//NvVideoConverter* converter_;
NvVideoEncoder* encoder_;
std::unique_ptr<webrtc::BitrateAdjuster> bitrate_adjuster_;
uint32_t framerate_;
Expand All @@ -139,7 +123,6 @@ class JetsonVideoEncoder : public webrtc::VideoEncoder {
int32_t width_;
int32_t height_;
bool use_native_;
NvV4l2Element* native_input_elem_;
bool use_dmabuff_;
int dmabuff_fd_[CONVERTER_CAPTURE_NUM];

Expand All @@ -153,6 +136,7 @@ class JetsonVideoEncoder : public webrtc::VideoEncoder {
std::mutex enc0_buffer_mtx_;
std::condition_variable enc0_buffer_cond_;
std::queue<NvBuffer*>* enc0_buffer_queue_;
int output_plane_fd_[32];
webrtc::EncodedImage encoded_image_;
};

Expand Down
9 changes: 8 additions & 1 deletion include/sora/sora_signaling.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ enum class SoraSignalingErrorCode {
WEBSOCKET_ONERROR,
PEER_CONNECTION_STATE_FAILED,
ICE_FAILED,
LYRA_VERSION_INCOMPATIBLE,
};

class SoraSignalingObserver {
Expand Down Expand Up @@ -65,7 +66,8 @@ struct SoraSignalingConfig {
bool audio = true;
std::string video_codec_type = "";
std::string audio_codec_type = "";
boost::json::value audio_codec_lyra_params;
int audio_codec_lyra_bitrate = 0;
boost::optional<bool> audio_codec_lyra_usedtx;
int video_bit_rate = 0;
int audio_bit_rate = 0;
std::string audio_streaming_language_code;
Expand Down Expand Up @@ -109,6 +111,7 @@ struct SoraSignalingConfig {
rtc::PacketSocketFactory* socket_factory = nullptr;

bool disable_signaling_url_randomization = false;
bool check_lyra_version = false;
};

class SoraSignaling : public std::enable_shared_from_this<SoraSignaling>,
Expand All @@ -122,6 +125,7 @@ class SoraSignaling : public std::enable_shared_from_this<SoraSignaling>,
const SoraSignalingConfig& config);
rtc::scoped_refptr<webrtc::PeerConnectionInterface> GetPeerConnection() const;
std::string GetVideoMid() const;
std::string GetAudioMid() const;

void Connect();
void Disconnect();
Expand All @@ -140,6 +144,8 @@ class SoraSignaling : public std::enable_shared_from_this<SoraSignaling>,
std::string url,
std::shared_ptr<Websocket> ws);

bool CheckSdp(const std::string& sdp);

void DoRead();
void DoSendConnect(bool redirect);
void DoSendPong();
Expand Down Expand Up @@ -238,6 +244,7 @@ class SoraSignaling : public std::enable_shared_from_this<SoraSignaling>,
rtc::scoped_refptr<webrtc::PeerConnectionInterface> pc_;
std::vector<webrtc::RtpEncodingParameters> encodings_;
std::string video_mid_;
std::string audio_mid_;

boost::asio::deadline_timer connection_timeout_timer_;
boost::asio::deadline_timer closing_timeout_timer_;
Expand Down
1 change: 1 addition & 0 deletions include/sora/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class Version {
static std::string GetClientName();
static std::string GetLibwebrtcName();
static std::string GetEnvironmentName();
static std::string GetLyraCompatibleVersion();
};

} // namespace sora
Expand Down
2 changes: 1 addition & 1 deletion include/sora/websocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ class Websocket {
void Read(read_callback_t on_read);
void WriteText(std::string text, write_callback_t on_write = nullptr);
void Close(close_callback_t on_close, int timeout_seconds);
void Cancel();

websocket_t& NativeSocket();
ssl_websocket_t& NativeSecureSocket();
Expand Down Expand Up @@ -142,7 +143,6 @@ class Websocket {
std::vector<std::unique_ptr<WriteData>> write_data_;

boost::asio::deadline_timer close_timeout_timer_;
bool closed_ = false;

bool https_proxy_ = false;
std::string proxy_url_;
Expand Down
4 changes: 2 additions & 2 deletions multistrap/ubuntu-20.04_armv8_jetson.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ components=main universe
[Jetson]
packages=
source=https://repo.download.nvidia.com/jetson/common
suite=r35.1
suite=r35.2
components=main

[T194]
packages=nvidia-l4t-camera nvidia-l4t-jetson-multimedia-api
source=https://repo.download.nvidia.com/jetson/t194
suite=r35.1
suite=r35.2
components=main
3 changes: 3 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1225,6 +1225,7 @@ def install_deps(platform: Platform, source_dir, build_dir, install_dir, debug,
'-nostdinc++',
'-std=gnu++17',
f"-isystem{os.path.join(webrtc_info.libcxx_dir, 'include')}",
'-fexperimental-relative-c++-abi-vtables',
]
install_boost_args['toolset'] = 'clang'
install_boost_args['android_ndk'] = os.path.join(install_dir, 'android-ndk')
Expand Down Expand Up @@ -1482,6 +1483,7 @@ def main():
sora_cpp_sdk_version = version['SORA_CPP_SDK_VERSION']
sora_cpp_sdk_commit = cmdcap(['git', 'rev-parse', 'HEAD'])
android_native_api_level = version['ANDROID_NATIVE_API_LEVEL']
lyra_compatible_version = version['LYRA_COMPATIBLE_VERSION']
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_CPP_SDK_VERSION={sora_cpp_sdk_version}")
Expand All @@ -1490,6 +1492,7 @@ def main():
cmake_args.append(f"-DWEBRTC_BUILD_VERSION={webrtc_version['WEBRTC_BUILD_VERSION']}")
cmake_args.append(f"-DWEBRTC_READABLE_VERSION={webrtc_version['WEBRTC_READABLE_VERSION']}")
cmake_args.append(f"-DWEBRTC_COMMIT={webrtc_version['WEBRTC_COMMIT']}")
cmake_args.append(f"-DLYRA_COMPATIBLE_VERSION={lyra_compatible_version}")
if platform.target.os == 'ubuntu':
if platform.target.package_name in ('ubuntu-20.04_x86_64', 'ubuntu-22.04_x86_64'):
cmake_args.append("-DCMAKE_C_COMPILER=clang-12")
Expand Down
Loading

0 comments on commit e10f756

Please sign in to comment.