diff --git a/src/transmission/ice_transmission.cpp b/src/transmission/ice_transmission.cpp index f4bea8c..0b1548d 100644 --- a/src/transmission/ice_transmission.cpp +++ b/src/transmission/ice_transmission.cpp @@ -174,33 +174,35 @@ int IceTransmission::InitIceTransmission( IceTransmission *ice_transmission_obj = static_cast(user_ptr); - GSList *cands = - nice_agent_get_local_candidates(agent, stream_id, component_id); - NiceCandidate *cand; - for (GSList *i = cands; i; i = i->next) { - cand = (NiceCandidate *)i->data; - if (g_strcmp0(cand->foundation, foundation) == 0) { - ice_transmission_obj->new_local_candidate_ = - nice_agent_generate_local_candidate_sdp(agent, cand); + if (ice_transmission_obj->trickle_ice_) { + GSList *cands = + nice_agent_get_local_candidates(agent, stream_id, component_id); + NiceCandidate *cand; + for (GSList *i = cands; i; i = i->next) { + cand = (NiceCandidate *)i->data; + if (g_strcmp0(cand->foundation, foundation) == 0) { + ice_transmission_obj->new_local_candidate_ = + nice_agent_generate_local_candidate_sdp(agent, cand); - json message = { - {"type", "new_candidate"}, - {"transmission_id", ice_transmission_obj->transmission_id_}, - {"user_id", ice_transmission_obj->user_id_}, - {"remote_user_id", ice_transmission_obj->remote_user_id_}, - {"sdp", ice_transmission_obj->new_local_candidate_}}; - // LOG_INFO("[{}] Send new candidate to [{}]]:[{}]", - // ice_transmission_obj->user_id_, - // ice_transmission_obj->remote_user_id_, - // ice_transmission_obj->new_local_candidate_); + json message = { + {"type", "new_candidate"}, + {"transmission_id", ice_transmission_obj->transmission_id_}, + {"user_id", ice_transmission_obj->user_id_}, + {"remote_user_id", ice_transmission_obj->remote_user_id_}, + {"sdp", ice_transmission_obj->new_local_candidate_}}; + // LOG_INFO("[{}] Send new candidate to [{}]]:[{}]", + // ice_transmission_obj->user_id_, + // ice_transmission_obj->remote_user_id_, + // ice_transmission_obj->new_local_candidate_); - if (ice_transmission_obj->ice_ws_transport_) { - ice_transmission_obj->ice_ws_transport_->Send(message.dump()); + if (ice_transmission_obj->ice_ws_transport_) { + ice_transmission_obj->ice_ws_transport_->Send(message.dump()); + } } } - } - g_slist_free_full(cands, (GDestroyNotify)nice_candidate_free); + g_slist_free_full(cands, (GDestroyNotify)nice_candidate_free); + } } }, [](NiceAgent *agent, guint stream_id, gpointer user_ptr) { diff --git a/thirdparty/dav1d/xmake.lua b/thirdparty/dav1d/xmake.lua new file mode 100644 index 0000000..0e6b1a1 --- /dev/null +++ b/thirdparty/dav1d/xmake.lua @@ -0,0 +1,43 @@ +package("dav1d") + set_homepage("https://www.videolan.org/projects/dav1d.html") + set_description("dav1d is a new AV1 cross-platform decoder, open-source, and focused on speed, size and correctness.") + set_license("BSD-2-Clause") + + add_urls("https://code.videolan.org/videolan/dav1d.git") + + add_versions("1.4.3", "42fe524bcc82ea3a830057178faace22923a79bad3d819a4962d8cfc54c36f19") + add_versions("1.1.0", "fb57aae7875f28c30fb3dbae4a3683d27e2f91dde09ce5c60c22cef9bc58dfd1") + add_versions("0.9.0", "cfae88e8067c9b2e5b96d95a7a00155c353376fe9b992a96b4336e0eab19f9f6") + + add_configs("tools", {description = "Build tools", default = false, type = "boolean"}) + + add_deps("nasm", "meson", "ninja") + if is_plat("linux", "bsd") then + add_syslinks("pthread", "dl") + end + + on_install("!android and !wasm", function (package) + import("package.tools.meson") + + local configs = {"-Denable_tests=false"} + table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static")) + table.insert(configs, "-Denable_tools=" .. (package:config("tools") and "true" or "false")) + if package:config("tools") then + package:addenv("PATH", "bin") + end + + local opt = {} + opt.envs = meson.buildenvs(package) + -- add gas-preprocessor to PATH + if package:is_plat("windows") and package:is_arch("arm.*") then + opt.envs.PATH = path.join(os.programdir(), "scripts") .. path.envsep() .. opt.envs.PATH + end + meson.install(package, configs, opt) + end) + + on_test(function (package) + if package:config("tools") and (not package:is_cross()) then + os.vrun("dav1d -v") + end + assert(package:has_cfuncs("dav1d_default_settings", {includes = "dav1d/dav1d.h"})) + end) \ No newline at end of file diff --git a/thirdparty/xmake.lua b/thirdparty/xmake.lua index dff1507..8ecf4cc 100644 --- a/thirdparty/xmake.lua +++ b/thirdparty/xmake.lua @@ -1 +1 @@ -includes("openfec", "libyuv", "aom", "openh264") \ No newline at end of file +includes("openfec", "libyuv", "aom", "openh264", "dav1d") \ No newline at end of file diff --git a/xmake.lua b/xmake.lua index fb46227..1dbabec 100644 --- a/xmake.lua +++ b/xmake.lua @@ -12,7 +12,7 @@ add_defines("ASIO_STANDALONE", "ASIO_HAS_STD_TYPE_TRAITS", "ASIO_HAS_STD_SHARED_ "ASIO_HAS_STD_ADDRESSOF", "ASIO_HAS_STD_ATOMIC", "ASIO_HAS_STD_CHRONO", "ASIO_HAS_CSTDINT", "ASIO_HAS_STD_ARRAY", "ASIO_HAS_STD_SYSTEM_ERROR") -add_requires("asio 1.24.0", "nlohmann_json 3.11.3", "spdlog 1.14.1", "openfec 1.4.2", "libopus 1.5.1", "openh264 2.4.1", "dav1d 1.1.0", "libyuv 2024.5.21", "aom 3.9.0", {system = false}, {configs = {shared = false}}) +add_requires("asio 1.24.0", "nlohmann_json 3.11.3", "spdlog 1.14.1", "openfec 1.4.2", "libopus 1.5.1", "openh264 2.4.1", "dav1d 1.4.3", "libyuv 2024.5.21", "aom 3.9.0", {system = false}, {configs = {shared = false}}) add_packages("asio", "nlohmann_json", "spdlog", "openfec", "libopus", "openh264", "dav1d", "libyuv", "aom") add_requires("vcpkg::libnice", {configs = {shared = false}})