From 2f78ce9ff846bb90d06ef1e55012a11509d4bff1 Mon Sep 17 00:00:00 2001 From: melpon Date: Thu, 24 Oct 2024 12:36:31 +0900 Subject: [PATCH] =?UTF-8?q?DataChannel=20=E3=81=AB=20header=20=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 2 ++ include/sora/sora_signaling.h | 1 + src/sora_signaling.cpp | 3 +++ test/.testparam.example.json | 3 +++ test/hello.cpp | 3 +++ 5 files changed, 12 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index 29404050..cc704210 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -46,6 +46,8 @@ - @melpon - [ADD] SoraSignalingConfig に audio_opus_params を追加 - @melpon +- [ADD] SoraSignalingConfig::DataChennel に header を追加 + - @melpon - [FIX] HTTP Proxy 利用時の Websocket 初期化で insecure_ メンバ変数が初期化されていなかったのを修正 - @melpon - [FIX] SoraSignalingConfig の client_cert と client_key に渡す必要がある値を、ファイルパスからファイルの内容に修正 diff --git a/include/sora/sora_signaling.h b/include/sora/sora_signaling.h index 5ed3ee77..f9c8fc10 100644 --- a/include/sora/sora_signaling.h +++ b/include/sora/sora_signaling.h @@ -119,6 +119,7 @@ struct SoraSignalingConfig { boost::optional max_retransmits; boost::optional protocol; boost::optional compress; + boost::optional> header; }; std::vector data_channels; diff --git a/src/sora_signaling.cpp b/src/sora_signaling.cpp index 63d08013..dbae794b 100644 --- a/src/sora_signaling.cpp +++ b/src/sora_signaling.cpp @@ -382,6 +382,9 @@ void SoraSignaling::DoSendConnect(bool redirect) { if (d.compress) { obj["compress"] = *d.compress; } + if (d.header) { + obj["header"] = boost::json::array(d.header->begin(), d.header->end()); + } ar.push_back(obj); } m["data_channels"] = ar; diff --git a/test/.testparam.example.json b/test/.testparam.example.json index 1351b057..f7f3fdd3 100644 --- a/test/.testparam.example.json +++ b/test/.testparam.example.json @@ -41,6 +41,9 @@ // "max_retransmits": null, // "protocol": null, // "compress": null, + // "header": [ + // {"type": "sender_connection_id"}, + // ], // } // ], "data_channels": null, diff --git a/test/hello.cpp b/test/hello.cpp index c1aff2cd..3959b154 100644 --- a/test/hello.cpp +++ b/test/hello.cpp @@ -211,6 +211,9 @@ int main(int argc, char* argv[]) { if (get(dc, "compress", x)) { data_channel.compress = x.as_bool(); } + if (get(dc, "header", x)) { + data_channel.header.emplace(x.as_array().begin(), x.as_array().end()); + } config.data_channels.push_back(data_channel); } }