Skip to content

Commit

Permalink
Merge branch 'release/2021.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
voluntas committed Sep 21, 2021
2 parents 5e3f75d + abaef1a commit 591735f
Show file tree
Hide file tree
Showing 9 changed files with 35 additions and 15 deletions.
8 changes: 8 additions & 0 deletions CHANGES.md
Expand Up @@ -11,6 +11,14 @@

## develop

## 2021.4.2

- [FIX] SetParameters() するタイミングを SetLocalDescription() の処理後に変更する事で Priority が動作するようにする
- @tsuyoshiii
- [FIX] Priority から DegradationPreference への変換を実動作に合わせる
- [UPDATE] cmake を 3.21.3 に上げる
- @voluntas

## 2021.4.1

- [FIX] Windows 版リリース時の Invoke-WebRequest を curl に擬態する
Expand Down
4 changes: 2 additions & 2 deletions VERSION
@@ -1,7 +1,7 @@
MOMO_VERSION=2021.4.1
MOMO_VERSION=2021.4.2
WEBRTC_BUILD_VERSION=92.4515.9.2
BOOST_VERSION=1.77.0
CLI11_VERSION=2.0.0
SDL2_VERSION=2.0.14
CMAKE_VERSION=3.21.2
CMAKE_VERSION=3.21.3
CUDA_VERSION=11.0.2-1
6 changes: 5 additions & 1 deletion doc/FAQ.md
Expand Up @@ -94,6 +94,10 @@ NVENC が利用可能なビデオカードは以下で確認してください

利用できません。60fps を使ってみたい場合は Jetson Nano などをご利用ください。

## Sora モードで DataChannel メッセージングは利用できますか?

Momo では Sora の DataChannel メッセージングに対応する予定はありません。 Sora C++ SDK にて対応予定です。

## Raspberry Pi (Raspberry-Pi-OS) で `--hw-mjpeg-decoder true` を指定した時に映像が出ません

RaspberryPi の MJPEG デコーダ は一部の MJPEG に対応したカメラでしか機能しません。
Expand All @@ -106,4 +110,4 @@ Mac (arm64) から FHD でスクリーンキャプチャを配信したい場合

設定方法はこちらの [Sora のドキュメント](https://sora-doc.shiguredo.jp/sora_conf#default-h264-profile-level-id)をお読みください。

プロファイルレベル ID を変更しない場合は H.264 の HD 以下で配信するか、他のコーデックを使用して FHD 配信をしてください。
プロファイルレベル ID を変更しない場合は H.264 の HD 以下で配信するか、他のコーデックを使用して FHD 配信をしてください。
2 changes: 2 additions & 0 deletions src/ayame/ayame_client.cpp
Expand Up @@ -236,6 +236,7 @@ void AyameClient::OnRead(boost::system::error_code ec,
auto on_create_offer = [this](webrtc::SessionDescriptionInterface* desc) {
std::string sdp;
desc->ToString(&sdp);
manager_->SetParameters();
boost::json::value json_message = {{"type", "offer"}, {"sdp", sdp}};
ws_->WriteText(boost::json::serialize(json_message));
};
Expand All @@ -262,6 +263,7 @@ void AyameClient::OnRead(boost::system::error_code ec,
[this](webrtc::SessionDescriptionInterface* desc) {
std::string sdp;
desc->ToString(&sdp);
manager_->SetParameters();
boost::json::value json_message = {{"type", "answer"},
{"sdp", sdp}};
ws_->WriteText(boost::json::serialize(json_message));
Expand Down
2 changes: 1 addition & 1 deletion src/momo_args.h
Expand Up @@ -27,7 +27,7 @@ struct MomoArgs {
std::string resolution = "VGA";
int framerate = 30;
bool fixed_resolution = false;
std::string priority = "BALANCE";
std::string priority = "FRAMERATE";
bool use_sdl = false;
bool show_me = false;
int window_width = 640;
Expand Down
14 changes: 9 additions & 5 deletions src/rtc/rtc_manager.cpp
Expand Up @@ -236,13 +236,17 @@ void RTCManager::InitTracks(RTCConnection* conn) {
webrtc::RTCErrorOr<rtc::scoped_refptr<webrtc::RtpSenderInterface>>
video_add_result = connection->AddTrack(video_track_, {stream_id});
if (video_add_result.ok()) {
rtc::scoped_refptr<webrtc::RtpSenderInterface> video_sender =
video_add_result.value();
webrtc::RtpParameters parameters = video_sender->GetParameters();
parameters.degradation_preference = config_.GetPriority();
video_sender->SetParameters(parameters);
video_sender_ = video_add_result.value();
} else {
RTC_LOG(LS_WARNING) << __FUNCTION__ << ": Cannot add video_track_";
}
}
}

void RTCManager::SetParameters() {
if (!video_sender_) { return; }

webrtc::RtpParameters parameters = video_sender_->GetParameters();
parameters.degradation_preference = config_.GetPriority();
video_sender_->SetParameters(parameters);
}
9 changes: 5 additions & 4 deletions src/rtc/rtc_manager.h
Expand Up @@ -39,14 +39,13 @@ struct RTCManagerConfig {
VideoCodecInfo::Type h264_encoder = VideoCodecInfo::Type::Default;
VideoCodecInfo::Type h264_decoder = VideoCodecInfo::Type::Default;

std::string priority = "BALANCE";
std::string priority = "FRAMERATE";

// FRAMERATE が優先のときは RESOLUTION をデグレさせていく
webrtc::DegradationPreference GetPriority() {
if (priority == "FRAMERATE") {
return webrtc::DegradationPreference::MAINTAIN_RESOLUTION;
} else if (priority == "RESOLUTION") {
return webrtc::DegradationPreference::MAINTAIN_FRAMERATE;
} else if (priority == "RESOLUTION") {
return webrtc::DegradationPreference::MAINTAIN_RESOLUTION;
}
return webrtc::DegradationPreference::BALANCED;
}
Expand All @@ -63,11 +62,13 @@ class RTCManager {
webrtc::PeerConnectionInterface::RTCConfiguration rtc_config,
RTCMessageSender* sender);
void InitTracks(RTCConnection* conn);
void SetParameters();

private:
rtc::scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory_;
rtc::scoped_refptr<webrtc::AudioTrackInterface> audio_track_;
rtc::scoped_refptr<webrtc::VideoTrackInterface> video_track_;
rtc::scoped_refptr<webrtc::RtpSenderInterface> video_sender_;
std::unique_ptr<rtc::Thread> network_thread_;
std::unique_ptr<rtc::Thread> worker_thread_;
std::unique_ptr<rtc::Thread> signaling_thread_;
Expand Down
3 changes: 2 additions & 1 deletion src/sora/sora_client.cpp
Expand Up @@ -409,7 +409,7 @@ void SoraClient::OnRead(boost::system::error_code ec,
[self](webrtc::SessionDescriptionInterface* desc) {
std::string sdp;
desc->ToString(&sdp);

self->manager_->SetParameters();
boost::asio::post(self->ioc_, [self, sdp]() {
if (!self->connection_) {
return;
Expand Down Expand Up @@ -443,6 +443,7 @@ void SoraClient::OnRead(boost::system::error_code ec,
[self, answer_type](webrtc::SessionDescriptionInterface* desc) {
std::string sdp;
desc->ToString(&sdp);
self->manager_->SetParameters();
boost::asio::post(self->ioc_, [self, sdp, answer_type]() {
if (!self->connection_) {
return;
Expand Down
2 changes: 1 addition & 1 deletion src/util.cpp
Expand Up @@ -149,7 +149,7 @@ void Util::ParseArgs(int argc,
app.add_flag("--fixed-resolution", args.fixed_resolution,
"Maintain video resolution in degradation");
app.add_option("--priority", args.priority,
"Preference in video degradation (experimental)")
"Specifies the quality that is maintained against video degradation")
->check(CLI::IsMember({"BALANCE", "FRAMERATE", "RESOLUTION"}));
app.add_flag("--use-sdl", args.use_sdl,
"Show video using SDL (if SDL is available)")
Expand Down

0 comments on commit 591735f

Please sign in to comment.