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

data_channels 項目に header 項目を追加 #104

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open
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 @@ -17,6 +17,8 @@
- @torikizi
- [ADD] `Sora.Config` に `ClientCert`, `ClientKey`, `CACert` を追加
- @melpon
- [ADD] DataChannels に `Header` を追加
- @torikizi

### misc

Expand Down
5 changes: 5 additions & 0 deletions Sora/Sora.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class DataChannel
public int? MaxRetransmits;
public string? Protocol;
public bool? Compress;
public string? Header;
}

public const string ActionBlock = "block";
Expand Down Expand Up @@ -453,6 +454,10 @@ public void Connect(Config config)
{
c.SetCompress(m.Compress.Value);
}
if (m.Header != null)
{
c.SetHeader(m.Header);
}
cc.data_channels.Add(c);
}
cc.proxy_url = config.ProxyUrl;
Expand Down
1 change: 1 addition & 0 deletions proto/sora_conf_internal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ message DataChannel {
optional int32 max_retransmits = 8;
optional string protocol = 10;
optional bool compress = 12;
optional string header = 14;
}

message ForwardingFilter {
Expand Down
7 changes: 7 additions & 0 deletions src/sora.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,13 @@ void Sora::DoConnect(const sora_conf::internal::ConnectConfig& cc,
if (dc.has_compress()) {
d.compress = dc.compress;
}
if (dc.has_header()) {
boost::json::value parsed_value = boost::json::parse(dc.header);
if (parsed_value.is_array()) {
const auto& ar = parsed_value.as_array();
d.header.emplace(ar.begin(), ar.end());
}
}
config.data_channels.push_back(std::move(d));
}
if (!cc.metadata.empty()) {
Expand Down