Skip to content

Commit

Permalink
Merge branch 'release/2023.1.0' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Jan 12, 2023
2 parents 4d6b6f2 + 63d22b1 commit 86a95d6
Show file tree
Hide file tree
Showing 13 changed files with 234 additions and 219 deletions.
13 changes: 12 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@

## develop

## 2022.18.0 (2022-12-25)
## 2023.1.0 (2023-01-12)

- [ADD] SoraSignalingConfig に audio_streaming_language_code を追加
- @melpon
- [UPDATE] WebRTC を m109.5414.2.0 に上げる
- @melpon
- [UPDATE] Boost を 1.81.0 に上げる
- @melpon
- [UPDATE] oneVPL を v2023.1.1 に上げる
- @melpon

## 2022.19.0 (2022-12-25)

- [CHANGE] Lyra を静的ライブラリ化
- @melpon
Expand Down
8 changes: 4 additions & 4 deletions VERSION
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
SORA_CPP_SDK_VERSION=2022.19.0
WEBRTC_BUILD_VERSION=m107.5304.4.1
BOOST_VERSION=1.80.0
SORA_CPP_SDK_VERSION=2023.1.0
WEBRTC_BUILD_VERSION=m109.5414.2.0
BOOST_VERSION=1.81.0
CMAKE_VERSION=3.23.1
BAZEL_VERSION=5.3.2
LYRA_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=v2022.1.0
VPL_VERSION=v2023.1.1
70 changes: 35 additions & 35 deletions include/sora/i420_encoder_adapter.h
Original file line number Diff line number Diff line change
@@ -1,36 +1,36 @@
#ifndef SORA_I420_ENCODER_ADAPTER_H_
#define SORA_I420_ENCODER_ADAPTER_H_

#include <memory>

// WebRTC
#include <api/video_codecs/video_encoder.h>

namespace sora {

// kNative なフレームを I420 にするアダプタ
class I420EncoderAdapter : public webrtc::VideoEncoder {
public:
I420EncoderAdapter(std::shared_ptr<webrtc::VideoEncoder> encoder);

void SetFecControllerOverride(
webrtc::FecControllerOverride* fec_controller_override) override;
int Release() override;
int InitEncode(const webrtc::VideoCodec* codec_settings,
const webrtc::VideoEncoder::Settings& settings) override;
int Encode(const webrtc::VideoFrame& input_image,
const std::vector<webrtc::VideoFrameType>* frame_types) override;
int RegisterEncodeCompleteCallback(
webrtc::EncodedImageCallback* callback) override;
void SetRates(const RateControlParameters& parameters) override;
void OnPacketLossRateUpdate(float packet_loss_rate) override;
void OnRttUpdate(int64_t rtt_ms) override;
void OnLossNotification(const LossNotification& loss_notification) override;
EncoderInfo GetEncoderInfo() const override;

private:
std::shared_ptr<webrtc::VideoEncoder> encoder_;
};

} // namespace sora
#ifndef SORA_I420_ENCODER_ADAPTER_H_
#define SORA_I420_ENCODER_ADAPTER_H_

#include <memory>

// WebRTC
#include <api/video_codecs/video_encoder.h>

namespace sora {

// kNative なフレームを I420 にするアダプタ
class I420EncoderAdapter : public webrtc::VideoEncoder {
public:
I420EncoderAdapter(std::shared_ptr<webrtc::VideoEncoder> encoder);

void SetFecControllerOverride(
webrtc::FecControllerOverride* fec_controller_override) override;
int Release() override;
int InitEncode(const webrtc::VideoCodec* codec_settings,
const webrtc::VideoEncoder::Settings& settings) override;
int Encode(const webrtc::VideoFrame& input_image,
const std::vector<webrtc::VideoFrameType>* frame_types) override;
int RegisterEncodeCompleteCallback(
webrtc::EncodedImageCallback* callback) override;
void SetRates(const RateControlParameters& parameters) override;
void OnPacketLossRateUpdate(float packet_loss_rate) override;
void OnRttUpdate(int64_t rtt_ms) override;
void OnLossNotification(const LossNotification& loss_notification) override;
EncoderInfo GetEncoderInfo() const override;

private:
std::shared_ptr<webrtc::VideoEncoder> encoder_;
};

} // namespace sora
#endif
32 changes: 16 additions & 16 deletions include/sora/sora_peer_connection_factory.h
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#ifndef SORA_SORA_PEER_CONNECTION_FACTORY_H_
#define SORA_SORA_PEER_CONNECTION_FACTORY_H_

// WebRTC
#include <api/peer_connection_interface.h>
#include <api/scoped_refptr.h>
#include <pc/connection_context.h>

namespace sora {

rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
CreateModularPeerConnectionFactoryWithContext(
webrtc::PeerConnectionFactoryDependencies dependencies,
rtc::scoped_refptr<webrtc::ConnectionContext>& context);

}
#ifndef SORA_SORA_PEER_CONNECTION_FACTORY_H_
#define SORA_SORA_PEER_CONNECTION_FACTORY_H_

// WebRTC
#include <api/peer_connection_interface.h>
#include <api/scoped_refptr.h>
#include <pc/connection_context.h>

namespace sora {

rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface>
CreateModularPeerConnectionFactoryWithContext(
webrtc::PeerConnectionFactoryDependencies dependencies,
rtc::scoped_refptr<webrtc::ConnectionContext>& context);

}
#endif
1 change: 1 addition & 0 deletions include/sora/sora_signaling.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ struct SoraSignalingConfig {
boost::json::value audio_codec_lyra_params;
int video_bit_rate = 0;
int audio_bit_rate = 0;
std::string audio_streaming_language_code;
boost::json::value metadata;
boost::json::value signaling_notify_metadata;
std::string role = "sendonly";
Expand Down
4 changes: 3 additions & 1 deletion run.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,8 @@ def install_boost(
sysroot = os.path.join(android_ndk, 'toolchains', 'llvm', 'prebuilt', 'linux-x86_64', 'sysroot')
f.write(f"using clang \
: android \
: {os.path.join(bin, f'aarch64-linux-android{native_api_level}-clang++')} \
: {os.path.join(bin, f'clang++')} \
--target=aarch64-none-linux-android{native_api_level} \
--sysroot={sysroot} \
: <archiver>{os.path.join(bin, 'llvm-ar')} \
<ranlib>{os.path.join(bin, 'llvm-ranlib')} \
Expand Down Expand Up @@ -1502,6 +1503,7 @@ def main():
# r23b には ANDROID_CPP_FEATURES=exceptions でも例外が設定されない問題がある
# https://github.com/android/ndk/issues/1618
cmake_args.append('-DCMAKE_ANDROID_EXCEPTIONS=ON')
cmake_args.append('-DANDROID_NDK=OFF')
cmake_args.append(f"-DSORA_WEBRTC_LDFLAGS={os.path.join(install_dir, 'webrtc.ldflags')}")
if platform.target.os == 'jetson':
sysroot = os.path.join(install_dir, 'rootfs')
Expand Down
56 changes: 28 additions & 28 deletions src/hwenc_vpl/vpl_utils.h
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
#ifndef SORA_HWENC_VPL_VPL_UTILS_H_
#define SORA_HWENC_VPL_VPL_UTILS_H_

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

// oneVPL
#include <vpl/mfxdefs.h>

#define VPL_CHECK_RESULT(P, X, ERR) \
{ \
if ((X) > (P)) { \
RTC_LOG(LS_ERROR) << "oneVPL Error: " << ERR; \
throw ERR; \
} \
}

namespace sora {

static mfxU32 ToMfxCodec(webrtc::VideoCodecType codec) {
return codec == webrtc::kVideoCodecVP8 ? MFX_CODEC_VP8
: codec == webrtc::kVideoCodecVP9 ? MFX_CODEC_VP9
: codec == webrtc::kVideoCodecH264 ? MFX_CODEC_AVC
: MFX_CODEC_AV1;
}

} // namespace sora
#endif
#ifndef SORA_HWENC_VPL_VPL_UTILS_H_
#define SORA_HWENC_VPL_VPL_UTILS_H_

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

// oneVPL
#include <vpl/mfxdefs.h>

#define VPL_CHECK_RESULT(P, X, ERR) \
{ \
if ((X) > (P)) { \
RTC_LOG(LS_ERROR) << "oneVPL Error: " << ERR; \
throw ERR; \
} \
}

namespace sora {

static mfxU32 ToMfxCodec(webrtc::VideoCodecType codec) {
return codec == webrtc::kVideoCodecVP8 ? MFX_CODEC_VP8
: codec == webrtc::kVideoCodecVP9 ? MFX_CODEC_VP9
: codec == webrtc::kVideoCodecH264 ? MFX_CODEC_AVC
: MFX_CODEC_AV1;
}

} // namespace sora
#endif
110 changes: 55 additions & 55 deletions src/i420_encoder_adapter.cpp
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
#include "sora/i420_encoder_adapter.h"

#include <rtc_base/logging.h>

namespace sora {

I420EncoderAdapter::I420EncoderAdapter(
std::shared_ptr<webrtc::VideoEncoder> encoder)
: encoder_(encoder) {}

void I420EncoderAdapter::SetFecControllerOverride(
webrtc::FecControllerOverride* fec_controller_override) {
encoder_->SetFecControllerOverride(fec_controller_override);
}
int I420EncoderAdapter::Release() {
return encoder_->Release();
}
int I420EncoderAdapter::InitEncode(
const webrtc::VideoCodec* codec_settings,
const webrtc::VideoEncoder::Settings& settings) {
return encoder_->InitEncode(codec_settings, settings);
}
int I420EncoderAdapter::Encode(
const webrtc::VideoFrame& input_image,
const std::vector<webrtc::VideoFrameType>* frame_types) {
auto frame = input_image;
auto buffer = frame.video_frame_buffer();
if (buffer->type() == webrtc::VideoFrameBuffer::Type::kNative) {
frame.set_video_frame_buffer(buffer->ToI420());
}
return encoder_->Encode(frame, frame_types);
}

int I420EncoderAdapter::RegisterEncodeCompleteCallback(
webrtc::EncodedImageCallback* callback) {
return encoder_->RegisterEncodeCompleteCallback(callback);
}
void I420EncoderAdapter::SetRates(const RateControlParameters& parameters) {
encoder_->SetRates(parameters);
}
void I420EncoderAdapter::OnPacketLossRateUpdate(float packet_loss_rate) {
encoder_->OnPacketLossRateUpdate(packet_loss_rate);
}
void I420EncoderAdapter::OnRttUpdate(int64_t rtt_ms) {
encoder_->OnRttUpdate(rtt_ms);
}
void I420EncoderAdapter::OnLossNotification(
const LossNotification& loss_notification) {
encoder_->OnLossNotification(loss_notification);
}

webrtc::VideoEncoder::EncoderInfo I420EncoderAdapter::GetEncoderInfo() const {
return encoder_->GetEncoderInfo();
}

#include "sora/i420_encoder_adapter.h"

#include <rtc_base/logging.h>

namespace sora {

I420EncoderAdapter::I420EncoderAdapter(
std::shared_ptr<webrtc::VideoEncoder> encoder)
: encoder_(encoder) {}

void I420EncoderAdapter::SetFecControllerOverride(
webrtc::FecControllerOverride* fec_controller_override) {
encoder_->SetFecControllerOverride(fec_controller_override);
}
int I420EncoderAdapter::Release() {
return encoder_->Release();
}
int I420EncoderAdapter::InitEncode(
const webrtc::VideoCodec* codec_settings,
const webrtc::VideoEncoder::Settings& settings) {
return encoder_->InitEncode(codec_settings, settings);
}
int I420EncoderAdapter::Encode(
const webrtc::VideoFrame& input_image,
const std::vector<webrtc::VideoFrameType>* frame_types) {
auto frame = input_image;
auto buffer = frame.video_frame_buffer();
if (buffer->type() == webrtc::VideoFrameBuffer::Type::kNative) {
frame.set_video_frame_buffer(buffer->ToI420());
}
return encoder_->Encode(frame, frame_types);
}

int I420EncoderAdapter::RegisterEncodeCompleteCallback(
webrtc::EncodedImageCallback* callback) {
return encoder_->RegisterEncodeCompleteCallback(callback);
}
void I420EncoderAdapter::SetRates(const RateControlParameters& parameters) {
encoder_->SetRates(parameters);
}
void I420EncoderAdapter::OnPacketLossRateUpdate(float packet_loss_rate) {
encoder_->OnPacketLossRateUpdate(packet_loss_rate);
}
void I420EncoderAdapter::OnRttUpdate(int64_t rtt_ms) {
encoder_->OnRttUpdate(rtt_ms);
}
void I420EncoderAdapter::OnLossNotification(
const LossNotification& loss_notification) {
encoder_->OnLossNotification(loss_notification);
}

webrtc::VideoEncoder::EncoderInfo I420EncoderAdapter::GetEncoderInfo() const {
return encoder_->GetEncoderInfo();
}

} // namespace sora
23 changes: 10 additions & 13 deletions src/sora_default_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,16 @@ bool SoraDefaultClient::Configure() {
// media_dependencies
cricket::MediaEngineDependencies media_dependencies;
media_dependencies.task_queue_factory = dependencies.task_queue_factory.get();
media_dependencies.adm =
worker_thread_->Invoke<rtc::scoped_refptr<webrtc::AudioDeviceModule>>(
RTC_FROM_HERE, [&] {
sora::AudioDeviceModuleConfig config;
if (!config_.use_audio_device) {
config.audio_layer = webrtc::AudioDeviceModule::kDummyAudio;
}
config.task_queue_factory = dependencies.task_queue_factory.get();
config.jni_env = sora::GetJNIEnv();
config.application_context =
GetAndroidApplicationContext(config.jni_env);
return sora::CreateAudioDeviceModule(config);
});
media_dependencies.adm = worker_thread_->BlockingCall([&] {
sora::AudioDeviceModuleConfig config;
if (!config_.use_audio_device) {
config.audio_layer = webrtc::AudioDeviceModule::kDummyAudio;
}
config.task_queue_factory = dependencies.task_queue_factory.get();
config.jni_env = sora::GetJNIEnv();
config.application_context = GetAndroidApplicationContext(config.jni_env);
return sora::CreateAudioDeviceModule(config);
});

media_dependencies.audio_encoder_factory =
sora::CreateBuiltinAudioEncoderFactory();
Expand Down
Loading

0 comments on commit 86a95d6

Please sign in to comment.