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

SoraSignalingObserver に OnSwitched を追加する #63

Merged
merged 6 commits into from
Feb 19, 2024
Merged
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
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
- force_i420_conversion_for_simulcast_adapter のデフォルト値は true で I420 への変換を行う
- 変換を行わない場合、エンコードの性能が向上するが、バッファーの実装によってはサイマルキャストが利用できなくなる
- @enm10k
- [ADD] SoraSignalingObserver に OnSwitched を追加する
- @enm10k
- [FIX] Jetson Orin で AV1 を送信中、他のユーザーが後から接続して受信した時に映像が出ない問題を修正
- @melpon

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 @@ -48,6 +48,7 @@ class SoraSignalingObserver {
virtual void OnNotify(std::string text) = 0;
virtual void OnPush(std::string text) = 0;
virtual void OnMessage(std::string label, std::string data) = 0;
virtual void OnSwitched(std::string text) {}

virtual void OnTrack(
rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver) = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/sora_signaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1172,6 +1172,10 @@ void SoraSignaling::OnRead(boost::system::error_code ec,
// Data Channel による通信の開始
using_datachannel_ = true;

auto ob = config_.observer.lock();
if (ob) {
ob->OnSwitched(std::move(text));
}

// ignore_disconnect_websocket == true の場合は WS を切断する
auto it = m.as_object().find("ignore_disconnect_websocket");
Expand Down
5 changes: 4 additions & 1 deletion test/datachannel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class SoraClient : public std::enable_shared_from_this<SoraClient>,
[this](const boost::system::error_code&, int) { conn_->Disconnect(); });

timer_.reset(new boost::asio::deadline_timer(*ioc_));
timer_->expires_from_now(boost::posix_time::seconds(1));
timer_->expires_from_now(boost::posix_time::seconds(3));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@melpon 私が利用した環境では動作が安定しなかったため、秒数を伸ばしました

timer_->async_wait([this, labels](boost::system::error_code ec) {
if (ec) {
return;
Expand Down Expand Up @@ -100,6 +100,9 @@ class SoraClient : public std::enable_shared_from_this<SoraClient>,
void OnNotify(std::string text) override {}
void OnPush(std::string text) override {}
void OnMessage(std::string label, std::string data) override {}
void OnSwitched(std::string text) override {
RTC_LOG(LS_INFO) << "OnSwitched: " << text;
}

void OnTrack(rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver)
override {}
Expand Down
Loading