Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
melpon committed Nov 14, 2024
1 parent d0192f5 commit 4d99f91
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 3 deletions.
13 changes: 13 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,19 @@
"externalConsole": false,
"MIMode": "lldb"
},
{
"name": "Ubuntu 24.04 デバッグビルドのデバッグ",
"type": "lldb-dap",
"request": "launch",
"program": "${workspaceFolder}/_build/ubuntu-24.04_x86_64/debug/test/hello",
"args": ["${workspaceFolder}/test/.testparam.json"],
"cwd": "${fileDirname}",
"sourceMap": [["../../../../_source/ubuntu-24.04_x86_64/webrtc/src/", "/home/melpon/dev/webrtc-build-simulcast-multicodec/_source/ubuntu-24.04_x86_64/webrtc/src/"]],
"initCommands": [
"settings append target.debug-file-search-paths /home/melpon/dev/webrtc-build-simulcast-multicodec/_build/ubuntu-24.04_x86_64/debug/webrtc/"
],
"runInTerminal": true,
},

]
}
14 changes: 13 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"allowTrailingCommas": true,
}
}],
"lldb-dap.executable-path": "/usr/bin/lldb-dap-18",
"files.associations": {
"*.cs": "csharp",
"CMakeLists.txt": "cmake",
Expand Down Expand Up @@ -145,6 +146,17 @@
"__threading_support": "cpp",
"__verbose_abort": "cpp",
"string_view": "cpp",
"*.tcc": "cpp"
"*.tcc": "cpp",
"__assertion_handler": "cpp",
"cuchar": "cpp",
"propagate_const": "cpp",
"print": "cpp",
"expected": "cpp",
"netfwd": "cpp",
"rope": "cpp",
"slist": "cpp",
"spanstream": "cpp",
"stacktrace": "cpp",
"stdfloat": "cpp"
}
}
38 changes: 36 additions & 2 deletions src/sora_signaling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
#include <rtc_base/crypt_string_revive.h>
#include <rtc_base/proxy_info_revive.h>

// Boost
#include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp>

#include "sora/data_channel.h"
#include "sora/rtc_ssl_verifier.h"
#include "sora/rtc_stats.h"
Expand Down Expand Up @@ -394,7 +398,8 @@ void SoraSignaling::DoSendConnect(bool redirect) {
m["data_channels"] = ar;
}

auto forwarding_filter_to_json = [](const SoraSignalingConfig::ForwardingFilter& f) -> boost::json::value {
auto forwarding_filter_to_json =
[](const SoraSignalingConfig::ForwardingFilter& f) -> boost::json::value {
boost::json::object obj;
if (f.name) {
obj["name"] = *f.name;
Expand Down Expand Up @@ -430,7 +435,8 @@ void SoraSignaling::DoSendConnect(bool redirect) {
};

if (config_.forwarding_filter) {
m["forwarding_filter"] = forwarding_filter_to_json(*config_.forwarding_filter);
m["forwarding_filter"] =
forwarding_filter_to_json(*config_.forwarding_filter);
}

if (config_.forwarding_filters) {
Expand Down Expand Up @@ -934,6 +940,7 @@ void SoraSignaling::OnRead(boost::system::error_code ec,
SoraSignalingDirection::RECEIVED, text);

const std::string sdp = m.at("sdp").as_string().c_str();
RTC_LOG(LS_ERROR) << "received sdp: " << sdp;

std::string video_mid;
std::string audio_mid;
Expand Down Expand Up @@ -1054,6 +1061,32 @@ void SoraSignaling::OnRead(boost::system::error_code ec,
params.scalability_mode =
p["scalabilityMode"].as_string().c_str();
}
if (p.count("codec") != 0) {
const auto& c = p["codec"].as_object();
// video/VP8 のような形式で、video は確定なので後ろのコーデック部分だけ見る
std::string mime_type = c.at("mimeType").as_string().c_str();
auto& codec = params.codec.emplace();
codec.kind = cricket::MEDIA_TYPE_VIDEO;
codec.name = mime_type.substr(mime_type.find('/') + 1);
if (c.count("clockRate") != 0) {
codec.clock_rate = c.at("clockRate").to_number<int>();
}
if (c.count("sdpFmtpLine") != 0) {
// sdpFmtpLine は
// level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e02a
// のような文字列になってるはず
std::vector<std::string> xs;
boost::algorithm::split(
xs, c.at("sdpFmtpLine").as_string().c_str(),
boost::algorithm::is_any_of(";"));
for (const auto& x : xs) {
std::vector<std::string> kv;
boost::algorithm::split(kv, x,
boost::algorithm::is_any_of("="));
codec.parameters[kv[0]] = kv[1];
}
}
}
encoding_parameters.push_back(params);
}

Expand All @@ -1073,6 +1106,7 @@ void SoraSignaling::OnRead(boost::system::error_code ec,
}

boost::json::value m = {{"type", "answer"}, {"sdp", sdp}};
RTC_LOG(LS_ERROR) << sdp;
self->WsWriteSignaling(
boost::json::serialize(m),
[self](boost::system::error_code, size_t) {});
Expand Down

0 comments on commit 4d99f91

Please sign in to comment.