diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index cfcc765..016911c 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -36,6 +36,11 @@ jobs: rustup update --no-self-update stable rustup target add ${{ matrix.target }} + - if: ${{ matrix.target == 'aarch64-pc-windows-msvc' }} + run: | + echo "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Tools\Llvm\x64\bin" >> $GITHUB_PATH + shell: bash + - uses: actions/checkout@v3 with: submodules: true diff --git a/.gitmodules b/.gitmodules index ab644fe..f13ae21 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule "livekit/protocol"] - path = livekit/protocol + path = livekit-protocol/protocol url = https://github.com/livekit/protocol diff --git a/Cargo.lock b/Cargo.lock index 60bf3fb..24d3033 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -31,20 +31,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.68" +version = "1.0.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61" - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] +checksum = "7de8ce5e0f9f8d88245311066a578d72b7af3e7088f32783804676302df237e4" [[package]] name = "autocfg" @@ -66,9 +55,9 @@ checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" [[package]] name = "base64ct" -version = "1.5.3" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b645a089122eccb6111b4f81cbc1a49f5900ac4666bb93ac027feaecf15607bf" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bitflags" @@ -78,9 +67,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "block-buffer" -version = "0.10.3" +version = "0.10.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" dependencies = [ "generic-array", ] @@ -99,15 +88,15 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" [[package]] name = "bytes" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" +checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" [[package]] name = "bzip2" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6afcd980b5f3a45017c57e57a2fcccbb351cc43a356ce117ef760ef8052b89b0" +checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" dependencies = [ "bzip2-sys", "libc", @@ -126,9 +115,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.78" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d" +checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" dependencies = [ "jobserver", ] @@ -176,15 +165,15 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5827cebf4670468b8772dd191856768aedcb1b0278a04f989f7766351917b9dc" +checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" [[package]] name = "cpufeatures" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" dependencies = [ "libc", ] @@ -200,9 +189,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "3c063cd8cc95f5c377ed0d4b49a4b21f632396ff690e8470c29b3359b346984b" dependencies = [ "cfg-if", ] @@ -219,9 +208,9 @@ dependencies = [ [[package]] name = "cxx" -version = "1.0.85" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5add3fc1717409d029b20c5b6903fc0c0b02fa6741d820054f4a2efa5e5816fd" +checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" dependencies = [ "cc", "cxxbridge-flags", @@ -231,9 +220,9 @@ dependencies = [ [[package]] name = "cxx-build" -version = "1.0.85" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4c87959ba14bc6fbc61df77c3fcfe180fc32b93538c4f1031dd802ccb5f2ff0" +checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" dependencies = [ "cc", "codespan-reporting", @@ -241,24 +230,24 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn", + "syn 2.0.15", ] [[package]] name = "cxxbridge-flags" -version = "1.0.85" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69a3e162fde4e594ed2b07d0f83c6c67b745e7f28ce58c6df5e6b6bef99dfb59" +checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" [[package]] name = "cxxbridge-macro" -version = "1.0.85" +version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e7e2adeb6a0d4a282e581096b06e1791532b7d576dcde5ccd9382acf55db8e6" +checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] @@ -274,9 +263,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "encoding_rs" @@ -287,19 +276,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "env_logger" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" -dependencies = [ - "atty", - "humantime", - "log", - "regex", - "termcolor", -] - [[package]] name = "env_logger" version = "0.10.0" @@ -315,13 +291,13 @@ dependencies = [ [[package]] name = "errno" -version = "0.2.8" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "winapi", + "windows-sys 0.48.0", ] [[package]] @@ -336,23 +312,23 @@ dependencies = [ [[package]] name = "fastrand" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a407cfaa3385c4ae6b23e84623d48c2798d06e3e6a1878f7f59f17b3f86499" +checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" dependencies = [ "instant", ] [[package]] name = "filetime" -version = "0.2.19" +version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9" +checksum = "5cbc844cecaee9d4443931972e1289c8ff485cb4cc2767cb03ca139ed6885153" dependencies = [ "cfg-if", "libc", - "redox_syscall", - "windows-sys 0.42.0", + "redox_syscall 0.2.16", + "windows-sys 0.48.0", ] [[package]] @@ -403,9 +379,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" dependencies = [ "futures-channel", "futures-core", @@ -418,9 +394,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" +checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" dependencies = [ "futures-core", "futures-sink", @@ -428,15 +404,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" +checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" [[package]] name = "futures-executor" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acc85df6714c176ab5edf386123fafe217be88c0840ec11f199441134a074e2" +checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" dependencies = [ "futures-core", "futures-task", @@ -445,38 +421,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" +checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" [[package]] name = "futures-macro" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "futures-sink" -version = "0.3.26" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" +checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" [[package]] name = "futures-task" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ffb393ac5d9a6eaa9d3fdf37ae2776656b706e200c8e16b1bdb227f5198e6ea" +checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" [[package]] name = "futures-util" -version = "0.3.25" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" +checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" dependencies = [ "futures-channel", "futures-core", @@ -492,9 +468,9 @@ dependencies = [ [[package]] name = "generic-array" -version = "0.14.6" +version = "0.14.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" dependencies = [ "typenum", "version_check", @@ -502,9 +478,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4" dependencies = [ "cfg-if", "libc", @@ -513,15 +489,15 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" [[package]] name = "h2" -version = "0.3.16" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" +checksum = "17f8a914c2987b688368b5138aa05321db91f4090cf26118185672ad588bce21" dependencies = [ "bytes", "fnv", @@ -544,18 +520,9 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "heck" -version = "0.4.0" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" @@ -583,9 +550,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", @@ -623,9 +590,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.25" +version = "0.14.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" +checksum = "ab302d72a6f11a3b910431ff93aae7e773078c769f0a3ef15fb9ec692ed147d4" dependencies = [ "bytes", "futures-channel", @@ -670,9 +637,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "1.9.2" +version = "1.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", "hashbrown", @@ -689,30 +656,31 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.6" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfa919a82ea574332e2de6e74b4c36e74d41982b335080fa59d4ef31be20fdf3" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" dependencies = [ + "hermit-abi 0.3.1", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "ipnet" -version = "2.7.1" +version = "2.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" +checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" [[package]] name = "is-terminal" -version = "0.4.4" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b6b32576413a8e69b90e952e4a026476040d81017b80445deda5f2d3921857" +checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f" dependencies = [ "hermit-abi 0.3.1", "io-lifetimes", "rustix", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -726,15 +694,15 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.5" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" +checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "jobserver" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +checksum = "936cfd212a0155903bcbc060e316fb6cc7cbf2e1907329391ebadc1fe0ce77c2" dependencies = [ "libc", ] @@ -748,6 +716,18 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "jsonwebtoken" +version = "8.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6971da4d9c3aa03c3d8f3ff0f4155b534aad021292003895a469716b2a230378" +dependencies = [ + "base64 0.21.0", + "ring", + "serde", + "serde_json", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -756,9 +736,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.139" +version = "0.2.141" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" +checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" [[package]] name = "link-cplusplus" @@ -771,9 +751,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.1.4" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" +checksum = "3f508063cc7bb32987c71511216bd5a32be15bccb6a80b52df8b9d7f01fc3aa2" [[package]] name = "livekit" @@ -781,12 +761,10 @@ version = "0.1.1" dependencies = [ "futures-util", "lazy_static", - "livekit-utils", + "livekit-protocol", "livekit-webrtc", "parking_lot", "prost", - "prost-build", - "prost-types", "serde", "serde_json", "thiserror", @@ -797,6 +775,21 @@ dependencies = [ "url", ] +[[package]] +name = "livekit-api" +version = "0.1.0" +dependencies = [ + "jsonwebtoken", + "livekit-protocol", + "prost", + "reqwest", + "serde", + "serde_json", + "sha2", + "thiserror", + "url", +] + [[package]] name = "livekit-ffi" version = "0.1.1" @@ -804,6 +797,7 @@ dependencies = [ "futures-util", "lazy_static", "livekit", + "livekit-protocol", "parking_lot", "prost", "prost-build", @@ -813,11 +807,14 @@ dependencies = [ ] [[package]] -name = "livekit-utils" -version = "0.1.1" +name = "livekit-protocol" +version = "0.1.0" dependencies = [ "futures-util", "parking_lot", + "prost", + "prost-build", + "prost-types", "tokio", ] @@ -826,10 +823,10 @@ name = "livekit-webrtc" version = "0.1.1" dependencies = [ "cxx", - "env_logger 0.9.3", + "env_logger", "futures", "js-sys", - "livekit-utils", + "livekit-protocol", "log", "thiserror", "tokio", @@ -866,9 +863,9 @@ checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" [[package]] name = "mime" -version = "0.3.16" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" @@ -881,14 +878,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log", "wasi", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -927,9 +924,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -939,9 +936,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.45" +version = "0.10.50" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b102428fd03bc5edf97f62620f7298614c45cedf287c271e7ed450bbaf83f2e1" +checksum = "7e30d8bc91859781f0a943411186324d580f2bbeb71b452fe91ae344806af3f1" dependencies = [ "bitflags", "cfg-if", @@ -954,13 +951,13 @@ dependencies = [ [[package]] name = "openssl-macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b501e44f11665960c7e7fcf062c7d96a14ade4aa98116c004b2e37b5be7d736c" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] @@ -971,11 +968,10 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.80" +version = "0.9.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23bbbf7854cd45b83958ebe919f0e8e516793727652e27fda10a8384cfc790b7" +checksum = "0d3d193fb1488ad46ffe3aaabc912cc931d02ee8518fe2959aea8ef52718b0c0" dependencies = [ - "autocfg", "cc", "libc", "pkg-config", @@ -994,15 +990,15 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.5" +version = "0.9.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" +checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] @@ -1036,9 +1032,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "petgraph" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5014253a1331579ce62aa67443b4a658c5e7dd03d4bc6d302b94474888143" +checksum = "4dd7d28ee937e54fe3080c91faa1c3a46c06de6252988a7f4592ba2310ef22a4" dependencies = [ "fixedbitset", "indexmap", @@ -1070,28 +1066,28 @@ checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" [[package]] name = "prettyplease" -version = "0.1.22" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c8992a85d8e93a28bdf76137db888d3874e3b230dee5ed8bebac4c9f7617773" +checksum = "6c8646e95016a7a6c4adea95bafa8a16baab64b583356217f2c85db4a39d9a86" dependencies = [ "proc-macro2", - "syn", + "syn 1.0.109", ] [[package]] name = "proc-macro2" -version = "1.0.49" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] [[package]] name = "prost" -version = "0.11.5" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c01db6702aa05baa3f57dec92b8eeeeb4cb19e894e73996b32a4093289e54592" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", "prost-derive", @@ -1099,9 +1095,9 @@ dependencies = [ [[package]] name = "prost-build" -version = "0.11.5" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb5320c680de74ba083512704acb90fe00f28f79207286a848e730c45dd73ed6" +checksum = "119533552c9a7ffacc21e099c24a0ac8bb19c2a2a3f363de84cd9b844feab270" dependencies = [ "bytes", "heck", @@ -1114,39 +1110,38 @@ dependencies = [ "prost", "prost-types", "regex", - "syn", + "syn 1.0.109", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.11.5" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8842bad1a5419bca14eac663ba798f6bc19c413c2fdceb5f3ba3b0932d96720" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", "itertools", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "prost-types" -version = "0.11.5" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "017f79637768cde62820bc2d4fe0e45daaa027755c323ad077767c6c5f173091" +checksum = "213622a1460818959ac1181aaeb2dc9c7f63df720db7d788b3e24eacd1983e13" dependencies = [ - "bytes", "prost", ] [[package]] name = "quote" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] @@ -1191,10 +1186,19 @@ dependencies = [ ] [[package]] -name = "regex" -version = "1.7.0" +name = "redox_syscall" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e076559ef8e241f2ae3479e36f97bd5741c0330689e217ad51ce2c76808b868a" +checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" dependencies = [ "aho-corasick", "memchr", @@ -1203,24 +1207,15 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.6.28" +version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" - -[[package]] -name = "remove_dir_all" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3acd125665422973a33ac9d3dd2df85edad0f4ae9b00dafb1a05e43a9f5ef8e7" -dependencies = [ - "winapi", -] +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "reqwest" -version = "0.11.14" +version = "0.11.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" +checksum = "27b71749df584b7f4cac2c426c127a7c785a5106cc98f7a8feb044115f0fa254" dependencies = [ "base64 0.21.0", "bytes", @@ -1254,33 +1249,47 @@ dependencies = [ ] [[package]] -name = "rustix" -version = "0.36.9" +name = "ring" +version = "0.16.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd5c6ff11fecd55b40746d1995a02f2eb375bf8c00d192d521ee09f42bef37bc" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +dependencies = [ + "cc", + "libc", + "once_cell", + "spin", + "untrusted", + "web-sys", + "winapi", +] + +[[package]] +name = "rustix" +version = "0.37.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "722529a737f5a942fdbac3a46cee213053196737c5eaa3386d52e85b786f2659" dependencies = [ "bitflags", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "ryu" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" +checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" [[package]] name = "schannel" -version = "0.1.20" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88d6731146462ea25d9244b2ed5fd1d716d25c52e4d54aa4fb0f3c4e9854dbe2" +checksum = "713cfb06c7059f3588fb8044c0fad1d09e3c01d225e25b9220dbfdcf16dbb1b3" dependencies = [ - "lazy_static", - "windows-sys 0.36.1", + "windows-sys 0.42.0", ] [[package]] @@ -1291,15 +1300,15 @@ checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" [[package]] name = "scratch" -version = "1.0.3" +version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddccb15bcce173023b3fedd9436f882a0739b8dfb45e4f6b6002bee5929f61b2" +checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" [[package]] name = "security-framework" -version = "2.7.0" +version = "2.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc1bb97804af6631813c55739f771071e0f2ed33ee20b68c86ec505d906356c" +checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ "bitflags", "core-foundation", @@ -1310,9 +1319,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.6.1" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0160a13a177a45bfb43ce71c01580998474f556ad854dcbca936dd2841a5c556" +checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" dependencies = [ "core-foundation-sys", "libc", @@ -1320,29 +1329,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.152" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "serde_json" -version = "1.0.91" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa", "ryu", @@ -1385,18 +1394,18 @@ dependencies = [ [[package]] name = "signal-hook-registry" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51e73328dc4ac0c7ccbda3a494dfa03df1de2f46018127f60c693f2648455b0" +checksum = "d8229b473baa5980ac72ef434c4415e70c4b5e71b423043adb4ba059f89c99a1" dependencies = [ "libc", ] [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -1409,14 +1418,20 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "socket2" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", "winapi", ] +[[package]] +name = "spin" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" + [[package]] name = "subtle" version = "2.4.1" @@ -1425,9 +1440,20 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.107" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" dependencies = [ "proc-macro2", "quote", @@ -1447,57 +1473,54 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.3.0" +version = "3.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cdb1ef4eaeeaddc8fbd371e5017057064af0911902ef36b39801f67cc6d79e4" +checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" dependencies = [ "cfg-if", "fastrand", - "libc", - "redox_syscall", - "remove_dir_all", - "winapi", + "redox_syscall 0.3.5", + "rustix", + "windows-sys 0.45.0", ] [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "time" -version = "0.3.17" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" dependencies = [ - "itoa", "serde", "time-core", - "time-macros", ] [[package]] @@ -1506,15 +1529,6 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" -[[package]] -name = "time-macros" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" -dependencies = [ - "time-core", -] - [[package]] name = "tinyvec" version = "1.6.0" @@ -1526,20 +1540,19 @@ dependencies = [ [[package]] name = "tinyvec_macros" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.26.0" +version = "1.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" +checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" dependencies = [ "autocfg", "bytes", "libc", - "memchr", "mio", "num_cpus", "parking_lot", @@ -1552,20 +1565,20 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.8.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.15", ] [[package]] name = "tokio-native-tls" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d995660bd2b7f8c1568414c1126076c13fbb725c40112dc0120b78eb9b717b" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" dependencies = [ "native-tls", "tokio", @@ -1636,7 +1649,7 @@ checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1682,15 +1695,15 @@ checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" [[package]] name = "unicode-bidi" -version = "0.3.8" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" +checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" [[package]] name = "unicode-normalization" @@ -1707,6 +1720,12 @@ version = "0.1.10" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" +[[package]] +name = "untrusted" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" + [[package]] name = "url" version = "2.3.1" @@ -1773,7 +1792,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -1807,7 +1826,7 @@ checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -1834,7 +1853,7 @@ version = "0.1.1" dependencies = [ "cxx", "cxx-build", - "env_logger 0.10.0", + "env_logger", "flate2", "glob", "log", @@ -1846,9 +1865,9 @@ dependencies = [ [[package]] name = "which" -version = "4.3.0" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c831fbbee9e129a8cf93e7747a82da9d95ba8e16621cae60ec2cdc849bacb7b" +checksum = "2441c784c52b289a054b7201fc93253e288f094e2f4be9058343127c4226a269" dependencies = [ "either", "libc", @@ -1886,32 +1905,19 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - [[package]] name = "windows-sys" version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", ] [[package]] @@ -1920,95 +1926,131 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", ] [[package]] name = "windows-targets" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", ] [[package]] name = "windows_aarch64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" [[package]] name = "windows_aarch64_msvc" -version = "0.36.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" [[package]] name = "windows_aarch64_msvc" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" [[package]] name = "windows_i686_gnu" -version = "0.36.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" [[package]] name = "windows_i686_gnu" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" [[package]] name = "windows_i686_msvc" -version = "0.36.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" [[package]] name = "windows_i686_msvc" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" [[package]] name = "windows_x86_64_gnu" -version = "0.36.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" [[package]] name = "windows_x86_64_gnu" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" [[package]] name = "windows_x86_64_gnullvm" -version = "0.42.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" [[package]] name = "windows_x86_64_msvc" -version = "0.36.1" +version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" [[package]] name = "windows_x86_64_msvc" -version = "0.42.1" +version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winreg" @@ -2030,9 +2072,9 @@ dependencies = [ [[package]] name = "zip" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537ce7411d25e54e8ae21a7ce0b15840e7bfcff15b51d697ec3266cc76bdf080" +checksum = "0445d0fbc924bb93539b4316c11afb121ea39296f99a3c4c9edad09e3658cdef" dependencies = [ "aes", "byteorder", @@ -2069,10 +2111,11 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.4+zstd.1.5.2" +version = "2.0.8+zstd.1.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fa202f2ef00074143e219d15b62ffc317d17cc33909feac471c044087cad7b0" +checksum = "5556e6ee25d32df2586c098bbfa278803692a20d0ab9565e049480d52707ec8c" dependencies = [ "cc", "libc", + "pkg-config", ] diff --git a/Cargo.toml b/Cargo.toml index 891654b..3743bb0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,8 @@ [workspace] members = [ "livekit", - "livekit-utils", + "livekit-api", + "livekit-protocol", "livekit-ffi", "livekit-webrtc", "webrtc-sys" diff --git a/livekit-api/Cargo.toml b/livekit-api/Cargo.toml new file mode 100644 index 0000000..29590fd --- /dev/null +++ b/livekit-api/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "livekit-api" +version = "0.1.0" +edition = "2021" + +[dependencies] +jsonwebtoken = {version = "8", default-features = false } +thiserror = "1.0" +serde = {version = "1.0", features = ["derive"] } +serde_json = "1.0" +livekit-protocol = { path = "../livekit-protocol", version = "0.1.0" } +sha2 = "0.10.6" +reqwest = { version = "0.11", features=["json"] } +url = "2.3.1" +prost = "0.11.9" diff --git a/livekit-api/src/access_token.rs b/livekit-api/src/access_token.rs new file mode 100644 index 0000000..977d3ef --- /dev/null +++ b/livekit-api/src/access_token.rs @@ -0,0 +1,260 @@ +use crate::get_env_keys; +use jsonwebtoken::{self, DecodingKey, EncodingKey, Header}; +use serde::{Deserialize, Serialize}; +use std::env; +use std::fmt::Debug; +use std::ops::Add; +use std::time::Duration; +use std::time::{SystemTime, UNIX_EPOCH}; +use thiserror::Error; + +pub const DEFAULT_TTL: Duration = Duration::from_secs(3600 * 6); // 6 hours + +#[derive(Debug, Error)] +pub enum AccessTokenError { + #[error("Invalid API Key or Secret Key")] + InvalidKeys, + #[error("Invalid environment")] + InvalidEnv(#[from] env::VarError), + #[error("invalid claims: {0}")] + InvalidClaims(&'static str), + #[error("failed to encode jwt")] + Encoding(#[from] jsonwebtoken::errors::Error), +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct VideoGrants { + // actions on rooms + pub room_create: bool, + pub room_list: bool, + pub room_record: bool, + + // actions on a particular room + pub room_admin: bool, + pub room_join: bool, + pub room: String, + + // permissions within a room + pub can_publish: bool, + pub can_subscribe: bool, + pub can_publish_data: bool, + + // TrackSource types that a participant may publish. + // When set, it supercedes CanPublish. Only sources explicitly set here can be published + pub can_publish_sources: Vec, // keys keep track of each source + + // by default, a participant is not allowed to update its own metadata + pub can_update_own_metadata: bool, + + // actions on ingresses + pub ingress_admin: bool, // applies to all ingress + + // participant is not visible to other participants (useful when making bots) + pub hidden: bool, + + // indicates to the room that current participant is a recorder + pub recorder: bool, +} + +impl Default for VideoGrants { + fn default() -> Self { + Self { + room_create: false, + room_list: false, + room_record: false, + room_admin: false, + room_join: false, + room: "".to_string(), + can_publish: true, + can_subscribe: true, + can_publish_data: true, + can_publish_sources: Vec::default(), + can_update_own_metadata: false, + ingress_admin: false, + hidden: false, + recorder: false, + } + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct Claims { + pub exp: usize, // Expiration + pub iss: String, // ApiKey + pub nbf: usize, + pub sub: String, // Identity + + pub name: String, + pub video: VideoGrants, + pub sha256: String, // Used to verify the integrity of the message body + pub metadata: String, +} + +#[derive(Clone)] +pub struct AccessToken { + api_key: String, + api_secret: String, + claims: Claims, +} + +impl Debug for AccessToken { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + // Don't show api_secret here + f.debug_struct("AccessToken") + .field("api_key", &self.api_key) + .field("claims", &self.claims) + .finish() + } +} + +impl AccessToken { + pub fn with_api_key(api_key: &str, api_secret: &str) -> Self { + let now = SystemTime::now().duration_since(UNIX_EPOCH).unwrap(); + Self { + api_key: api_key.to_owned(), + api_secret: api_secret.to_owned(), + claims: Claims { + exp: now.add(DEFAULT_TTL).as_secs() as usize, + iss: api_key.to_owned(), + nbf: now.as_secs() as usize, + sub: Default::default(), + name: Default::default(), + video: VideoGrants::default(), + sha256: Default::default(), + metadata: Default::default(), + }, + } + } + pub fn new() -> Result { + // Try to get the API Key and the Secret Key from the environment + let (api_key, api_secret) = get_env_keys()?; + Ok(Self::with_api_key(&api_key, &api_secret)) + } + + pub fn with_ttl(mut self, ttl: Duration) -> Self { + let time = SystemTime::now().duration_since(UNIX_EPOCH).unwrap() + ttl; + self.claims.exp = time.as_secs() as usize; + self + } + + pub fn with_grants(mut self, grants: VideoGrants) -> Self { + self.claims.video = grants; + self + } + + pub fn with_identity(mut self, identity: &str) -> Self { + self.claims.sub = identity.to_owned(); + self + } + + pub fn with_name(mut self, name: &str) -> Self { + self.claims.name = name.to_owned(); + self + } + + pub fn with_metadata(mut self, metadata: &str) -> Self { + self.claims.metadata = metadata.to_owned(); + self + } + + pub fn with_sha256(mut self, sha256: &str) -> Self { + self.claims.sha256 = sha256.to_owned(); + self + } + + pub fn to_jwt(self) -> Result { + if self.api_key.is_empty() || self.api_secret.is_empty() { + return Err(AccessTokenError::InvalidKeys); + } + + if self.claims.video.room_join && self.claims.sub.is_empty() { + return Err(AccessTokenError::InvalidClaims( + "token grants room_join but doesn't have an identity", + )); + } + + Ok(jsonwebtoken::encode( + &Header::new(jsonwebtoken::Algorithm::HS256), + &self.claims, + &EncodingKey::from_secret(self.api_secret.as_ref()), + )?) + } +} + +#[derive(Clone)] +pub struct TokenVerifier { + api_key: String, + api_secret: String, +} + +impl Debug for TokenVerifier { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("TokenVerifier") + .field("api_key", &self.api_key) + .finish() + } +} + +impl TokenVerifier { + pub fn with_api_key(api_key: &str, api_secret: &str) -> Self { + Self { + api_key: api_key.to_owned(), + api_secret: api_secret.to_owned(), + } + } + + pub fn new() -> Result { + let (api_key, api_secret) = get_env_keys()?; + Ok(Self::with_api_key(&api_key, &api_secret)) + } + + pub fn verify(&self, token: &str) -> Result { + let mut validation = jsonwebtoken::Validation::new(jsonwebtoken::Algorithm::HS256); + validation.validate_exp = true; + validation.validate_nbf = true; + validation.set_issuer(&[&self.api_key]); + + let token = jsonwebtoken::decode::( + token, + &DecodingKey::from_secret(self.api_secret.as_ref()), + &validation, + )?; + + Ok(token.claims) + } +} + +#[cfg(test)] +mod tests { + use super::{AccessToken, TokenVerifier, VideoGrants}; + use std::time::Duration; + + const TEST_API_KEY: &str = "myapikey"; + const TEST_API_SECRET: &str = "thiskeyistotallyunsafe"; + + #[test] + fn test_access_token() { + let token = AccessToken::with_api_key(TEST_API_KEY, TEST_API_SECRET) + .with_ttl(Duration::from_secs(60)) + .with_identity("test") + .with_name("test") + .with_grants(VideoGrants::default()) + .to_jwt() + .unwrap(); + + let verifier = TokenVerifier::with_api_key(TEST_API_KEY, TEST_API_SECRET); + let claims = verifier.verify(&token).unwrap(); + + assert_eq!(claims.sub, "test"); + assert_eq!(claims.name, "test"); + assert_eq!(claims.iss, TEST_API_KEY); + + let incorrect_issuer = TokenVerifier::with_api_key("incorrect", TEST_API_SECRET); + assert!(incorrect_issuer.verify(&token).is_err()); + + let incorrect_token = TokenVerifier::with_api_key(TEST_API_KEY, "incorrect"); + assert!(incorrect_token.verify(&token).is_err()); + } +} diff --git a/livekit-api/src/lib.rs b/livekit-api/src/lib.rs new file mode 100644 index 0000000..b5f6808 --- /dev/null +++ b/livekit-api/src/lib.rs @@ -0,0 +1,9 @@ +pub mod access_token; +pub mod services; +pub mod webhook_receiver; + +pub(crate) fn get_env_keys() -> Result<(String, String), std::env::VarError> { + let api_key = std::env::var("LIVEKIT_API_KEY")?; + let api_secret = std::env::var("LIVEKIT_API_SECRET")?; + Ok((api_key, api_secret)) +} diff --git a/livekit-api/src/services/egress.rs b/livekit-api/src/services/egress.rs new file mode 100644 index 0000000..137918f --- /dev/null +++ b/livekit-api/src/services/egress.rs @@ -0,0 +1,423 @@ +use super::{ServiceBase, ServiceResult, LIVEKIT_PACKAGE}; +use crate::services::twirp_client::TwirpClient; +use crate::{access_token::VideoGrants, get_env_keys}; +use livekit_protocol as proto; + +#[derive(Default, Clone, Debug)] +pub struct RoomCompositeOptions { + pub layout: String, + pub encoding: encoding::EncodingOptions, + pub audio_only: bool, + pub video_only: bool, + pub custom_base_url: String, +} + +#[derive(Default, Clone, Debug)] +pub struct WebOptions { + pub encoding: encoding::EncodingOptions, + pub audio_only: bool, + pub video_only: bool, +} + +#[derive(Default, Clone, Debug)] +pub struct TrackCompositeOptions { + pub encoding: encoding::EncodingOptions, + pub audio_track_id: String, + pub video_track_id: String, +} + +#[derive(Debug, Clone)] +pub enum EgressOutput { + File(proto::EncodedFileOutput), + Stream(proto::StreamOutput), + Segments(proto::SegmentedFileOutput), +} + +#[derive(Debug, Clone)] +pub enum TrackEgressOutput { + File(proto::DirectFileOutput), + WebSocket(String), +} + +#[derive(Debug, Clone)] +pub enum EgressListFilter { + All, + Egress(String), + Room(String), +} + +#[derive(Debug, Clone)] +pub struct EgressListOptions { + pub filter: EgressListFilter, + pub active: bool, +} + +const SVC: &'static str = "Egress"; + +#[derive(Debug)] +pub struct EgressClient { + base: ServiceBase, + client: TwirpClient, +} + +impl EgressClient { + pub fn with_api_key(host: &str, api_key: &str, api_secret: &str) -> Self { + Self { + base: ServiceBase::with_api_key(api_key, api_secret), + client: TwirpClient::new(host, LIVEKIT_PACKAGE, None), + } + } + + pub fn new(host: &str) -> ServiceResult { + let (api_key, api_secret) = get_env_keys()?; + Ok(Self::with_api_key(host, &api_key, &api_secret)) + } + + pub async fn start_room_composite_egress( + &self, + room: &str, + outputs: Vec, + options: RoomCompositeOptions, + ) -> ServiceResult { + let (file_outputs, stream_outputs, segment_outputs) = get_outputs(outputs); + self.client + .request( + SVC, + "StartRoomCompositeEgress", + proto::RoomCompositeEgressRequest { + room_name: room.to_string(), + layout: options.layout, + audio_only: options.audio_only, + video_only: options.video_only, + options: Some(proto::room_composite_egress_request::Options::Advanced( + options.encoding.into(), + )), + custom_base_url: options.custom_base_url, + file_outputs, + stream_outputs, + segment_outputs, + output: None, // Deprecated + }, + self.base.auth_header(VideoGrants { + room_record: true, + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn start_web_egress( + &self, + url: &str, + outputs: Vec, + options: WebOptions, + ) -> ServiceResult { + let (file_outputs, stream_outputs, segment_outputs) = get_outputs(outputs); + self.client + .request( + SVC, + "StartWebEgress", + proto::WebEgressRequest { + url: url.to_string(), + options: Some(proto::web_egress_request::Options::Advanced( + options.encoding.into(), + )), + audio_only: options.audio_only, + video_only: options.video_only, + file_outputs, + stream_outputs, + segment_outputs, + output: None, // Deprecated + }, + self.base.auth_header(VideoGrants { + room_record: true, + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn start_track_composite_egress( + &self, + room: &str, + outputs: Vec, + options: TrackCompositeOptions, + ) -> ServiceResult { + let (file_outputs, stream_outputs, segment_outputs) = get_outputs(outputs); + self.client + .request( + SVC, + "StartTrackCompositeEgress", + proto::TrackCompositeEgressRequest { + room_name: room.to_string(), + options: Some(proto::track_composite_egress_request::Options::Advanced( + options.encoding.into(), + )), + audio_track_id: options.audio_track_id, + video_track_id: options.video_track_id, + file_outputs, + stream_outputs, + segment_outputs, + output: None, // Deprecated + }, + self.base.auth_header(VideoGrants { + room_record: true, + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn start_track_egress( + &self, + room: &str, + output: TrackEgressOutput, + track_id: &str, + ) -> ServiceResult { + self.client + .request( + SVC, + "StartTrackEgress", + proto::TrackEgressRequest { + room_name: room.to_string(), + output: match output { + TrackEgressOutput::File(f) => { + Some(proto::track_egress_request::Output::File(f)) + } + TrackEgressOutput::WebSocket(url) => { + Some(proto::track_egress_request::Output::WebsocketUrl(url)) + } + }, + track_id: track_id.to_string(), + }, + self.base.auth_header(VideoGrants { + room_record: true, + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn update_layout( + &self, + egress_id: &str, + layout: &str, + ) -> ServiceResult { + self.client + .request( + SVC, + "UpdateLayout", + proto::UpdateLayoutRequest { + egress_id: egress_id.to_owned(), + layout: layout.to_owned(), + }, + self.base.auth_header(VideoGrants { + room_record: true, + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn update_stream( + &self, + egress_id: &str, + add_output_urls: Vec, + remove_output_urls: Vec, + ) -> ServiceResult { + self.client + .request( + SVC, + "UpdateStream", + proto::UpdateStreamRequest { + egress_id: egress_id.to_owned(), + add_output_urls, + remove_output_urls, + }, + self.base.auth_header(VideoGrants { + room_record: true, + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn list_egress( + &self, + options: EgressListOptions, + ) -> ServiceResult> { + let mut room_name = String::default(); + let mut egress_id = String::default(); + + match options.filter { + EgressListFilter::Room(room) => room_name = room, + EgressListFilter::Egress(egress) => egress_id = egress, + _ => {} + } + + let resp: proto::ListEgressResponse = self + .client + .request( + SVC, + "ListEgress", + proto::ListEgressRequest { + room_name, + egress_id, + active: options.active, + }, + self.base.auth_header(VideoGrants { + room_record: true, + ..Default::default() + })?, + ) + .await?; + + Ok(resp.items) + } + + pub async fn stop_egress(&self, egress_id: &str) -> ServiceResult { + self.client + .request( + SVC, + "StopEgress", + proto::StopEgressRequest { + egress_id: egress_id.to_owned(), + }, + self.base.auth_header(VideoGrants { + room_record: true, + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } +} + +fn get_outputs( + outputs: Vec, +) -> ( + Vec, + Vec, + Vec, +) { + let mut file_outputs = Vec::new(); + let mut stream_outputs = Vec::new(); + let mut segment_outputs = Vec::new(); + + for output in outputs { + match output { + EgressOutput::File(f) => file_outputs.push(f), + EgressOutput::Stream(s) => stream_outputs.push(s), + EgressOutput::Segments(s) => segment_outputs.push(s), + } + } + + (file_outputs, stream_outputs, segment_outputs) +} + +pub mod encoding { + use super::*; + + #[derive(Clone, Debug)] + pub struct EncodingOptions { + pub width: i32, + pub height: i32, + pub depth: i32, + pub framerate: i32, + pub audio_codec: proto::AudioCodec, + pub audio_bitrate: i32, + pub audio_frequency: i32, + pub video_codec: proto::VideoCodec, + pub video_bitrate: i32, + pub keyframe_interval: f64, + } + + impl From for proto::EncodingOptions { + fn from(opts: EncodingOptions) -> Self { + Self { + width: opts.width, + height: opts.height, + depth: opts.depth, + framerate: opts.framerate, + audio_codec: opts.audio_codec as i32, + audio_bitrate: opts.audio_bitrate, + audio_frequency: opts.audio_frequency, + video_codec: opts.video_codec as i32, + video_bitrate: opts.video_bitrate, + key_frame_interval: opts.keyframe_interval, + } + } + } + + impl EncodingOptions { + const fn new() -> Self { + Self { + width: 1920, + height: 1080, + depth: 24, + framerate: 30, + audio_codec: proto::AudioCodec::Opus, + audio_bitrate: 128, + audio_frequency: 44100, + video_codec: proto::VideoCodec::H264Main, + video_bitrate: 4500, + keyframe_interval: 0.0, + } + } + } + + impl Default for EncodingOptions { + fn default() -> Self { + Self::new() + } + } + + pub const H264_720P_30: EncodingOptions = EncodingOptions { + width: 1280, + height: 720, + video_bitrate: 3000, + ..EncodingOptions::new() + }; + pub const H264_720P_60: EncodingOptions = EncodingOptions { + width: 1280, + height: 720, + framerate: 60, + ..EncodingOptions::new() + }; + pub const H264_1080P_30: EncodingOptions = EncodingOptions::new(); + pub const H264_1080P_60: EncodingOptions = EncodingOptions { + framerate: 60, + video_bitrate: 6000, + ..EncodingOptions::new() + }; + pub const PORTRAIT_H264_720P_30: EncodingOptions = EncodingOptions { + width: 720, + height: 1280, + video_bitrate: 3000, + ..EncodingOptions::new() + }; + pub const PORTRAIT_H264_720P_60: EncodingOptions = EncodingOptions { + width: 720, + height: 1280, + framerate: 60, + ..EncodingOptions::new() + }; + pub const PORTRAIT_H264_1080P_30: EncodingOptions = EncodingOptions { + width: 1080, + height: 1920, + ..EncodingOptions::new() + }; + pub const PORTRAIT_H264_1080P_60: EncodingOptions = EncodingOptions { + width: 1080, + height: 1920, + framerate: 60, + video_bitrate: 6000, + ..EncodingOptions::new() + }; +} diff --git a/livekit-api/src/services/ingress.rs b/livekit-api/src/services/ingress.rs new file mode 100644 index 0000000..fd94300 --- /dev/null +++ b/livekit-api/src/services/ingress.rs @@ -0,0 +1,138 @@ +use super::{ServiceBase, ServiceResult, LIVEKIT_PACKAGE}; +use crate::services::twirp_client::TwirpClient; +use crate::{access_token::VideoGrants, get_env_keys}; +use livekit_protocol as proto; + +#[derive(Default, Clone, Debug)] +pub struct IngressOptions { + pub name: String, + pub room_name: String, + pub participant_identity: String, + pub participant_name: String, + pub audio: proto::IngressAudioOptions, + pub video: proto::IngressVideoOptions, +} + +#[derive(Debug, Clone, PartialEq, Eq)] +pub enum IngressListFilter { + All, + Room(String), +} + +const SVC: &'static str = "Ingress"; + +#[derive(Debug)] +pub struct IngressClient { + base: ServiceBase, + client: TwirpClient, +} + +impl IngressClient { + pub fn with_api_key(host: &str, api_key: &str, api_secret: &str) -> Self { + Self { + base: ServiceBase::with_api_key(api_key, api_secret), + client: TwirpClient::new(host, LIVEKIT_PACKAGE, None), + } + } + + pub fn new(host: &str) -> ServiceResult { + let (api_key, api_secret) = get_env_keys()?; + Ok(Self::with_api_key(host, &api_key, &api_secret)) + } + + pub async fn create_ingress( + &self, + input_type: proto::IngressInput, + options: IngressOptions, + ) -> ServiceResult { + self.client + .request( + SVC, + "CreateIngress", + proto::CreateIngressRequest { + input_type: input_type as i32, + name: options.name, + room_name: options.room_name, + participant_identity: options.participant_identity, + participant_name: options.participant_name, + audio: Some(options.audio), + video: Some(options.video), + }, + self.base.auth_header(VideoGrants { + ingress_admin: true, + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn update_ingress( + &self, + ingress_id: &str, + options: IngressOptions, + ) -> ServiceResult { + self.client + .request( + SVC, + "UpdateIngress", + proto::UpdateIngressRequest { + ingress_id: ingress_id.to_owned(), + name: options.name, + room_name: options.room_name, + participant_identity: options.participant_identity, + participant_name: options.participant_name, + audio: Some(options.audio), + video: Some(options.video), + }, + self.base.auth_header(VideoGrants { + ingress_admin: true, + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn list_ingress( + &self, + filter: IngressListFilter, + ) -> ServiceResult> { + let resp: proto::ListIngressResponse = self + .client + .request( + SVC, + "ListIngress", + proto::ListIngressRequest { + room_name: match filter{ + IngressListFilter::All => Default::default(), + IngressListFilter::Room(room) => room, + }, + }, + self.base.auth_header(VideoGrants { + ingress_admin: true, + ..Default::default() + })?, + ) + .await?; + + Ok(resp.items) + } + + pub async fn delete_ingress(&self, ingress_id: &str) -> ServiceResult { + self.client + .request( + SVC, + "DeleteIngress", + proto::DeleteIngressRequest { + ingress_id: ingress_id.to_owned(), + }, + self.base.auth_header(VideoGrants { + ingress_admin: true, + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } +} diff --git a/livekit-api/src/services/mod.rs b/livekit-api/src/services/mod.rs new file mode 100644 index 0000000..2a281cf --- /dev/null +++ b/livekit-api/src/services/mod.rs @@ -0,0 +1,59 @@ +use crate::access_token::{AccessToken, AccessTokenError, VideoGrants}; +use reqwest::header::{HeaderMap, HeaderValue, AUTHORIZATION}; +use std::fmt::Debug; +use thiserror::Error; + +pub mod room; +pub mod egress; +pub mod ingress; + +mod twirp_client; + +pub const LIVEKIT_PACKAGE: &'static str = "livekit"; + +#[derive(Debug, Error)] +pub enum ServiceError { + #[error("invalid environment: {0}")] + Env(#[from] std::env::VarError), + #[error("invalid access token: {0}")] + AccessToken(#[from] AccessTokenError), + #[error("twirp error: {0}")] + Twirp(#[from] twirp_client::TwirpError), +} + +pub type ServiceResult = Result; + +struct ServiceBase { + api_key: String, + api_secret: String, +} + +impl Debug for ServiceBase { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("ServiceBase") + .field("api_key", &self.api_key) + .finish() + } +} + +impl ServiceBase { + pub fn with_api_key(api_key: &str, api_secret: &str) -> Self { + Self { + api_key: api_key.to_owned(), + api_secret: api_secret.to_owned(), + } + } + + pub fn auth_header(&self, grants: VideoGrants) -> Result { + let token = AccessToken::with_api_key(&self.api_key, &self.api_secret) + .with_grants(grants) + .to_jwt()?; + + let mut headers = HeaderMap::new(); + headers.insert( + AUTHORIZATION, + HeaderValue::from_str(&format!("Bearer {}", token)).unwrap(), + ); + Ok(headers) + } +} diff --git a/livekit-api/src/services/room.rs b/livekit-api/src/services/room.rs new file mode 100644 index 0000000..087e9d3 --- /dev/null +++ b/livekit-api/src/services/room.rs @@ -0,0 +1,308 @@ +use super::{ServiceBase, ServiceResult, LIVEKIT_PACKAGE}; +use crate::services::twirp_client::TwirpClient; +use crate::{access_token::VideoGrants, get_env_keys}; +use livekit_protocol as proto; + +const SVC: &'static str = "RoomService"; + +#[derive(Debug, Clone, Default)] +pub struct CreateRoomOptions { + pub empty_timeout: u32, + pub max_participants: u32, + pub node_id: String, + pub metadata: String, + pub egress: Option, // TODO(theomonnom): Better API? +} + +#[derive(Debug, Clone, Default)] +pub struct UpdateParticipantOptions { + pub metadata: String, + pub permission: Option, + pub name: String, // No effect if left empty +} + +#[derive(Debug, Clone, Default)] +pub struct SendDataOptions { + pub kind: proto::data_packet::Kind, + pub destination_sids: Vec, + pub topic: Option, +} + +#[derive(Debug)] +pub struct RoomClient { + base: ServiceBase, + client: TwirpClient, +} + +impl RoomClient { + pub fn with_api_key(host: &str, api_key: &str, api_secret: &str) -> Self { + Self { + base: ServiceBase::with_api_key(api_key, api_secret), + client: TwirpClient::new(host, LIVEKIT_PACKAGE, None), + } + } + + pub fn new(host: &str) -> ServiceResult { + let (api_key, api_secret) = get_env_keys()?; + Ok(Self::with_api_key(host, &api_key, &api_secret)) + } + + pub async fn create_room( + &self, + name: &str, + options: CreateRoomOptions, + ) -> ServiceResult { + self.client + .request( + SVC, + "CreateRoom", + proto::CreateRoomRequest { + name: name.to_owned(), + empty_timeout: options.empty_timeout, + max_participants: options.max_participants, + node_id: options.node_id, + metadata: options.metadata, + egress: options.egress, + }, + self.base.auth_header(VideoGrants { + room_create: true, + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn list_rooms(&self, names: Vec) -> ServiceResult> { + let resp: proto::ListRoomsResponse = self + .client + .request( + SVC, + "ListRooms", + proto::ListRoomsRequest { names }, + self.base.auth_header(VideoGrants { + room_list: true, + ..Default::default() + })?, + ) + .await?; + + Ok(resp.rooms) + } + + pub async fn delete_room(&self, room: &str) -> ServiceResult<()> { + self.client + .request( + SVC, + "DeleteRoom", + proto::DeleteRoomRequest { + room: room.to_owned(), + }, + self.base.auth_header(VideoGrants { + room_create: true, + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn update_room_metadata( + &self, + room: &str, + metadata: &str, + ) -> ServiceResult { + self.client + .request( + SVC, + "UpdateRoomMetadata", + proto::UpdateRoomMetadataRequest { + room: room.to_owned(), + metadata: metadata.to_owned(), + }, + self.base.auth_header(VideoGrants { + room_admin: true, + room: room.to_owned(), + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn list_participants( + &self, + room: &str, + ) -> ServiceResult> { + let resp: proto::ListParticipantsResponse = self + .client + .request( + SVC, + "ListParticipants", + proto::ListParticipantsRequest { + room: room.to_owned(), + }, + self.base.auth_header(VideoGrants { + room_admin: true, + room: room.to_owned(), + ..Default::default() + })?, + ) + .await?; + + Ok(resp.participants) + } + + pub async fn get_participant( + &self, + room: &str, + identity: &str, + ) -> ServiceResult { + self.client + .request( + SVC, + "GetParticipant", + proto::RoomParticipantIdentity { + room: room.to_owned(), + identity: identity.to_owned(), + }, + self.base.auth_header(VideoGrants { + room_admin: true, + room: room.to_owned(), + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn remove_participant(&self, room: &str, identity: &str) -> ServiceResult<()> { + self.client + .request( + SVC, + "RemoveParticipant", + proto::RoomParticipantIdentity { + room: room.to_owned(), + identity: identity.to_owned(), + }, + self.base.auth_header(VideoGrants { + room_admin: true, + room: room.to_owned(), + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn mute_published_track( + &self, + room: &str, + identity: &str, + track_sid: &str, + muted: bool, + ) -> ServiceResult { + let resp: proto::MuteRoomTrackResponse = self + .client + .request( + SVC, + "MutePublishedTrack", + proto::MuteRoomTrackRequest { + room: room.to_owned(), + identity: identity.to_owned(), + track_sid: track_sid.to_owned(), + muted, + }, + self.base.auth_header(VideoGrants { + room_admin: true, + room: room.to_owned(), + ..Default::default() + })?, + ) + .await?; + + Ok(resp.track.unwrap()) + } + + pub async fn update_participant( + &self, + room: &str, + identity: &str, + options: UpdateParticipantOptions, + ) -> ServiceResult { + self.client + .request( + SVC, + "UpdateParticipant", + proto::UpdateParticipantRequest { + room: room.to_owned(), + identity: identity.to_owned(), + permission: options.permission, + metadata: options.metadata, + name: options.name, + }, + self.base.auth_header(VideoGrants { + room_admin: true, + room: room.to_owned(), + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn update_subscriptions( + &self, + room: &str, + identity: &str, + track_sids: Vec, + subscribe: bool, + ) -> ServiceResult<()> { + self.client + .request( + SVC, + "UpdateSubscriptions", + proto::UpdateSubscriptionsRequest { + room: room.to_owned(), + identity: identity.to_owned(), + track_sids, + subscribe, + ..Default::default() + }, + self.base.auth_header(VideoGrants { + room_admin: true, + room: room.to_owned(), + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } + + pub async fn send_data( + &self, + room: &str, + data: Vec, + options: SendDataOptions, + ) -> ServiceResult<()> { + self.client + .request( + SVC, + "SendData", + proto::SendDataRequest { + room: room.to_owned(), + data, + destination_sids: options.destination_sids, + topic: options.topic, + kind: options.kind as i32, + }, + self.base.auth_header(VideoGrants { + room_admin: true, + room: room.to_owned(), + ..Default::default() + })?, + ) + .await + .map_err(Into::into) + } +} diff --git a/livekit-api/src/services/twirp_client.rs b/livekit-api/src/services/twirp_client.rs new file mode 100644 index 0000000..a5eff77 --- /dev/null +++ b/livekit-api/src/services/twirp_client.rs @@ -0,0 +1,109 @@ +use reqwest::{ + header::{HeaderMap, HeaderValue, CONTENT_TYPE}, + StatusCode, +}; +use serde::Deserialize; +use std::fmt::Display; +use thiserror::Error; + +pub const DEFAULT_PREFIX: &str = "/twirp"; + +#[derive(Debug, Error)] +pub enum TwirpError { + #[error("failed to execute the request: {0}")] + Request(#[from] reqwest::Error), + #[error("twirp error: {0}")] + Twirp(TwirpErrorCode), + #[error("url error: {0}")] + Url(#[from] url::ParseError), + #[error("prost error: {0}")] + Prost(#[from] prost::DecodeError), +} + +#[derive(Debug, Deserialize)] +pub struct TwirpErrorCode { + pub code: String, + pub msg: String, +} + +impl TwirpErrorCode { + pub const CANCELED: &'static str = "canceled"; + pub const UNKNOWN: &'static str = "unknown"; + pub const INVALID_ARGUMENT: &'static str = "invalid_argument"; + pub const MALFORMED: &'static str = "malformed"; + pub const DEADLINE_EXCEEDED: &'static str = "deadline_exceeded"; + pub const NOT_FOUND: &'static str = "not_found"; + pub const BAD_ROUTE: &'static str = "bad_route"; + pub const ALREADY_EXISTS: &'static str = "already_exists"; + pub const PERMISSION_DENIED: &'static str = "permission_denied"; + pub const UNAUTHENTICATED: &'static str = "unauthenticated"; + pub const RESOURCE_EXHAUSTED: &'static str = "resource_exhausted"; + pub const FAILED_PRECONDITION: &'static str = "failed_precondition"; + pub const ABORTED: &'static str = "aborted"; + pub const OUT_OF_RANGE: &'static str = "out_of_range"; + pub const UNIMPLEMENTED: &'static str = "unimplemented"; + pub const INTERNAL: &'static str = "internal"; + pub const UNAVAILABLE: &'static str = "unavailable"; + pub const DATA_LOSS: &'static str = "dataloss"; +} + +impl Display for TwirpErrorCode { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}: {}", self.code, self.msg) + } +} + +pub type TwirpResult = Result; + +#[derive(Debug)] +pub struct TwirpClient { + host: String, + pkg: String, + prefix: String, + client: reqwest::Client, +} + +impl TwirpClient { + pub fn new(host: &str, pkg: &str, prefix: Option<&str>) -> Self { + Self { + host: host.to_owned(), + pkg: pkg.to_owned(), + prefix: prefix.unwrap_or(DEFAULT_PREFIX).to_owned(), + client: reqwest::Client::new(), + } + } + + pub async fn request( + &self, + service: &str, + method: &str, + data: D, + mut headers: HeaderMap, + ) -> TwirpResult { + let mut url = url::Url::parse(&self.host)?; + url.set_path(&format!( + "{}/{}.{}/{}", + self.prefix, self.pkg, service, method + )); + + headers.insert( + CONTENT_TYPE, + HeaderValue::from_static("application/protobuf"), + ); + + let resp = self + .client + .post(url) + .headers(headers) + .body(data.encode_to_vec()) + .send() + .await?; + + if resp.status() == StatusCode::OK { + Ok(R::decode(resp.bytes().await?)?) + } else { + let err: TwirpErrorCode = resp.json().await?; + Err(TwirpError::Twirp(err)) + } + } +} diff --git a/livekit-api/src/webhook_receiver.rs b/livekit-api/src/webhook_receiver.rs new file mode 100644 index 0000000..0e72e70 --- /dev/null +++ b/livekit-api/src/webhook_receiver.rs @@ -0,0 +1,55 @@ +// Webhooks are not yet integrated into the Rust SDK. +// Our webhooks protocol use protojson which isn't supported by Prost + +/* +use crate::access_token::{AccessTokenError, TokenVerifier}; +use livekit_protocol as proto; +use serde_json; +use sha2::{Digest, Sha256}; +use thiserror::Error; + +#[derive(Debug, Error)] +pub enum WebhookError { + #[error("invalid signature")] + InvalidSignature, + #[error("failed to verify the authorization: {0}")] + InvalidAuth(#[from] AccessTokenError), + #[error("invalid body, failed to decode: {0}")] + InvalidData(#[from] serde_json::Error), +} + +#[derive(Clone, Debug)] +pub struct WebhookReceiver { + token_verifier: TokenVerifier, +} + +impl WebhookReceiver { + pub fn new(token_verifier: TokenVerifier) -> Self { + Self { token_verifier } + } + + pub fn receive( + &self, + body: &str, + auth_token: &str, + ) -> Result { + let claims = self.token_verifier.verify(auth_token)?; + + let mut hasher = Sha256::new(); + hasher.update(body); + let hash = hasher.finalize(); + + let hex: Result, std::num::ParseIntError> = (0..claims.sha256.len()) + .step_by(2) + .map(|i| u8::from_str_radix(&claims.sha256[i..i + 2], 16)) + .collect(); + + let hex = hex.map_err(|_| WebhookError::InvalidSignature)?; // Failed to parse + + if &hex[..] != &hash[..] { + return Err(WebhookError::InvalidSignature); + } + + Ok(serde_json::from_str(body)?) + } +}*/ diff --git a/livekit-ffi/Cargo.toml b/livekit-ffi/Cargo.toml index 45f7d02..e3fc048 100644 --- a/livekit-ffi/Cargo.toml +++ b/livekit-ffi/Cargo.toml @@ -8,6 +8,7 @@ repository = "https://github.com/livekit/client-sdk-rust" [dependencies] livekit = { path = "../livekit", version = "0.1.1" } +livekit-protocol = { path = "../livekit-protocol", version = "0.1.0" } tokio = { version = "1.0", features = ["full"] } parking_lot = { version = "0.12.1", features = ["send_guard"] } prost = "0.11.0" diff --git a/livekit-ffi/src/server/conversion/mod.rs b/livekit-ffi/src/server/conversion/mod.rs index 0a989ae..c4081f8 100644 --- a/livekit-ffi/src/server/conversion/mod.rs +++ b/livekit-ffi/src/server/conversion/mod.rs @@ -1,7 +1,6 @@ -use crate::{proto, server::FFIHandleId}; +use crate::server::FFIHandleId; use livekit::prelude::*; -use livekit::webrtc::prelude::*; -use std::any::Any; +use crate::proto; pub mod participant; pub mod publication; diff --git a/livekit-ffi/src/server/conversion/video_frame.rs b/livekit-ffi/src/server/conversion/video_frame.rs index 0d03afa..f1d36de 100644 --- a/livekit-ffi/src/server/conversion/video_frame.rs +++ b/livekit-ffi/src/server/conversion/video_frame.rs @@ -1,7 +1,7 @@ -use crate::{proto, server::FFIHandleId}; +use crate::proto; +use crate::server::FFIHandleId; use livekit::webrtc::prelude::*; use livekit::webrtc::video_frame; -use std::any::Any; macro_rules! impl_yuv_into { (@fields, $buffer:ident, $data_y:ident, $data_u:ident, $data_v: ident) => { diff --git a/livekit-ffi/src/server/mod.rs b/livekit-ffi/src/server/mod.rs index 3d5f8f3..931f9b4 100644 --- a/livekit-ffi/src/server/mod.rs +++ b/livekit-ffi/src/server/mod.rs @@ -1,7 +1,7 @@ -use crate::proto; use lazy_static::lazy_static; use livekit::prelude::*; use livekit::webrtc::video_frame::{native::VideoFrameBufferExt, BoxVideoFrame, VideoFrameBuffer}; +use crate::proto; use parking_lot::{Mutex, RwLock}; use prost::Message; use std::any::Any; diff --git a/livekit-ffi/src/server/room.rs b/livekit-ffi/src/server/room.rs index e9fc490..ed76b70 100644 --- a/livekit-ffi/src/server/room.rs +++ b/livekit-ffi/src/server/room.rs @@ -1,9 +1,9 @@ -use crate::proto; use crate::server::FFIServer; use futures_util::stream::StreamExt; use livekit::prelude::*; use livekit::webrtc::video_stream::native::NativeVideoStream; use tokio::sync::{mpsc, oneshot}; +use crate::proto; pub async fn create_room( server: &'static FFIServer, diff --git a/livekit-protocol/Cargo.toml b/livekit-protocol/Cargo.toml new file mode 100644 index 0000000..376f51e --- /dev/null +++ b/livekit-protocol/Cargo.toml @@ -0,0 +1,14 @@ +[package] +name = "livekit-protocol" +version = "0.1.0" +edition = "2021" + +[dependencies] +tokio = { version = "1.26.0", features = ["full"] } +futures-util = "0.3" +parking_lot = "0.12" +prost = "0.11" +prost-types = "0.11" + +[build-dependencies] +prost-build = { version = "0.11.1" } diff --git a/livekit-protocol/build.rs b/livekit-protocol/build.rs new file mode 100644 index 0000000..52e91ab --- /dev/null +++ b/livekit-protocol/build.rs @@ -0,0 +1,16 @@ +use std::io::Result; + +fn main() -> Result<()> { + let mut prost_build = prost_build::Config::new(); + prost_build.compile_protos( + &[ + "protocol/livekit_egress.proto", + "protocol/livekit_rtc.proto", + "protocol/livekit_room.proto", + "protocol/livekit_webhook.proto", + "protocol/livekit_models.proto", + ], + &["protocol/"], + )?; + Ok(()) +} diff --git a/livekit-protocol/protocol b/livekit-protocol/protocol new file mode 160000 index 0000000..1e793a8 --- /dev/null +++ b/livekit-protocol/protocol @@ -0,0 +1 @@ +Subproject commit 1e793a88707b8301286bb8306fff27e0e37d16f2 diff --git a/livekit-utils/src/enum_dispatch.rs b/livekit-protocol/src/enum_dispatch.rs similarity index 100% rename from livekit-utils/src/enum_dispatch.rs rename to livekit-protocol/src/enum_dispatch.rs diff --git a/livekit-protocol/src/lib.rs b/livekit-protocol/src/lib.rs new file mode 100644 index 0000000..3be19ee --- /dev/null +++ b/livekit-protocol/src/lib.rs @@ -0,0 +1,8 @@ +pub mod observer; +pub mod enum_dispatch; + +pub mod livekit { + include!(concat!(env!("OUT_DIR"), "/livekit.rs")); +} + +pub use livekit::*; diff --git a/livekit-utils/src/observer.rs b/livekit-protocol/src/observer.rs similarity index 100% rename from livekit-utils/src/observer.rs rename to livekit-protocol/src/observer.rs diff --git a/livekit-utils/Cargo.toml b/livekit-utils/Cargo.toml deleted file mode 100644 index bb5ad4d..0000000 --- a/livekit-utils/Cargo.toml +++ /dev/null @@ -1,12 +0,0 @@ -[package] -name = "livekit-utils" -version = "0.1.1" -edition = "2021" -license = "Apache-2.0" -description = "Shared utilities for livekit" -repository = "https://github.com/livekit/client-sdk-rust" - -[dependencies] -tokio = { version = "1.26.0", features = ["full"] } -futures-util = "0.3" -parking_lot = "0.12" diff --git a/livekit-utils/src/lib.rs b/livekit-utils/src/lib.rs deleted file mode 100644 index a58478e..0000000 --- a/livekit-utils/src/lib.rs +++ /dev/null @@ -1,2 +0,0 @@ -pub mod enum_dispatch; -pub mod observer; diff --git a/livekit-webrtc/Cargo.toml b/livekit-webrtc/Cargo.toml index e81f5c8..28e9aac 100644 --- a/livekit-webrtc/Cargo.toml +++ b/livekit-webrtc/Cargo.toml @@ -8,21 +8,21 @@ description = "Livekit safe bindings to libwebrtc" repository = "https://github.com/livekit/client-sdk-rust" [dependencies] -livekit-utils = { path = "../livekit-utils", version = "0.1.1" } +livekit-protocol = { path = "../livekit-protocol", version = "0.1.0" } log = "0.4" thiserror = "1.0" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] webrtc-sys = { path = "../webrtc-sys", version = "0.1.1" } futures = { version = "0.3" } -tokio = { version = "1.26.0", features = ["full"] } +tokio = { version = "1", features = ["full"] } cxx = "1.0" [target.'cfg(target_arch = "wasm32")'.dependencies] -wasm-bindgen = "0.2.84" +wasm-bindgen = "0.2" js-sys = "0.3" wasm-bindgen-futures = "0.4.34" -web-sys = { version = "0.3.22", features=[ +web-sys = { version = "0.3", features=[ "MessageEvent", "RtcPeerConnection", "RtcSignalingState", @@ -39,4 +39,4 @@ web-sys = { version = "0.3.22", features=[ ] } [dev-dependencies] -env_logger = "0.9" +env_logger = "0.10" diff --git a/livekit-webrtc/src/media_stream.rs b/livekit-webrtc/src/media_stream.rs index 92ce669..675155c 100644 --- a/livekit-webrtc/src/media_stream.rs +++ b/livekit-webrtc/src/media_stream.rs @@ -1,5 +1,5 @@ use crate::imp::media_stream as imp_ms; -use livekit_utils::enum_dispatch; +use livekit_protocol::enum_dispatch; use std::fmt::Debug; #[derive(Debug, Copy, Clone, PartialEq, Eq)] diff --git a/livekit/Cargo.toml b/livekit/Cargo.toml index 4ee9f9c..d93b9cc 100644 --- a/livekit/Cargo.toml +++ b/livekit/Cargo.toml @@ -8,20 +8,16 @@ repository = "https://github.com/livekit/client-sdk-rust" [dependencies] livekit-webrtc = { path = "../livekit-webrtc", version = "0.1.1" } -livekit-utils = { path = "../livekit-utils", version = "0.1.1" } +livekit-protocol = { path = "../livekit-protocol", version = "0.1.0" } +prost = "0.11" serde = { version = "1", features = ["derive"] } serde_json = "1.0" tokio-tungstenite = { version = "0.18", features = ["native-tls"] } tokio = { version = "1", features = ["full"] } tokio-stream = "0.1" parking_lot = { version = "0.12.1", features = ["send_guard"] } -url = "2.2.2" -futures-util = "0.3.23" +url = "2.3" +futures-util = "0.3" thiserror = "1.0" -prost = "0.11.0" -prost-types = "0.11.1" -lazy_static = "1.4.0" +lazy_static = "1.4" tracing = "0.1" - -[build-dependencies] -prost-build = { version = "0.11.1" } diff --git a/livekit/build.rs b/livekit/build.rs deleted file mode 100644 index cc175df..0000000 --- a/livekit/build.rs +++ /dev/null @@ -1,12 +0,0 @@ -use std::io::Result; - -fn main() -> Result<()> { - prost_build::compile_protos( - &[ - "protocol/livekit_rtc.proto", - "protocol/livekit_models.proto", - ], - &["protocol/"], - )?; - Ok(()) -} diff --git a/livekit/protocol b/livekit/protocol deleted file mode 160000 index fa87d56..0000000 --- a/livekit/protocol +++ /dev/null @@ -1 +0,0 @@ -Subproject commit fa87d56355d2be35169732cf892ea7783d7ec6ea diff --git a/livekit/src/proto.rs b/livekit/src/proto.rs index 52f8504..84203d5 100644 --- a/livekit/src/proto.rs +++ b/livekit/src/proto.rs @@ -1,6 +1,5 @@ use crate::track; - -include!(concat!(env!("OUT_DIR"), "/livekit.rs")); +use livekit_protocol::*; // Conversions impl TryFrom for track::TrackKind { diff --git a/livekit/src/room/mod.rs b/livekit/src/room/mod.rs index 1af1dcb..b7b3fc9 100644 --- a/livekit/src/room/mod.rs +++ b/livekit/src/room/mod.rs @@ -1,8 +1,8 @@ use self::track::RemoteTrack; use crate::participant::ConnectionQuality; use crate::prelude::*; -use crate::proto; use crate::rtc_engine::EngineError; +use livekit_protocol as proto; use std::fmt::Debug; use std::sync::Arc; use thiserror::Error; diff --git a/livekit/src/room/options.rs b/livekit/src/room/options.rs index 8410488..35275cc 100644 --- a/livekit/src/room/options.rs +++ b/livekit/src/room/options.rs @@ -1,5 +1,5 @@ use crate::prelude::*; -use crate::proto; +use livekit_protocol as proto; use livekit_webrtc::prelude::*; #[derive(Debug, Copy, Clone, PartialEq, Eq)] diff --git a/livekit/src/room/participant/local_participant.rs b/livekit/src/room/participant/local_participant.rs index a93c567..2999b2f 100644 --- a/livekit/src/room/participant/local_participant.rs +++ b/livekit/src/room/participant/local_participant.rs @@ -4,8 +4,8 @@ use crate::options::compute_video_encodings; use crate::options::video_layers_from_encodings; use crate::options::TrackPublishOptions; use crate::prelude::*; -use crate::proto; use crate::rtc_engine::RtcEngine; +use livekit_protocol as proto; use livekit_webrtc::rtp_parameters::RtpEncodingParameters; use parking_lot::RwLockReadGuard; use std::collections::HashMap; @@ -150,6 +150,7 @@ impl LocalParticipant { participant_sid: self.sid().to_string(), payload: data.to_vec(), destination_sids: vec![], + ..Default::default() })), }; diff --git a/livekit/src/room/participant/mod.rs b/livekit/src/room/participant/mod.rs index 57eb535..c799855 100644 --- a/livekit/src/room/participant/mod.rs +++ b/livekit/src/room/participant/mod.rs @@ -1,8 +1,8 @@ use crate::prelude::*; -use crate::proto; use crate::track::TrackError; -use livekit_utils::enum_dispatch; -use livekit_utils::observer::Dispatcher; +use livekit_protocol as proto; +use livekit_protocol::enum_dispatch; +use livekit_protocol::observer::Dispatcher; use parking_lot::{Mutex, RwLock, RwLockReadGuard}; use std::collections::HashMap; use std::sync::atomic::{AtomicBool, AtomicU32, AtomicU8, Ordering}; diff --git a/livekit/src/room/participant/remote_participant.rs b/livekit/src/room/participant/remote_participant.rs index 4ae18e4..4779006 100644 --- a/livekit/src/room/participant/remote_participant.rs +++ b/livekit/src/room/participant/remote_participant.rs @@ -1,7 +1,7 @@ use super::{ConnectionQuality, ParticipantInner}; use crate::prelude::*; -use crate::proto; use crate::track::TrackError; +use livekit_protocol as proto; use livekit_webrtc as rtc; use parking_lot::RwLockReadGuard; use rtc::prelude::MediaStreamTrack; diff --git a/livekit/src/room/publication/local.rs b/livekit/src/room/publication/local.rs index 7bad0af..48d204f 100644 --- a/livekit/src/room/publication/local.rs +++ b/livekit/src/room/publication/local.rs @@ -1,8 +1,8 @@ use super::TrackPublicationInner; use crate::id::TrackSid; use crate::options::TrackPublishOptions; -use crate::proto; use crate::track::{LocalTrack, Track, TrackDimension, TrackKind, TrackSource}; +use livekit_protocol as proto; use parking_lot::Mutex; use std::sync::Arc; diff --git a/livekit/src/room/publication/mod.rs b/livekit/src/room/publication/mod.rs index 7595bae..8400bab 100644 --- a/livekit/src/room/publication/mod.rs +++ b/livekit/src/room/publication/mod.rs @@ -1,10 +1,10 @@ use super::track::{TrackDimension, TrackEvent}; use crate::prelude::*; -use crate::proto; use crate::track::Track; use futures_util::stream::StreamExt; -use livekit_utils::enum_dispatch; -use livekit_utils::observer::Dispatcher; +use livekit_protocol as proto; +use livekit_protocol::enum_dispatch; +use livekit_protocol::observer::Dispatcher; use parking_lot::Mutex; use std::sync::atomic::{AtomicBool, AtomicU8, Ordering}; use std::sync::Arc; diff --git a/livekit/src/room/publication/remote.rs b/livekit/src/room/publication/remote.rs index a55af07..f699a59 100644 --- a/livekit/src/room/publication/remote.rs +++ b/livekit/src/room/publication/remote.rs @@ -1,7 +1,7 @@ use super::TrackPublicationInner; use crate::id::TrackSid; -use crate::proto; use crate::track::{RemoteTrack, Track, TrackDimension, TrackKind, TrackSource}; +use livekit_protocol as proto; use std::sync::Arc; #[derive(Clone, Debug)] diff --git a/livekit/src/room/room_session.rs b/livekit/src/room/room_session.rs index ebf5d3f..6ce16e2 100644 --- a/livekit/src/room/room_session.rs +++ b/livekit/src/room/room_session.rs @@ -1,10 +1,10 @@ use crate::participant::ConnectionQuality; use crate::prelude::*; -use crate::proto; use crate::rtc_engine::{EngineEvent, EngineEvents, EngineResult, RtcEngine}; use crate::signal_client::SignalOptions; use crate::{RoomError, RoomEvent, RoomResult, SimulateScenario}; -use livekit_utils::observer::Dispatcher; +use livekit_protocol as proto; +use livekit_protocol::observer::Dispatcher; use parking_lot::{Mutex, RwLock, RwLockReadGuard}; use std::collections::HashMap; use std::sync::atomic::{AtomicU8, Ordering}; diff --git a/livekit/src/room/track/local_audio_track.rs b/livekit/src/room/track/local_audio_track.rs index e55c3d6..2a4aa14 100644 --- a/livekit/src/room/track/local_audio_track.rs +++ b/livekit/src/room/track/local_audio_track.rs @@ -1,9 +1,9 @@ use super::TrackInner; use crate::options::AudioCaptureOptions; use crate::prelude::*; -use crate::proto; use crate::rtc_engine::lk_runtime::LkRuntime; use crate::webrtc::peer_connection_factory::native::PeerConnectionFactoryExt; +use livekit_protocol as proto; use livekit_webrtc as rtc; use parking_lot::Mutex; use rtc::audio_source::native::NativeAudioSource; diff --git a/livekit/src/room/track/local_video_track.rs b/livekit/src/room/track/local_video_track.rs index 2a427a3..349697d 100644 --- a/livekit/src/room/track/local_video_track.rs +++ b/livekit/src/room/track/local_video_track.rs @@ -1,7 +1,7 @@ use super::TrackInner; -use crate::proto; use crate::rtc_engine::lk_runtime::LkRuntime; use crate::{options::VideoCaptureOptions, prelude::*}; +use livekit_protocol as proto; use livekit_webrtc as rtc; use livekit_webrtc::peer_connection_factory::native::PeerConnectionFactoryExt; use parking_lot::Mutex; diff --git a/livekit/src/room/track/mod.rs b/livekit/src/room/track/mod.rs index 2df12ff..f305692 100644 --- a/livekit/src/room/track/mod.rs +++ b/livekit/src/room/track/mod.rs @@ -1,7 +1,7 @@ use crate::prelude::*; -use crate::proto; -use livekit_utils::enum_dispatch; -use livekit_utils::observer::Dispatcher; +use livekit_protocol as proto; +use livekit_protocol::enum_dispatch; +use livekit_protocol::observer::Dispatcher; use livekit_webrtc as rtc; use parking_lot::Mutex; use rtc::MediaType; diff --git a/livekit/src/room/track/remote_audio_track.rs b/livekit/src/room/track/remote_audio_track.rs index 5b76030..b1d5715 100644 --- a/livekit/src/room/track/remote_audio_track.rs +++ b/livekit/src/room/track/remote_audio_track.rs @@ -1,6 +1,6 @@ use super::TrackInner; use crate::prelude::*; -use crate::proto; +use livekit_protocol as proto; use livekit_webrtc as rtc; use std::sync::Arc; use tokio::sync::mpsc; diff --git a/livekit/src/room/track/remote_video_track.rs b/livekit/src/room/track/remote_video_track.rs index cfaecf1..f9369b1 100644 --- a/livekit/src/room/track/remote_video_track.rs +++ b/livekit/src/room/track/remote_video_track.rs @@ -1,6 +1,6 @@ use super::TrackInner; use crate::prelude::*; -use crate::proto; +use livekit_protocol as proto; use livekit_webrtc as rtc; use std::sync::Arc; use tokio::sync::mpsc; diff --git a/livekit/src/rtc_engine/mod.rs b/livekit/src/rtc_engine/mod.rs index b28e53b..4335251 100644 --- a/livekit/src/rtc_engine/mod.rs +++ b/livekit/src/rtc_engine/mod.rs @@ -1,14 +1,14 @@ use crate::options::TrackPublishOptions; use crate::prelude::LocalTrack; -use crate::proto; use crate::rtc_engine::lk_runtime::LkRuntime; use crate::rtc_engine::rtc_session::{RtcSession, SessionEvent, SessionEvents, SessionInfo}; use crate::signal_client::{SignalError, SignalOptions}; +use livekit_protocol as proto; use livekit_webrtc::prelude::*; use livekit_webrtc::session_description::SdpParseError; use parking_lot::Mutex; use std::sync::atomic::{AtomicBool, Ordering}; -use std::sync::{Arc, Weak}; +use std::sync::Arc; use std::time::Duration; use thiserror::Error; use tokio::sync::RwLock as AsyncRwLock; diff --git a/livekit/src/rtc_engine/peer_transport.rs b/livekit/src/rtc_engine/peer_transport.rs index 930d799..176a9eb 100644 --- a/livekit/src/rtc_engine/peer_transport.rs +++ b/livekit/src/rtc_engine/peer_transport.rs @@ -1,8 +1,8 @@ -use crate::proto; +use livekit_protocol as proto; use livekit_webrtc::prelude::*; use std::fmt::{Debug, Formatter}; use std::time::Duration; -use tracing::{debug, event, Level}; +use tracing::{event, Level}; const NEGOTIATION_FREQUENCY: Duration = Duration::from_millis(150); diff --git a/livekit/src/rtc_engine/rtc_events.rs b/livekit/src/rtc_engine/rtc_events.rs index e0630f7..0a4d3d7 100644 --- a/livekit/src/rtc_engine/rtc_events.rs +++ b/livekit/src/rtc_engine/rtc_events.rs @@ -1,6 +1,6 @@ use super::peer_transport::PeerTransport; -use crate::proto; use crate::rtc_engine::peer_transport::OnOfferCreated; +use livekit_protocol as proto; use livekit_webrtc::{self as rtc, prelude::*}; use tokio::sync::mpsc; use tracing::{debug, error}; diff --git a/livekit/src/rtc_engine/rtc_session.rs b/livekit/src/rtc_engine/rtc_session.rs index f742fd9..a3b6917 100644 --- a/livekit/src/rtc_engine/rtc_session.rs +++ b/livekit/src/rtc_engine/rtc_session.rs @@ -4,9 +4,10 @@ use crate::prelude::TrackKind; use crate::rtc_engine::lk_runtime::LkRuntime; use crate::rtc_engine::peer_transport::PeerTransport; use crate::rtc_engine::rtc_events::{RtcEvent, RtcEvents}; +use crate::signal_client; use crate::signal_client::{SignalClient, SignalEvent, SignalEvents, SignalOptions}; use crate::track::LocalTrack; -use crate::{proto, signal_client}; +use livekit_protocol as proto; use livekit_webrtc::prelude::*; use parking_lot::Mutex; use prost::Message; @@ -157,7 +158,21 @@ impl RtcSession { debug!("received JoinResponse: {:?}", join_response); let (rtc_emitter, rtc_events) = mpsc::unbounded_channel(); - let rtc_config = RtcConfiguration::from(join_response.clone()); + let rtc_config = RtcConfiguration { + ice_servers: { + let mut servers = vec![]; + for ice_server in join_response.ice_servers.clone() { + servers.push(IceServer { + urls: ice_server.urls, + username: ice_server.username, + password: ice_server.credential, + }) + } + servers + }, + continual_gathering_policy: ContinualGatheringPolicy::GatherContinually, + ice_transport_type: IceTransportsType::All, + }; let mut publisher_pc = PeerTransport::new( lk_runtime diff --git a/livekit/src/signal_client/mod.rs b/livekit/src/signal_client/mod.rs index 6e03b02..5ac3804 100644 --- a/livekit/src/signal_client/mod.rs +++ b/livekit/src/signal_client/mod.rs @@ -1,5 +1,5 @@ -use crate::proto; use crate::signal_client::signal_stream::SignalStream; +use livekit_protocol as proto; use livekit_webrtc::prelude::*; use parking_lot::RwLock; use std::fmt::Debug; @@ -114,29 +114,9 @@ impl SignalClient { } } -impl From for RtcConfiguration { - fn from(join_response: proto::JoinResponse) -> Self { - Self { - ice_servers: { - let mut servers = vec![]; - for ice_server in join_response.ice_servers.clone() { - servers.push(IceServer { - urls: ice_server.urls, - username: ice_server.username, - password: ice_server.credential, - }) - } - servers - }, - continual_gathering_policy: ContinualGatheringPolicy::GatherContinually, - ice_transport_type: IceTransportsType::All, - } - } -} - pub mod utils { - use crate::proto::{signal_response, JoinResponse}; use crate::signal_client::{SignalError, SignalEvent, SignalResult, JOIN_RESPONSE_TIMEOUT}; + use livekit_protocol as proto; use tokio::time::timeout; use tokio_tungstenite::tungstenite::Error as WsError; use tracing::{event, instrument, Level}; @@ -146,11 +126,13 @@ pub mod utils { #[instrument(level = Level::DEBUG, skip(receiver))] pub(crate) async fn next_join_response( receiver: &mut SignalEvents, - ) -> SignalResult { + ) -> SignalResult { let join = async { while let Some(event) = receiver.recv().await { match event { - SignalEvent::Signal(signal_response::Message::Join(join)) => return Ok(join), + SignalEvent::Signal(proto::signal_response::Message::Join(join)) => { + return Ok(join) + } SignalEvent::Close => break, SignalEvent::Open => continue, _ => { diff --git a/livekit/src/signal_client/signal_stream.rs b/livekit/src/signal_client/signal_stream.rs index ccfef98..2877e3e 100644 --- a/livekit/src/signal_client/signal_stream.rs +++ b/livekit/src/signal_client/signal_stream.rs @@ -1,7 +1,7 @@ -use crate::proto; use crate::signal_client::{SignalEmitter, SignalEvent, SignalOptions, SignalResult}; use futures_util::stream::{SplitSink, SplitStream}; use futures_util::{SinkExt, StreamExt}; +use livekit_protocol as proto; use prost::Message as ProstMessage; use tokio::net::TcpStream; use tokio::sync::{mpsc, oneshot}; diff --git a/webrtc-sys/NOTICE b/webrtc-sys/NOTICE deleted file mode 100644 index 93c517c..0000000 --- a/webrtc-sys/NOTICE +++ /dev/null @@ -1,209 +0,0 @@ -The build system and the bindings are inspired by arcas-io (https://github.com/arcas-io) -The Android build system is inspired by shiguredo (https://github.com/shiguredo/sora-cpp-sdk) - -** littlebearlabs/arcas-io MIT License "" -MIT License - -Copyright (c) 2022 arcas-io - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. -Footer - -** Shiguredo Apache 2.0 License ** -Sora C++ SDK - -Copyright 2021-2022, Wandbox LLC (Original Author) - -Copyright 2021-2022, Shiguredo Inc. - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/webrtc-sys/NOTICE.md b/webrtc-sys/NOTICE.md new file mode 100644 index 0000000..7c6f836 --- /dev/null +++ b/webrtc-sys/NOTICE.md @@ -0,0 +1,426 @@ +## webrtc patches APACHE 2.0 License +License of some patches we use to build webrtc +``` +Copyright 2019-2022, Wandbox LLC (Original Author) +Copyright 2019-2022, tnoho (Original Author) +Copyright 2019-2022, Shiguredo Inc. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +``` +## littlebearlabs/arcas-io MIT License +The build system and the bindings are inspired by arcas-io (https://github.com/arcas-io) +``` +MIT License + +Copyright (c) 2022 arcas-io + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +Footer +``` +## Shiguredo Apache 2.0 License +The Android build system is inspired by Shiguredo sora-cpp-sdk. +``` +Sora C++ SDK + +Copyright 2021-2022, Wandbox LLC (Original Author) + +Copyright 2021-2022, Shiguredo Inc. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS +``` + +## webrtc build scripts APACHE 2.0 License +The webrtc builds scripts are inspired by Unity-Technologies com.unity.webrtc +``` +com.unity.webrtc copyright © 2022 Unity Technologies ApS + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + --- + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS +``` diff --git a/webrtc-sys/build.rs b/webrtc-sys/build.rs index 7cae89c..2baacd6 100644 --- a/webrtc-sys/build.rs +++ b/webrtc-sys/build.rs @@ -189,6 +189,7 @@ fn main() { //.define("WEBRTC_ENABLE_SYMBOL_EXPORT", None) Not necessary when using WebRTC as a static library .define("NOMINMAX", None); } + "linux" => {} "macos" => { println!("cargo:rustc-link-lib=framework=Foundation"); println!("cargo:rustc-link-lib=framework=AVFoundation"); diff --git a/webrtc-sys/libwebrtc/.gitignore b/webrtc-sys/libwebrtc/.gitignore index 2ec6974..367edf1 100644 --- a/webrtc-sys/libwebrtc/.gitignore +++ b/webrtc-sys/libwebrtc/.gitignore @@ -1,3 +1,8 @@ .cipd src .gclient_* +depot_tools + +# builds +macos +linux diff --git a/webrtc-sys/libwebrtc/build_linux.sh b/webrtc-sys/libwebrtc/build_linux.sh new file mode 100755 index 0000000..2192803 --- /dev/null +++ b/webrtc-sys/libwebrtc/build_linux.sh @@ -0,0 +1,77 @@ +#!/bin/bash + +if [ ! -e "$(pwd)/depot_tools" ] +then + git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git +fi + +export COMMAND_DIR=$(cd $(dirname $0); pwd) +export PATH="$(pwd)/depot_tools:$PATH" +export OUTPUT_DIR="$(pwd)/src/out" +export ARTIFACTS_DIR="$(pwd)/linux" + +if [ ! -e "$(pwd)/src" ] +then + gclient sync +fi + +cd src +git apply "$COMMAND_DIR/patches/add_license_dav1d.patch" -v +git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v +git apply "$COMMAND_DIR/patches/fix_mocks.patch" -v +cd .. + +mkdir -p "$ARTIFACTS_DIR/lib" + +for is_debug in "true" "false" +do + for target_cpu in "x64" "arm64" + do + args="is_debug=${is_debug} \ + target_os=\"linux\" \ + target_cpu=\"${target_cpu}\" \ + rtc_enable_protobuf=false \ + treat_warnings_as_errors=false \ + use_custom_libcxx=false \ + rtc_include_tests=false \ + rtc_build_tools=false \ + rtc_build_examples=false \ + rtc_libvpx_build_vp9=true \ + is_component_build=false \ + enable_stripping=true \ + use_goma=false \ + rtc_use_h264=false \ + rtc_use_pipewire=false \ + symbol_level=0 \ + enable_iterator_debugging=false \ + use_rtti=true \ + rtc_use_x11=false" + + if [ $is_debug = "true" ]; then + args="${args} is_asan=true is_lsan=true"; + fi + + # generate ninja files + gn gen "$OUTPUT_DIR" --root="src" --args="${args}" + + # build static library + ninja -C "$OUTPUT_DIR" webrtc + + filename="libwebrtc.a" + if [ $is_debug = "true" ]; then + filename="libwebrtcd.a" + fi + + # cppy static library + mkdir -p "$ARTIFACTS_DIR/lib/${target_cpu}" + cp "$OUTPUT_DIR/obj/libwebrtc.a" "$ARTIFACTS_DIR/lib/${target_cpu}/${filename}" + done +done + +python3 "./src/tools_webrtc/libs/generate_licenses.py" \ + --target :webrtc "$OUTPUT_DIR" "$OUTPUT_DIR" + +cd src +find . -name "*.h" -print | cpio -pd "$ARTIFACTS_DIR/include" + +cp "$OUTPUT_DIR/LICENSE.md" "$ARTIFACTS_DIR" diff --git a/webrtc-sys/libwebrtc/build_macos.sh b/webrtc-sys/libwebrtc/build_macos.sh new file mode 100755 index 0000000..ca18e98 --- /dev/null +++ b/webrtc-sys/libwebrtc/build_macos.sh @@ -0,0 +1,75 @@ +#!/bin/bash -eu + +if [ ! -e "$(pwd)/depot_tools" ] +then + git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git +fi + +export COMMAND_DIR=$(cd $(dirname $0); pwd) +export PATH="$(pwd)/depot_tools:$PATH" +export OUTPUT_DIR="$(pwd)/src/out" +export ARTIFACTS_DIR="$(pwd)/macos" + +if [ ! -e "$(pwd)/src" ] +then + gclient sync +fi + +cd src +git apply "$COMMAND_DIR/patches/add_license_dav1d.patch" -v +git apply "$COMMAND_DIR/patches/ssl_verify_callback_with_native_handle.patch" -v +git apply "$COMMAND_DIR/patches/fix_mocks.patch" -v +cd .. + +mkdir -p "$ARTIFACTS_DIR/lib" + +for is_debug in "true" "false" +do + for target_cpu in "x64" "arm64" + do + + # generate ninja files + gn gen "$OUTPUT_DIR" --root="src" \ + --args="is_debug=${is_debug} \ + enable_dsyms=${is_debug} \ + target_os=\"mac\" \ + target_cpu=\"${target_cpu}\" \ + mac_deployment_target=\"10.11\" \ + treat_warnings_as_errors=false \ + rtc_enable_protobuf=false \ + rtc_include_tests=false \ + rtc_build_examples=false \ + rtc_build_tools=false \ + rtc_libvpx_build_vp9=true \ + is_component_build=false \ + enable_stripping=true \ + use_goma=false \ + rtc_use_h264=false \ + rtc_enable_symbol_export=true \ + rtc_enable_objc_symbol_export=false \ + clang_use_chrome_plugins=false \ + symbol_level=0 \ + enable_iterator_debugging=false \ + use_rtti=true" + + # build static library + ninja -C "$OUTPUT_DIR" webrtc + + filename="libwebrtc.a" + if [ $is_debug = "true" ]; then + filename="libwebrtcd.a" + fi + + # cppy static library + mkdir -p "$ARTIFACTS_DIR/lib/${target_cpu}" + cp "$OUTPUT_DIR/obj/libwebrtc.a" "$ARTIFACTS_DIR/lib/${target_cpu}/${filename}" + done +done + +python3 "./src/tools_webrtc/libs/generate_licenses.py" \ + --target :webrtc "$OUTPUT_DIR" "$OUTPUT_DIR" + +cd src +find . -name "*.h" -print | cpio -pd "$ARTIFACTS_DIR/include" + +cp "$OUTPUT_DIR/LICENSE.md" "$ARTIFACTS_DIR" diff --git a/webrtc-sys/libwebrtc/build_windows.cmd b/webrtc-sys/libwebrtc/build_windows.cmd new file mode 100644 index 0000000..81be5c8 --- /dev/null +++ b/webrtc-sys/libwebrtc/build_windows.cmd @@ -0,0 +1,63 @@ +@echo off + +if not exist depot_tools ( + git clone --depth 1 https://chromium.googlesource.com/chromium/tools/depot_tools.git +) + +set COMMAND_DIR=%~dp0 +set PATH=%cd%\depot_tools;%PATH% +set DEPOT_TOOLS_WIN_TOOLCHAIN=0 +set GYP_GENERATORS=ninja,msvs-ninja +set GYP_MSVS_VERSION=2019 +set OUTPUT_DIR=src/out +set ARTIFACTS_DIR=%cd%\windows +set vs2019_install=C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional + +if not exist src ( + call gclient.bat sync +) + +cd src +call git apply "%COMMAND_DIR%/patches/add_license_dav1d.patch" -v +call git apply "%COMMAND_DIR%/patches/ssl_verify_callback_with_native_handle.patch" -v +call git apply "%COMMAND_DIR%/patches/fix_mocks.patch" -v +cd .. + +mkdir "%ARTIFACTS_DIR%\lib" + +setlocal enabledelayedexpansion + +for %%i in (x64 arm64) do ( + mkdir "%ARTIFACTS_DIR%/lib/%%i" + for %%j in (true false) do ( + + rem generate ninja for release + call gn.bat gen %OUTPUT_DIR% --root="src" ^ + --args="is_debug=%%j is_clang=true target_cpu=\"%%i\" use_custom_libcxx=false rtc_include_tests=false rtc_build_examples=false rtc_use_h264=false symbol_level=0 enable_iterator_debugging=false" + + rem build + ninja.exe -C %OUTPUT_DIR% webrtc + + set filename= + if true==%%j ( + set filename=webrtcd.lib + ) else ( + set filename=webrtc.lib + ) + + rem copy static library for release build + copy "%OUTPUT_DIR%\obj\webrtc.lib" "%ARTIFACTS_DIR%\lib\%%i\!filename!" + ) +) + +endlocal + +rem generate license +call python3 "%cd%\src\tools_webrtc\libs\generate_licenses.py" ^ + --target :webrtc %OUTPUT_DIR% %OUTPUT_DIR% + +rem copy header +xcopy src\*.h "%ARTIFACTS_DIR%\include" /C /S /I /F /H + +rem copy license +copy "%OUTPUT_DIR%\LICENSE.md" "%ARTIFACTS_DIR%\LICENSE.md" diff --git a/webrtc-sys/libwebrtc/patches/add_license_dav1d.patch b/webrtc-sys/libwebrtc/patches/add_license_dav1d.patch new file mode 100644 index 0000000..5f9de23 --- /dev/null +++ b/webrtc-sys/libwebrtc/patches/add_license_dav1d.patch @@ -0,0 +1,17 @@ +diff --git a/tools_webrtc/libs/generate_licenses.py b/tools_webrtc/libs/generate_licenses.py +index 86b4cd01f0..cf927670ee 100755 +--- a/tools_webrtc/libs/generate_licenses.py ++++ b/tools_webrtc/libs/generate_licenses.py +@@ -91,6 +91,12 @@ LIB_TO_LICENSES_DICT = { + 'yasm': [], + 'ow2_asm': [], + 'jdk': [], ++ ++ 'dav1d': ['third_party/dav1d/LICENSE'], ++ 'catapult': [], ++ 'google_benchmark': [], ++ 'googletest': [], ++ 'vinn': [], + } + + # Third_party library _regex_ to licences mapping. Keys are regular expression diff --git a/webrtc-sys/libwebrtc/patches/fix_mocks.patch b/webrtc-sys/libwebrtc/patches/fix_mocks.patch new file mode 100644 index 0000000..6659771 --- /dev/null +++ b/webrtc-sys/libwebrtc/patches/fix_mocks.patch @@ -0,0 +1,25 @@ +diff --git a/modules/audio_device/include/mock_audio_device.h b/modules/audio_device/include/mock_audio_device.h +index 8483aa3da8..f66cdca0ba 100644 +--- a/modules/audio_device/include/mock_audio_device.h ++++ b/modules/audio_device/include/mock_audio_device.h +@@ -149,6 +149,7 @@ class MockAudioDeviceModule : public AudioDeviceModule { + (AudioParameters * params), + (const, override)); + #endif // WEBRTC_IOS ++ MOCK_METHOD(int32_t, SetAudioDeviceSink, (AudioDeviceSink* sink), (const, override)); + }; + } // namespace test + } // namespace webrtc +diff --git a/pc/test/fake_audio_capture_module.h b/pc/test/fake_audio_capture_module.h +index fd13a85f89..81bdbf9f8c 100644 +--- a/pc/test/fake_audio_capture_module.h ++++ b/pc/test/fake_audio_capture_module.h +@@ -140,6 +140,8 @@ class FakeAudioCaptureModule : public webrtc::AudioDeviceModule, + int32_t EnableBuiltInNS(bool enable) override { return -1; } + + int32_t GetPlayoutUnderrunCount() const override { return -1; } ++ ++ int32_t SetAudioDeviceSink(webrtc::AudioDeviceSink* sink) const override { return 0; } + #if defined(WEBRTC_IOS) + int GetPlayoutAudioParameters( + webrtc::AudioParameters* params) const override { diff --git a/webrtc-sys/libwebrtc/patches/ssl_verify_callback_with_native_handle.patch b/webrtc-sys/libwebrtc/patches/ssl_verify_callback_with_native_handle.patch new file mode 100644 index 0000000..ccfb138 --- /dev/null +++ b/webrtc-sys/libwebrtc/patches/ssl_verify_callback_with_native_handle.patch @@ -0,0 +1,76 @@ +diff --git a/rtc_base/boringssl_certificate.cc b/rtc_base/boringssl_certificate.cc +index 99b2ab3e24..c37d6d963f 100644 +--- a/rtc_base/boringssl_certificate.cc ++++ b/rtc_base/boringssl_certificate.cc +@@ -253,6 +253,12 @@ BoringSSLCertificate::BoringSSLCertificate( + RTC_DCHECK(cert_buffer_ != nullptr); + } + ++BoringSSLCertificate::BoringSSLCertificate( ++ bssl::UniquePtr cert_buffer, SSL* ssl) ++ : cert_buffer_(std::move(cert_buffer)), ssl_(ssl) { ++ RTC_DCHECK(cert_buffer_ != nullptr); ++} ++ + std::unique_ptr BoringSSLCertificate::Generate( + OpenSSLKeyPair* key_pair, + const SSLIdentityParams& params) { +diff --git a/rtc_base/boringssl_certificate.h b/rtc_base/boringssl_certificate.h +index 8b4577a17c..e1fe26cba5 100644 +--- a/rtc_base/boringssl_certificate.h ++++ b/rtc_base/boringssl_certificate.h +@@ -33,6 +33,7 @@ class OpenSSLKeyPair; + class BoringSSLCertificate final : public SSLCertificate { + public: + explicit BoringSSLCertificate(bssl::UniquePtr cert_buffer); ++ BoringSSLCertificate(bssl::UniquePtr cert_buffer, SSL* ssl); + + static std::unique_ptr Generate( + OpenSSLKeyPair* key_pair, +@@ -74,6 +75,11 @@ class BoringSSLCertificate final : public SSLCertificate { + private: + // A handle to the DER encoded certificate data. + bssl::UniquePtr cert_buffer_; ++ ++ private: ++ SSL* ssl_ = nullptr; ++ public: ++ SSL* ssl() const { return ssl_; } + }; + + } // namespace rtc +diff --git a/rtc_base/openssl_adapter.cc b/rtc_base/openssl_adapter.cc +index bc10e619eb..836ef9ea18 100644 +--- a/rtc_base/openssl_adapter.cc ++++ b/rtc_base/openssl_adapter.cc +@@ -822,7 +822,7 @@ enum ssl_verify_result_t OpenSSLAdapter::SSLVerifyInternal(SSL* ssl, + return ssl_verify_invalid; + } + +- BoringSSLCertificate cert(bssl::UpRef(sk_CRYPTO_BUFFER_value(chain, 0))); ++ BoringSSLCertificate cert(bssl::UpRef(sk_CRYPTO_BUFFER_value(chain, 0)), ssl); + if (!ssl_cert_verifier_->Verify(cert)) { + RTC_LOG(LS_WARNING) << "Failed to verify certificate using custom callback"; + return ssl_verify_invalid; +@@ -894,7 +894,7 @@ int OpenSSLAdapter::SSLVerifyInternal(int previous_status, + RTC_LOG(LS_ERROR) << "Failed to allocate CRYPTO_BUFFER."; + return previous_status; + } +- const BoringSSLCertificate cert(std::move(crypto_buffer)); ++ const BoringSSLCertificate cert(std::move(crypto_buffer), ssl); + #else + const OpenSSLCertificate cert(X509_STORE_CTX_get_current_cert(store)); + #endif +diff --git a/rtc_base/openssl_stream_adapter.cc b/rtc_base/openssl_stream_adapter.cc +index dd82e4f061..6d7e39c534 100644 +--- a/rtc_base/openssl_stream_adapter.cc ++++ b/rtc_base/openssl_stream_adapter.cc +@@ -1154,7 +1154,7 @@ enum ssl_verify_result_t OpenSSLStreamAdapter::SSLVerifyCallback( + // Creates certificate chain. + std::vector> cert_chain; + for (CRYPTO_BUFFER* cert : chain) { +- cert_chain.emplace_back(new BoringSSLCertificate(bssl::UpRef(cert))); ++ cert_chain.emplace_back(new BoringSSLCertificate(bssl::UpRef(cert), ssl)); + } + stream->peer_cert_chain_.reset(new SSLCertChain(std::move(cert_chain))); +