Skip to content

Commit

Permalink
Merge pull request #51 from shiguredo/feature/add-new-entry-forwardin…
Browse files Browse the repository at this point in the history
…g-filter

Forwarding Filter に version と metadata を追加する
  • Loading branch information
torikizi authored Jan 15, 2024
2 parents 2b822e3 + d1e778b commit 92fe5ee
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@
- JetPack 5.1.1, 5.1.2 で動作を確認
- JetPack 5.1 では、互換性の問題で JetsonJpegDecoder がエラーになることを確認
- @enm10k
- [ADD] Forwarding Filter の項目に Version と Metadata を追加
- Version と Metadata はオプション項目として追加し、値がない場合は項目を設定しない
- @torikizi
- [FIX] DataChannel シグナリングが有効な場合、一部のシグナリングメッセージのコールバックが上がらないことがあるのを修正
- @melpon
- [FIX] Forwarding Filter の Action 項目は本来オプション項目だったが、 action は `std::optional` 型になっていなかったため修正
- @torikizi

## 2023.17.0 (2023-12-25)

Expand Down
4 changes: 3 additions & 1 deletion include/sora/sora_signaling.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,15 @@ struct SoraSignalingConfig {
std::vector<DataChannel> data_channels;

struct ForwardingFilter {
std::string action;
boost::optional<std::string> action;
struct Rule {
std::string field;
std::string op;
std::vector<std::string> values;
};
std::vector<std::vector<Rule>> rules;
boost::optional<std::string> version;
boost::optional<boost::json::value> metadata;
};
boost::optional<ForwardingFilter> forwarding_filter;

Expand Down
10 changes: 9 additions & 1 deletion src/sora_signaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,9 @@ void SoraSignaling::DoSendConnect(bool redirect) {
if (config_.forwarding_filter) {
boost::json::object obj;
auto& f = *config_.forwarding_filter;
obj["action"] = f.action;
if (f.action) {
obj["action"] = *f.action;
}
obj["rules"] = boost::json::array();
for (const auto& rules : f.rules) {
boost::json::array ar;
Expand All @@ -464,6 +466,12 @@ void SoraSignaling::DoSendConnect(bool redirect) {
}
obj["rules"].as_array().push_back(ar);
}
if (f.version) {
obj["version"] = *f.version;
}
if (f.metadata) {
obj["metadata"] = *f.metadata;
}
m["forwarding_filter"] = obj;
}

Expand Down

0 comments on commit 92fe5ee

Please sign in to comment.