Skip to content

Commit

Permalink
Merge pull request #63 from shiguredo/feature/on-switched
Browse files Browse the repository at this point in the history
SoraSignalingObserver に OnSwitched を追加する
  • Loading branch information
enm10k authored Feb 19, 2024
2 parents 88ba0dd + 322f545 commit 764b3d5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
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));
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

0 comments on commit 764b3d5

Please sign in to comment.