Skip to content

Commit

Permalink
header を配列として定義する
Browse files Browse the repository at this point in the history
  • Loading branch information
torikizi committed Dec 27, 2024
1 parent 8bca104 commit fda2904
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
6 changes: 5 additions & 1 deletion proto/sora_conf_internal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ syntax = "proto3";

package sora_conf.internal;

message Header {
repeated string content = 1;
}

message DataChannel {
string label = 1;
string direction = 2;
Expand All @@ -10,7 +14,7 @@ message DataChannel {
optional int32 max_retransmits = 8;
optional string protocol = 10;
optional bool compress = 12;
optional string header = 14;
optional Header header = 14;
}

message ForwardingFilter {
Expand Down
8 changes: 3 additions & 5 deletions src/sora.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,11 +420,9 @@ void Sora::DoConnect(const sora_conf::internal::ConnectConfig& cc,
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());
}
const auto& header_content = dc.header.content;
d.header->insert(d.header->end(), header_content.begin(),
header_content.end());
}
config.data_channels.push_back(std::move(d));
}
Expand Down

0 comments on commit fda2904

Please sign in to comment.