Skip to content

Commit

Permalink
設定方法を見直す
Browse files Browse the repository at this point in the history
  • Loading branch information
torikizi committed Dec 28, 2024
1 parent 457a557 commit 4db3bc5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 7 additions & 3 deletions Sora/Sora.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ public enum SpotlightFocusRidType
R1,
R2,
}

public class Header
{
public List<string> content { get; set; } = new List<string>();
}
public class DataChannel
{
// 以下は設定必須
Expand All @@ -62,7 +65,8 @@ public class DataChannel
public int? MaxRetransmits;
public string? Protocol;
public bool? Compress;
public string? Header;
public Header? Header;

}

public const string ActionBlock = "block";
Expand Down Expand Up @@ -457,7 +461,7 @@ public void Connect(Config config)
}
if (m.Header != null)
{
c.SetHeader(m.Header);
c.SetHeader(new SoraConf.Internal.Header { content = new List<string>(m.Header.content) });
}
cc.data_channels.Add(c);
}
Expand Down
7 changes: 5 additions & 2 deletions src/sora.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,11 @@ void Sora::DoConnect(const sora_conf::internal::ConnectConfig& cc,
}
if (dc.has_header()) {
const auto& header_content = dc.header.content;
d.header->insert(d.header->end(), header_content.begin(),
header_content.end());
d.header->reserve(header_content.size());
for (const auto& json_str : header_content) {
auto parsed = boost::json::parse(json_str);
d.header->push_back(std::move(parsed));
}
}
config.data_channels.push_back(std::move(d));
}
Expand Down

0 comments on commit 4db3bc5

Please sign in to comment.