Skip to content

Commit

Permalink
Merge pull request #23 from shiguredo/feature/fix-data-channel-bytes-…
Browse files Browse the repository at this point in the history
…handling

0 を途中で含むデータを送受信すると途中で途切れる問題を修正する
  • Loading branch information
sile committed Jun 16, 2023
2 parents 6c4fe75 + 9941c1d commit e9f21e6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

## develop

- [FIX] 0 を途中で含むデータを送受信すると途中で途切れる問題を修正
- @sile
- [ADD] libwebrtc のログを有効にするための `enable_libwebrtc_log()` 関数を追加する
- `sora_sdk.enable_libwebrtc_log(sora_sdk.SoraLoggingSeverity.INFO)` といった感じで使用する
- ログレベル (severity) は libwebrtc 準拠で `VERBOSE`, `INFO`, `WARNIGN`, `ERROR`, `NONE` の五段階
Expand Down
4 changes: 2 additions & 2 deletions src/sora_connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ void SoraConnection::SetVideoTrack(SoraTrackInterface* video_source) {

bool SoraConnection::SendDataChannel(const std::string& label,
nb::bytes& data) {
return conn_->SendDataChannel(label, std::string(data.c_str()));
return conn_->SendDataChannel(label, std::string(data.c_str(), data.size()));
}

void SoraConnection::OnSetOffer(std::string offer) {
Expand Down Expand Up @@ -154,7 +154,7 @@ void SoraConnection::OnPush(std::string text) {

void SoraConnection::OnMessage(std::string label, std::string data) {
if (on_message_) {
on_message_(label, nb::bytes(data.c_str()));
on_message_(label, nb::bytes(data.c_str(), data.size()));
}
}

Expand Down

0 comments on commit e9f21e6

Please sign in to comment.