Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

サイマルキャストマルチコーデックに対応する #115

Open
wants to merge 17 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,8 @@
- @melpon
- [ADD] WebSocket での接続時に User-Agent ヘッダーを追加する
- @melpon
- [ADD] sumomo に --simulcast-multicodec オプションを追加
- @melpon

## 2024.6.1

Expand All @@ -135,9 +137,9 @@

- [CHANGE] 別リポジトリに分かれていた Sora C++ SDK のサンプル集を examples/ 以下のディレクトリに統合する
- @melpon
- [UPDATE] libwebrtc を `m122.6261.1.0` にあげる
- [UPDATE] libwebrtc を `m122.6261.1.1` にあげる
- Ubuntu のビルドを通すために、 __assertion_handler というファイルをコピーする必要があった
- @miosakuma @enm10k
- @miosakuma @enm10k @melpon
- [UPDATE] libvpl を v2.10.1 にあげる
- @enm10k
- [ADD] OpenH264 エンコーダを追加
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@ elseif (SORA_TARGET_OS STREQUAL "macos")
PUBLIC
WEBRTC_POSIX
WEBRTC_MAC
RTC_ENABLE_H265
)

target_link_libraries(sora
Expand Down Expand Up @@ -402,6 +403,7 @@ elseif (SORA_TARGET_OS STREQUAL "ios")
WEBRTC_MAC
WEBRTC_IOS
OPENSSL_IS_BORINGSSL
RTC_ENABLE_H265
)

elseif (SORA_TARGET_OS STREQUAL "android")
Expand All @@ -422,6 +424,7 @@ elseif (SORA_TARGET_OS STREQUAL "android")
WEBRTC_POSIX
WEBRTC_LINUX
WEBRTC_ANDROID
RTC_ENABLE_H265
_LIBCPP_ABI_NAMESPACE=Cr
_LIBCPP_ABI_VERSION=2
_LIBCPP_DISABLE_AVAILABILITY
Expand Down
4 changes: 4 additions & 0 deletions examples/sumomo/src/sumomo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ struct SumomoConfig {
boost::optional<bool> spotlight;
int spotlight_number = 0;
boost::optional<bool> simulcast;
boost::optional<bool> simulcast_multicodec;
boost::optional<bool> data_channel_signaling;
boost::optional<bool> ignore_disconnect_websocket;

Expand Down Expand Up @@ -153,6 +154,7 @@ class Sumomo : public std::enable_shared_from_this<Sumomo>,
config.spotlight = config_.spotlight;
config.spotlight_number = config_.spotlight_number;
config.simulcast = config_.simulcast;
config.simulcast_multicodec = config_.simulcast_multicodec;
config.data_channel_signaling = config_.data_channel_signaling;
config.ignore_disconnect_websocket = config_.ignore_disconnect_websocket;
config.proxy_agent = "Momo Sample for Sora C++ SDK";
Expand Down Expand Up @@ -412,6 +414,8 @@ int main(int argc, char* argv[]) {
->check(CLI::Range(0, 8));
add_optional_bool(app, "--simulcast", config.simulcast,
"Use simulcast (default: none)");
add_optional_bool(app, "--simulcast-multicodec", config.simulcast_multicodec,
"Use simulcast multi-codec (default: none)");
add_optional_bool(app, "--data-channel-signaling",
config.data_channel_signaling,
"Use DataChannel for Sora signaling (default: none)");
Expand Down
1 change: 1 addition & 0 deletions include/sora/sora_signaling.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ struct SoraSignalingConfig {
std::string spotlight_focus_rid;
std::string spotlight_unfocus_rid;
boost::optional<bool> simulcast;
boost::optional<bool> simulcast_multicodec;
std::string simulcast_rid;
boost::optional<bool> data_channel_signaling;
int data_channel_signaling_timeout = 180;
Expand Down
21 changes: 11 additions & 10 deletions src/default_video_formats.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,17 @@ std::vector<webrtc::SdpVideoFormat> GetDefaultVideoFormats(
cricket::kAv1CodecName, webrtc::CodecParameterMap(),
webrtc::LibaomAv1EncoderSupportedScalabilityModes()));
} else if (codec == webrtc::kVideoCodecH264) {
r.push_back(CreateH264Format(webrtc::H264Profile::kProfileBaseline,
webrtc::H264Level::kLevel3_1, "1"));
r.push_back(CreateH264Format(webrtc::H264Profile::kProfileBaseline,
webrtc::H264Level::kLevel3_1, "0"));
r.push_back(
CreateH264Format(webrtc::H264Profile::kProfileConstrainedBaseline,
webrtc::H264Level::kLevel3_1, "1"));
r.push_back(
CreateH264Format(webrtc::H264Profile::kProfileConstrainedBaseline,
webrtc::H264Level::kLevel3_1, "0"));
for (auto profile : {
webrtc::H264Profile::kProfileBaseline,
webrtc::H264Profile::kProfileConstrainedBaseline,
webrtc::H264Profile::kProfileMain,
}) {
for (auto level : {webrtc::H264Level::kLevel3_1}) {
for (auto mode : {0, 1}) {
r.push_back(CreateH264Format(profile, level, std::to_string(mode)));
}
}
}
} else if (codec == webrtc::kVideoCodecH265) {
r.push_back(webrtc::SdpVideoFormat(cricket::kH265CodecName));
}
Expand Down
4 changes: 4 additions & 0 deletions src/sora_signaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ void SoraSignaling::DoSendConnect(bool redirect) {
m["simulcast"] = *config_.simulcast;
}

if (config_.simulcast_multicodec) {
m["simulcast_multicodec"] = *config_.simulcast_multicodec;
}

if (!config_.simulcast_rid.empty()) {
m["simulcast_rid"] = config_.simulcast_rid;
}
Expand Down
4 changes: 3 additions & 1 deletion test/.testparam.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@
"capture_width": 1024,
"capture_height": 768,
"video_bit_rate": 0,
"video_codec_type": "H264",
"video_codec_type": null,
"simulcast": false,
"simulcast_multicodec": false,
"use_hardware_encoder": true,
"openh264": null,
"log_level": 2,
},

"signaling_urls": ["必須"],
Expand Down
7 changes: 7 additions & 0 deletions test/hello.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ void HelloSora::Run() {
config.video_bit_rate = config_.video_bit_rate;
config.multistream = true;
config.simulcast = config_.simulcast;
config.simulcast_multicodec = config_.simulcast_multicodec;
conn_ = sora::SoraSignaling::Create(config);

boost::asio::executor_work_guard<boost::asio::io_context::executor_type>
Expand Down Expand Up @@ -170,6 +171,12 @@ int main(int argc, char* argv[]) {
if (auto it = v.as_object().find("simulcast"); it != v.as_object().end()) {
config.simulcast = it->value().as_bool();
}
if (auto it = v.as_object().find("simulcast_multicodec"); it != v.as_object().end()) {
config.simulcast_multicodec = it->value().as_bool();
}
if (auto it = v.as_object().find("log_level"); it != v.as_object().end()) {
rtc::LogMessage::LogToDebug((rtc::LoggingSeverity)boost::json::value_to<int>(it->value()));
}

sora::SoraClientContextConfig context_config;
context_config.get_android_application_context = GetAndroidApplicationContext;
Expand Down
1 change: 1 addition & 0 deletions test/hello.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct HelloSoraConfig {
int video_bit_rate = 0;
std::string video_codec_type = "H264";
bool simulcast = false;
bool simulcast_multicodec = false;
};

class HelloSora : public std::enable_shared_from_this<HelloSora>,
Expand Down
Loading