mirror of
https://github.com/kunkundi/crossdesk-server.git
synced 2026-05-26 08:10:07 +08:00
[feat] support libdatachannel trickle ICE
This commit is contained in:
@@ -103,7 +103,7 @@ bool SignalNegotiation::leave_transmission(websocketpp::connection_hdl hdl,
|
||||
}
|
||||
}
|
||||
|
||||
transmission_manager_->ReleaseUserFromWsHandle(hdl);
|
||||
// transmission_manager_->ReleaseUserFromWsHandle(hdl);
|
||||
|
||||
bool is_host =
|
||||
transmission_manager_->IsHostOfTransmission(user_id, transmission_id);
|
||||
@@ -295,3 +295,25 @@ bool SignalNegotiation::new_candidate(websocketpp::connection_hdl hdl,
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SignalNegotiation::new_candidate_mid(websocketpp::connection_hdl hdl,
|
||||
const json& j) {
|
||||
std::string transmission_id = j["transmission_id"].get<std::string>();
|
||||
std::string user_id = j["user_id"].get<std::string>();
|
||||
std::string remote_user_id = j["remote_user_id"].get<std::string>();
|
||||
std::string candidate = j["candidate"].get<std::string>();
|
||||
std::string mid = j["mid"].get<std::string>();
|
||||
|
||||
websocketpp::connection_hdl destination_hdl =
|
||||
transmission_manager_->GetWsHandle(remote_user_id);
|
||||
|
||||
// LOG_INFO("send candidate [{}]", candidate.c_str());
|
||||
json message = {{"type", "new_candidate_mid"},
|
||||
{"remote_user_id", user_id},
|
||||
{"transmission_id", transmission_id},
|
||||
{"candidate", candidate},
|
||||
{"mid", mid}};
|
||||
send_msg_(destination_hdl, message);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@ class SignalNegotiation {
|
||||
bool login_user(websocketpp::connection_hdl hdl, const json& j);
|
||||
bool leave_transmission(websocketpp::connection_hdl hdl, const json& j);
|
||||
bool query_user_id_list(websocketpp::connection_hdl hdl, const json& j);
|
||||
bool join_transmission(websocketpp::connection_hdl hdl,
|
||||
const json& j);
|
||||
bool join_transmission(websocketpp::connection_hdl hdl, const json& j);
|
||||
bool offer(websocketpp::connection_hdl hdl, const json& j);
|
||||
bool answer(websocketpp::connection_hdl hdl, const json& j);
|
||||
bool new_candidate(websocketpp::connection_hdl hdl, const json& j);
|
||||
bool new_candidate_mid(websocketpp::connection_hdl hdl, const json& j);
|
||||
|
||||
private:
|
||||
std::shared_ptr<TransmissionManager> transmission_manager_;
|
||||
|
||||
@@ -154,7 +154,7 @@ void SignalServer::SendMsg(websocketpp::connection_hdl hdl, json message) {
|
||||
if (!hdl.expired()) {
|
||||
server_.send(hdl, message.dump(), websocketpp::frame::opcode::text);
|
||||
} else {
|
||||
LOG_ERROR("Destination hdl invalid");
|
||||
LOG_ERROR("Destination hdl invalid, msg: {}", message.dump());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,6 +194,8 @@ void SignalServer::OnMessage(websocketpp::connection_hdl hdl,
|
||||
case "new_candidate"_H:
|
||||
signal_negotiation_->new_candidate(hdl, j);
|
||||
break;
|
||||
case "new_candidate_mid"_H:
|
||||
signal_negotiation_->new_candidate_mid(hdl, j);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user