Skip to content

Commit

Permalink
on_signaling を追加します
Browse files Browse the repository at this point in the history
  • Loading branch information
tnoho committed Sep 9, 2024
1 parent 9f8b239 commit 718a23b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/sora_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,12 @@ void SoraConnection::OnSwitched(std::string text) {
}
}

void SoraConnection::OnSignaling(std::string text) {
if (on_signaling_) {
on_signaling_(text);
}
}

void SoraConnection::OnTrack(
rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver) {
if (on_track_) {
Expand Down
2 changes: 2 additions & 0 deletions src/sora_connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,15 @@ class SoraConnection : public sora::SoraSignalingObserver,
void OnPush(std::string text) override;
void OnMessage(std::string label, std::string data) override;
void OnSwitched(std::string text) override;
void OnSignaling(std::string text) override;
void OnTrack(
rtc::scoped_refptr<webrtc::RtpTransceiverInterface> transceiver) override;
void OnRemoveTrack(
rtc::scoped_refptr<webrtc::RtpReceiverInterface> receiver) override;
void OnDataChannel(std::string label) override;

// sora::SoraSignalingObserver のコールバック関数が呼び出された時に対応して呼び出す Python の関数を保持する
std::function<void(std::string)> on_signaling_;
std::function<void(std::string)> on_set_offer_;
std::function<void(sora::SoraSignalingErrorCode, std::string)> on_disconnect_;
std::function<void(std::string)> on_notify_;
Expand Down
1 change: 1 addition & 0 deletions src/sora_sdk_ext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ NB_MODULE(sora_sdk_ext, m) {
.def("get_stats", &SoraConnection::GetStats)
.def_rw("on_set_offer", &SoraConnection::on_set_offer_)
.def_rw("on_disconnect", &SoraConnection::on_disconnect_)
.def_rw("on_signaling", &SoraConnection::on_signaling_)
.def_rw("on_notify", &SoraConnection::on_notify_)
.def_rw("on_push", &SoraConnection::on_push_)
.def_rw("on_message", &SoraConnection::on_message_)
Expand Down

0 comments on commit 718a23b

Please sign in to comment.