diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..d1ea4262 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,13 @@ +[target.x86_64-unknown-linux-musl] +rustflags = ["-C", "link-args=-lm"] + +[target.aarch64-unknown-linux-musl] +rustflags = ["-C", "link-args=-std=c99 -lm"] + +[target.armv7-unknown-linux-musleabihf] +rustflags = ["-C", "link-args=-lm"] + +[target.arm-unknown-linux-musleabihf] +rustflags = ["-C", "link-args=-lm"] + + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..42e41266 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,292 @@ +name: Build/publish release + +#on: [push, pull_request] +on: + push: + # Pattern matched against refs/tags + tags: + - "*" # Push events to every tag not containing / + +jobs: + # cargo publish libraries and xiu to crates.io + publish: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: Replace Online Manifest file + run: make online + + - name: Install Cargo-workspace + uses: baptiste0928/cargo-install@v3 + with: + crate: cargo-workspaces + version: "^0.3.1" # You can specify any semver range + + - name: Run cargo workspace publish + run: cargo workspaces publish --from-git --no-git-push --no-git-tag --no-global-tag --allow-dirty --token ${{ secrets.CARGO_REGISTRY_TOKEN }} + + # release on github including writing release note and build binaries on different os and upload + release: + name: Binary ${{ matrix.target }} (on ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + needs: publish + outputs: + version: ${{ steps.extract_version.outputs.version }} + strategy: + matrix: + include: + # supported + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + compress: true + cargo_flags: "" + + # supported + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + compress: true + cargo_flags: "" + + #- os: ubuntu-latest + # target: aarch64-unknown-linux-musl + # compress: true + # cargo_flags: "" + + # supported + - os: ubuntu-latest + target: aarch64-unknown-linux-gnu + compress: true + cargo_flags: "" + + #- os: ubuntu-latest + # target: armv7-unknown-linux-musleabihf + # compress: true + # cargo_flags: "" + + # supported + - os: ubuntu-latest + target: armv7-unknown-linux-gnueabihf + compress: true + cargo_flags: "" + + #- os: ubuntu-latest + # target: arm-unknown-linux-musleabihf + # compress: true + # cargo_flags: "" + + ##- os: ubuntu-latest + ## target: riscv64gc-unknown-linux-gnu + ## compress: false + ## cargo_flags: "--no-default-features" + + # supported + - os: windows-latest + target: x86_64-pc-windows-msvc + compress: true + cargo_flags: "" + + # supported + - os: windows-latest + target: i686-pc-windows-msvc + compress: true + cargo_flags: "" + + # supported + - os: macos-latest + target: x86_64-apple-darwin + compress: true + cargo_flags: "" + + ## - os: macos-latest + ## target: aarch64-apple-darwin + ## compress: false + ## cargo_flags: "" + + # supported + - os: ubuntu-latest + target: x86_64-unknown-freebsd + compress: false + cargo_flags: "" + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Rust toolchain + uses: dtolnay/rust-toolchain@stable + + - run: sudo apt install musl-tools pkg-config libssl-dev gcc-multilib + if: startsWith(matrix.os, 'ubuntu') + + - name: Set up project + run: | + export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/lib/x86_64-linux-gnu/pkgconfig/ + echo $PKG_CONFIG_PATH + find /usr/lib -name openssl.pc + #cat /usr/lib/x86_64-linux-gnu/pkgconfig/openssl.pc + #dpkg -l | grep openssl + + #/usr/lib/x86_64-linux-gnu/pkgconfig/openssl.pc + if: startsWith(matrix.os, 'ubuntu') + + - name: cargo build + uses: houseabsolute/actions-rust-cross@v0 + with: + command: build + working-directory: ./application/xiu + args: --release --locked ${{ matrix.cargo_flags }} + target: ${{ matrix.target }} + + - name: Set exe extension for Windows + run: echo "EXE=.exe" >> $env:GITHUB_ENV + if: startsWith(matrix.os, 'windows') + + - name: Compress binaries + uses: svenstaro/upx-action@v2 + with: + files: target/${{ matrix.target }}/release/xiu${{ env.EXE }} + args: --best --lzma + strip: false # We're stripping already in Cargo.toml + if: ${{ matrix.compress }} + + - name: Copy Files + if: ${{ !startsWith(matrix.os, 'windows') }} + run: | + echo ${GITHUB_WORKSPACE} + ls -lrth + cp -rf "./application/xiu/src/config/examples" "target/${{ matrix.target }}/release/" + cp -f "./protocol/webrtc/src/clients/index.html" "target/${{ matrix.target }}/release/" + cp -f "./protocol/webrtc/src/clients/whep.js" "target/${{ matrix.target }}/release/" + cp -f "./docker/start.sh" "target/${{ matrix.target }}/release/" + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/xiu${{ env.EXE }} + target/${{ matrix.target }}/release/config/examples + target/${{ matrix.target }}/release/index.html + target/${{ matrix.target }}/release/whep.js + target/${{ matrix.target }}/release/start.sh + + - name: Get version from tag + id: extract_version + run: | + echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" + shell: bash + + - name: Install CHANGELOG parser + uses: taiki-e/install-action@parse-changelog + + - name: Get CHANGELOG entry + run: parse-changelog ./application/xiu/CHANGELOG.md ${{ steps.extract_version.outputs.version }} | tee changelog_entry + if: startsWith(github.ref_name, 'v') && github.ref_type == 'tag' + shell: bash + + - name: Read changelog entry from file + id: changelog_entry + uses: juliangruber/read-file-action@v1 + with: + path: ./changelog_entry + if: startsWith(github.ref_name, 'v') && github.ref_type == 'tag' + + - name: Release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.ACCESS_TOKEN }} + file: target/${{ matrix.target }}/release/xiu${{ env.EXE }} + tag: ${{ github.ref_name }} + asset_name: xiu-${{ steps.extract_version.outputs.version }}-${{ matrix.target }}${{ env.EXE }} + body: ${{ steps.changelog_entry.outputs.content }} + if: startsWith(github.ref_name, 'v') && github.ref_type == 'tag' + + # Build docker images and upload to docker hub + container-images: + name: Publish images + runs-on: ubuntu-latest + needs: release + # Run for tags and pushes to the default branch + if: (startsWith(github.ref_name, 'v') && github.ref_type == 'tag') || github.event.repository.default_branch == github.ref_name + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Download artifact aarch64-unknown-linux-gnu + uses: actions/download-artifact@v3 + with: + name: aarch64-unknown-linux-gnu + path: target/aarch64-unknown-linux-gnu/release + + - name: Download artifact x86_64-unknown-linux-gnu + uses: actions/download-artifact@v3 + with: + name: x86_64-unknown-linux-gnu + path: target/x86_64-unknown-linux-gnu/release + + - name: Download artifact armv7-unknown-linux-gnueabihf + uses: actions/download-artifact@v3 + with: + name: armv7-unknown-linux-gnueabihf + path: target/armv7-unknown-linux-gnueabihf/release + + #- name: Download artifact aarch64-unknown-linux-musl + # uses: actions/download-artifact@v3 + # with: + # name: aarch64-unknown-linux-musl + # path: target/aarch64-unknown-linux-musl/release + + #- name: Download artifact x86_64-unknown-linux-musl + # uses: actions/download-artifact@v3 + # with: + # name: x86_64-unknown-linux-musl + # path: target/x86_64-unknown-linux-musl/release + + #- name: Download artifact armv7-unknown-linux-musleabihf + # uses: actions/download-artifact@v3 + # with: + # name: armv7-unknown-linux-musleabihf + # path: target/armv7-unknown-linux-musleabihf/release + + - name: podman login + run: podman login --username ${{ secrets.DOCKERHUB_USERNAME }} --password ${{ secrets.DOCKERHUB_TOKEN }} docker.io + + - name: podman build linux/arm64 + run: ls -lrth target/aarch64-unknown-linux-gnu/release/ && podman build --format docker --platform linux/arm64/v8 --manifest xiu -f ./docker/Dockerfile target/aarch64-unknown-linux-gnu/release + + - name: podman build linux/amd64 + run: podman build --format docker --platform linux/amd64 --manifest xiu -f ./docker/Dockerfile target/x86_64-unknown-linux-gnu/release + + - name: podman build linux/arm + run: podman build --format docker --platform linux/arm/v7 --manifest xiu -f ./docker/Dockerfile target/armv7-unknown-linux-gnueabihf/release + + - name: podman manifest push latest + run: podman manifest push xiu docker.io/harlancn/xiu:latest + + - name: podman manifest push tag version + run: podman manifest push xiu docker.io/harlancn/xiu:${{ needs.publish.outputs.version }} + if: startsWith(github.ref_name, 'v') + + #- name: podman build linux/arm64 (alpine edition) + # run: podman build --format docker --platform linux/arm64/v8 --manifest myexe-alpine -f Containerfile.alpine target/aarch64-unknown-linux-musl/release + + #- name: podman build linux/amd64 (alpine edition) + # run: podman build --format docker --platform linux/amd64 --manifest myexe-alpine -f Containerfile.alpine target/x86_64-unknown-linux-musl/release + + #- name: podman build linux/arm (alpine edition) + # run: podman build --format docker --platform linux/arm/v7 --manifest myexe-alpine -f Containerfile.alpine target/armv7-unknown-linux-musleabihf/release + + #- name: podman manifest push latest (alpine edition) + # run: podman manifest push myexe-alpine docker.io/harlancn/myexe:alpine + + #- name: podman manifest push tag version (alpine edition) + # run: podman manifest push myexe-alpine docker.io/harlancn/myexe:${{ needs.publish.outputs.version }}-alpine + # if: startsWith(github.ref_name, 'v') diff --git a/Cargo.lock b/Cargo.lock index a63eb4d6..b5df3002 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,25 +17,6 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" -[[package]] -name = "aead" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fc95d1bdb8e6666b2b217308eeeb09f2d6728d104be3e31916cc74d15420331" -dependencies = [ - "generic-array", -] - -[[package]] -name = "aead" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" -dependencies = [ - "generic-array", - "rand_core 0.6.4", -] - [[package]] name = "aead" version = "0.5.2" @@ -46,37 +27,14 @@ dependencies = [ "generic-array", ] -[[package]] -name = "aes" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" -dependencies = [ - "aes-soft", - "aesni", - "cipher 0.2.5", -] - -[[package]] -name = "aes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if 1.0.0", - "cipher 0.3.0", - "cpufeatures", - "opaque-debug", -] - [[package]] name = "aes" version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ac1f845298e95f983ff1944b728ae08b8cebab80d684f0a832ed0fc74dfa27e2" dependencies = [ - "cfg-if 1.0.0", - "cipher 0.4.4", + "cfg-if", + "cipher", "cpufeatures", ] @@ -86,34 +44,14 @@ version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "831010a0f742e1209b3bcea8fab6a8e149051ba6099432c8cb2cc117dec3ead1" dependencies = [ - "aead 0.5.2", - "aes 0.8.3", - "cipher 0.4.4", - "ctr 0.9.2", + "aead", + "aes", + "cipher", + "ctr", "ghash", "subtle", ] -[[package]] -name = "aes-soft" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" -dependencies = [ - "cipher 0.2.5", - "opaque-debug", -] - -[[package]] -name = "aesni" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" -dependencies = [ - "cipher 0.2.5", - "opaque-debug", -] - [[package]] name = "aho-corasick" version = "1.1.2" @@ -144,29 +82,13 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bddcadddf5e9015d310179a59bb28c4d4b9920ad0f11e8e14dbadf654890c9a6" -[[package]] -name = "asn1-rs" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ff05a702273012438132f449575dbc804e27b2f3cbe3069aa237d26c98fa33" -dependencies = [ - "asn1-rs-derive 0.1.0", - "asn1-rs-impl", - "displaydoc", - "nom", - "num-traits", - "rusticata-macros", - "thiserror", - "time 0.3.30", -] - [[package]] name = "asn1-rs" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f6fd5ddaf0351dff5b8da21b2fb4ff8e08ddd02857f0bf69c47639106c0fff0" dependencies = [ - "asn1-rs-derive 0.4.0", + "asn1-rs-derive", "asn1-rs-impl", "displaydoc", "nom", @@ -176,18 +98,6 @@ dependencies = [ "time 0.3.30", ] -[[package]] -name = "asn1-rs-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8b7511298d5b7784b40b092d9e9dcd3a627a5707e4b5e507931ab0d44eeebf" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.103", - "synstructure", -] - [[package]] name = "asn1-rs-derive" version = "0.4.0" @@ -228,6 +138,15 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "audiopus" +version = "0.3.0-rc.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab55eb0e56d7c6de3d59f544e5db122d7725ec33be6a276ee8241f3be6473955" +dependencies = [ + "audiopus_sys", +] + [[package]] name = "audiopus_sys" version = "0.2.2" @@ -358,7 +277,7 @@ checksum = "cab84319d616cfb654d03394f38ab7e6f0919e181b1b57e1fd15e7fb4077d9a7" dependencies = [ "addr2line", "cc", - "cfg-if 1.0.0", + "cfg-if", "libc", "miniz_oxide", "object", @@ -367,15 +286,9 @@ dependencies = [ [[package]] name = "base16ct" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349a06037c7bf932dd7e7d1f653678b2038b9ad46a74102f1fc7bd7872678cce" - -[[package]] -name = "base64" -version = "0.13.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" [[package]] name = "base64" @@ -429,21 +342,14 @@ dependencies = [ ] [[package]] -name = "block-modes" -version = "0.7.0" +name = "block-padding" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" dependencies = [ - "block-padding", - "cipher 0.2.5", + "generic-array", ] -[[package]] -name = "block-padding" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" - [[package]] name = "bumpalo" version = "3.11.1" @@ -497,30 +403,34 @@ dependencies = [ ] [[package]] -name = "cc" -version = "1.0.76" +name = "cbc" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76a284da2e6fe2092f2353e51713435363112dfd60030e22add80be333fb928f" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" dependencies = [ - "jobserver", + "cipher", ] [[package]] -name = "ccm" -version = "0.3.0" +name = "cc" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aca1a8fbc20b50ac9673ff014abfb2b5f4085ee1a850d408f14a159c5853ac7" +checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc" dependencies = [ - "aead 0.3.2", - "cipher 0.2.5", - "subtle", + "libc", ] [[package]] -name = "cfg-if" -version = "0.1.10" +name = "ccm" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" +checksum = "9ae3c82e4355234767756212c570e29833699ab63e6ffd161887314cc5b43847" +dependencies = [ + "aead", + "cipher", + "ctr", + "subtle", +] [[package]] name = "cfg-if" @@ -543,24 +453,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "cipher" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" -dependencies = [ - "generic-array", -] - -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array", -] - [[package]] name = "cipher" version = "0.4.4" @@ -687,9 +579,9 @@ dependencies = [ [[package]] name = "crypto-bigint" -version = "0.4.9" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2b4b23cddf68b89b8f8069890e8c270d54e2d5fe1b143820234805e4cb17ef" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" dependencies = [ "generic-array", "rand_core 0.6.4", @@ -718,35 +610,13 @@ dependencies = [ "subtle", ] -[[package]] -name = "ctr" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" -dependencies = [ - "cipher 0.3.0", -] - [[package]] name = "ctr" version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" dependencies = [ - "cipher 0.4.4", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", + "cipher", ] [[package]] @@ -755,7 +625,7 @@ version = "4.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e89b8c6a2e4b1f45971ad09761aafb85514a84744b67a95e32c3cc1352d1f65c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "curve25519-dalek-derive", "fiat-crypto", @@ -820,41 +690,6 @@ dependencies = [ "syn 1.0.103", ] -[[package]] -name = "darling" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 1.0.103", -] - -[[package]] -name = "darling_macro" -version = "0.14.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" -dependencies = [ - "darling_core", - "quote", - "syn 1.0.103", -] - [[package]] name = "data-encoding" version = "2.4.0" @@ -863,36 +698,22 @@ checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" [[package]] name = "der" -version = "0.6.1" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1a467a65c5e759bce6e65eaf91cc29f466cdc57cb65777bd646872a8a1fd4de" +checksum = "fffa369a668c8af7dbf8b5e56c9f744fbd399949ed171606040001947de40b1c" dependencies = [ "const-oid", "pem-rfc7468", "zeroize", ] -[[package]] -name = "der-parser" -version = "7.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe398ac75057914d7d07307bf67dc7f3f574a26783b4fc7805a20ffa9f506e82" -dependencies = [ - "asn1-rs 0.3.1", - "displaydoc", - "nom", - "num-bigint", - "num-traits", - "rusticata-macros", -] - [[package]] name = "der-parser" version = "8.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dbd676fbbab537128ef0278adb5576cf363cff6aa22a7b24effe97347cfab61e" dependencies = [ - "asn1-rs 0.5.2", + "asn1-rs", "displaydoc", "nom", "num-bigint", @@ -909,37 +730,6 @@ dependencies = [ "powerfmt", ] -[[package]] -name = "derive_builder" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d07adf7be193b71cc36b193d0f5fe60b918a3a9db4dad0449f57bcfd519704a3" -dependencies = [ - "derive_builder_macro", -] - -[[package]] -name = "derive_builder_core" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f91d4cfa921f1c05904dc3c57b4a32c38aed3340cce209f3a6fd1478babafc4" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 1.0.103", -] - -[[package]] -name = "derive_builder_macro" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f0314b72bed045f3a68671b3c86328386762c93f82d98c65c3cb5e5f573dd68" -dependencies = [ - "derive_builder_core", - "syn 1.0.103", -] - [[package]] name = "digest" version = "0.9.0" @@ -956,6 +746,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer 0.10.4", + "const-oid", "crypto-common", "subtle", ] @@ -973,25 +764,26 @@ dependencies = [ [[package]] name = "ecdsa" -version = "0.14.8" +version = "0.16.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "413301934810f597c1d19ca71c8710e99a3f1ba28a0d2ebc01551a2daeea3c5c" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" dependencies = [ "der", + "digest 0.10.7", "elliptic-curve", "rfc6979", "signature", + "spki", ] [[package]] name = "elliptic-curve" -version = "0.12.3" +version = "0.13.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7bb888ab5300a19b8e5bceef25ac745ad065f3c9f7efc6de1b91958110891d3" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" dependencies = [ "base16ct", "crypto-bigint", - "der", "digest 0.10.7", "ff", "generic-array", @@ -1011,7 +803,7 @@ version = "0.8.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1106,9 +898,9 @@ dependencies = [ [[package]] name = "ff" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d013fc25338cc558c5c2cfbad646908fb23591e2404481826742b651c9af7160" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" dependencies = [ "rand_core 0.6.4", "subtle", @@ -1247,32 +1039,22 @@ 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", + "zeroize", ] [[package]] name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.8" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "wasi 0.11.0+wasi-snapshot-preview1", ] @@ -1295,9 +1077,9 @@ checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d" [[package]] name = "group" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfbfb3a6cfbd390d5c9564ab283a0349b9b9fcd46a706c1eb10e0db70bfbac7" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" dependencies = [ "ff", "rand_core 0.6.4", @@ -1418,7 +1200,6 @@ dependencies = [ "commonlib", "failure", "log", - "rtmp 0.4.1", "streamhub 0.1.1", "tokio", "tokio-util 0.6.10", @@ -1543,7 +1324,6 @@ dependencies = [ "failure", "futures", "log", - "rtmp 0.4.1", "streamhub 0.1.1", "tokio", "xflv 0.3.0", @@ -1653,12 +1433,6 @@ dependencies = [ "cxx-build", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.3.0" @@ -1695,6 +1469,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" dependencies = [ + "block-padding", "generic-array", ] @@ -1704,14 +1479,14 @@ version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] name = "interceptor" -version = "0.9.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c142385498b53584546abbfa50188b2677af8e4f879da1ee5d905cb7de5b97a" +checksum = "5b12e186d2a4c21225df6beb8ae5d81817c928da12e7ce78d0953fc74d88b590" dependencies = [ "async-trait", "bytes", @@ -1771,15 +1546,6 @@ dependencies = [ "uuid", ] -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.60" @@ -1832,7 +1598,7 @@ version = "0.4.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", ] [[package]] @@ -1847,7 +1613,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "digest 0.10.7", ] @@ -1859,15 +1625,15 @@ checksum = "490cc448043f947bae3cbee9c203358d62dbee0db12107a74be5c30ccfd09771" [[package]] name = "memchr" -version = "2.5.0" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memoffset" -version = "0.6.5" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" +checksum = "5de893c32cde5f383baa4c04c5d6dbdd735cfd4a794b0debdb2bb1b421da5ff4" dependencies = [ "autocfg", ] @@ -1895,14 +1661,13 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.5" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", - "log", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys 0.42.0", + "windows-sys 0.48.0", ] [[package]] @@ -1925,14 +1690,15 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.3" +version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +checksum = "598beaf3cc6fdd9a5dfb1630c2800c7acd31df7aaf0f565796fba2b53ca1af1b" dependencies = [ "bitflags 1.3.2", - "cfg-if 1.0.0", + "cfg-if", "libc", "memoffset", + "pin-utils", ] [[package]] @@ -1994,22 +1760,13 @@ dependencies = [ "memchr", ] -[[package]] -name = "oid-registry" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38e20717fa0541f39bd146692035c37bedfa532b3e5071b35761082407546b2a" -dependencies = [ - "asn1-rs 0.3.1", -] - [[package]] name = "oid-registry" version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9bedf36ffb6ba96c2eb7144ef6270557b52e54b20c0a8e1eb2ff99a6c6959bff" dependencies = [ - "asn1-rs 0.5.2", + "asn1-rs", ] [[package]] @@ -2031,7 +1788,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "79a4c6c3a2b158f7f8f2a2fc5a969fa3a068df6fc9dbb4a43845436e3af7c800" dependencies = [ "bitflags 2.4.1", - "cfg-if 1.0.0", + "cfg-if", "foreign-types", "libc", "once_cell", @@ -2057,25 +1814,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] -name = "openssl-sys" -version = "0.9.96" +name = "openssl-src" +version = "300.2.3+3.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" +checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843" dependencies = [ "cc", - "libc", - "pkg-config", - "vcpkg", ] [[package]] -name = "opus" -version = "0.3.0" +name = "openssl-sys" +version = "0.9.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6526409b274a7e98e55ff59d96aafd38e6cd34d46b7dbbc32ce126dffcd75e8e" +checksum = "3812c071ba60da8b5677cc12bcb1d42989a65553772897a7e0355545a819838f" dependencies = [ - "audiopus_sys", + "cc", "libc", + "openssl-src", + "pkg-config", + "vcpkg", ] [[package]] @@ -2086,23 +1843,25 @@ checksum = "9b7820b9daea5457c9f21c69448905d723fbd21136ccf521748f23fd49e723ee" [[package]] name = "p256" -version = "0.11.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f44edd08f51e2ade572f141051021c5af22677e42b7dd28a88155151c33594" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" dependencies = [ "ecdsa", "elliptic-curve", + "primeorder", "sha2 0.10.8", ] [[package]] name = "p384" -version = "0.11.2" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc8c5bf642dde52bb9e87c0ecd8ca5a76faac2eeed98dedb7c717997e1080aa" +checksum = "70786f51bcc69f6a4c0360e063a4cac5419ef7c5cd5b3c99ad70f3be5ba79209" dependencies = [ "ecdsa", "elliptic-curve", + "primeorder", "sha2 0.10.8", ] @@ -2122,7 +1881,7 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "libc", "redox_syscall", "smallvec", @@ -2131,18 +1890,19 @@ dependencies = [ [[package]] name = "pem" -version = "1.1.1" +version = "3.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8835c273a76a90455d7344889b0964598e3316e2a79ede8e36f16bdcf2228b8" +checksum = "1b8fcc794035347fb64beda2d3b462595dd2753e3f268d89c5aae77e8cf2c310" dependencies = [ - "base64 0.13.1", + "base64", + "serde", ] [[package]] name = "pem-rfc7468" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d159833a9105500e0398934e205e0773f0b27529557134ecfc51c27646adac" +checksum = "88b39c9bfcfc231068454382784bb460aae594343fb030d46e9f50a645418412" dependencies = [ "base64ct", ] @@ -2175,9 +1935,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" [[package]] name = "pin-utils" @@ -2187,9 +1947,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkcs8" -version = "0.9.0" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eca2c590a5f85da82668fa685c09ce2888b9430e83299debf1f34b65fd4a4ba" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" dependencies = [ "der", "spki", @@ -2213,7 +1973,7 @@ version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "opaque-debug", "universal-hash", @@ -2244,6 +2004,15 @@ version = "0.2.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "proc-macro2" version = "1.0.69" @@ -2321,34 +2090,25 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c33a3c44ca05fa6f1807d8e6743f3824e8509beca625669633be0acbdf509dc" -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", -] - [[package]] name = "rand_core" version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" dependencies = [ - "getrandom 0.2.8", + "getrandom", ] [[package]] name = "rcgen" -version = "0.10.0" +version = "0.11.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffbe84efe2f38dea12e9bfc1f65377fdf03e53a18cb3b995faedf7934c7e785b" +checksum = "52c4f3084aa3bc7dfbba4eff4fab2a54db4324965d8872ab933565e6fbd83bc6" dependencies = [ "pem", - "ring", + "ring 0.16.20", "time 0.3.30", - "x509-parser 0.14.0", + "x509-parser", "yasna", ] @@ -2372,9 +2132,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.9.4" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12de2eff854e5fa4b1295edd650e227e9d8fb0c9e90b12e7f36d6a6811791a29" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", @@ -2384,9 +2144,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.3.7" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49530408a136e16e5b486e883fbb6ba058e8e4e8ae6621a77b048b314336e629" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -2395,17 +2155,17 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.7.5" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" +checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.14" +version = "0.11.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" +checksum = "c6920094eb85afde5e4a138be3f2de8bbdf28000f0029e72c45025a56b042251" dependencies = [ - "base64 0.21.2", + "base64", "bytes", "encoding_rs", "futures-core", @@ -2423,9 +2183,12 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", + "rustls-pemfile", "serde", "serde_json", "serde_urlencoded", + "sync_wrapper", + "system-configuration", "tokio", "tokio-native-tls", "tower-service", @@ -2438,13 +2201,12 @@ dependencies = [ [[package]] name = "rfc6979" -version = "0.3.1" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7743f17af12fa0b03b803ba12cd6a8d9483a587e89c69445e3909655c0b9fabb" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" dependencies = [ - "crypto-bigint", "hmac 0.12.1", - "zeroize", + "subtle", ] [[package]] @@ -2456,17 +2218,32 @@ dependencies = [ "cc", "libc", "once_cell", - "spin", - "untrusted", + "spin 0.5.2", + "untrusted 0.7.1", "web-sys", "winapi", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin 0.9.8", + "untrusted 0.9.0", + "windows-sys 0.52.0", +] + [[package]] name = "rtcp" -version = "0.9.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6423493804221c276d27f3cc383cd5cbe1a1f10f210909fd4951b579b01293cd" +checksum = "33648a781874466a62d89e265fee9f17e32bc7d05a256e6cca41bf97eadcd8aa" dependencies = [ "bytes", "thiserror", @@ -2516,7 +2293,6 @@ dependencies = [ "indexmap 1.9.3", "log", "rand 0.3.23", - "reqwest", "serde", "serde_json", "sha2 0.9.9", @@ -2527,9 +2303,9 @@ dependencies = [ [[package]] name = "rtp" -version = "0.8.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b728adb99b88d932f2f0622b540bf7ccb196f81e9823b5b0eeb166526c88138c" +checksum = "47fca9bd66ae0b1f3f649b8f5003d6176433d7293b78b0fce7e1031816bdd99d" dependencies = [ "bytes", "rand 0.8.5", @@ -2578,15 +2354,33 @@ dependencies = [ [[package]] name = "rustls" -version = "0.19.1" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ - "base64 0.13.1", "log", - "ring", + "ring 0.17.8", + "rustls-webpki", "sct", - "webpki", +] + +[[package]] +name = "rustls-pemfile" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" +dependencies = [ + "base64", +] + +[[package]] +name = "rustls-webpki" +version = "0.101.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" +dependencies = [ + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] @@ -2624,19 +2418,19 @@ checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" [[package]] name = "sct" -version = "0.6.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring", - "untrusted", + "ring 0.17.8", + "untrusted 0.9.0", ] [[package]] name = "sdp" -version = "0.5.3" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d22a5ef407871893fd72b4562ee15e4742269b173959db4b8df6f538c414e13" +checksum = "af90731e1f1150eb1740e35f9832958832a893965b632adc7ad27086077e24c7" dependencies = [ "rand 0.8.5", "substring", @@ -2646,9 +2440,9 @@ dependencies = [ [[package]] name = "sec1" -version = "0.3.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be24c1842290c45df0a7bf069e0c268a747ad05a192f2fd7dcfdbc1cba40928" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" dependencies = [ "base16ct", "der", @@ -2745,7 +2539,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.7", ] @@ -2757,7 +2551,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" dependencies = [ "block-buffer 0.9.0", - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.9.0", "opaque-debug", @@ -2769,7 +2563,7 @@ version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "cpufeatures", "digest 0.10.7", ] @@ -2785,9 +2579,9 @@ dependencies = [ [[package]] name = "signature" -version = "1.6.4" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74233d3b3b2f6d4b006dc19dee745e73e2a6bfb6f93607cd3b02bd5b00797d7c" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" dependencies = [ "digest 0.10.7", "rand_core 0.6.4", @@ -2843,11 +2637,17 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "spki" -version = "0.6.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67cf02bbac7a337dc36e4f5a693db6c21e7863f45070f7064577eb4367a3212b" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", @@ -2903,16 +2703,16 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "stun" -version = "0.4.4" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7e94b1ec00bad60e6410e058b52f1c66de3dc5fe4d62d09b3e52bb7d3b73e25" +checksum = "d3f371788132e9d623e6eab4ba28aac083763a4133f045e6ebaee5ceb869803d" dependencies = [ - "base64 0.13.1", + "base64", "crc", "lazy_static", "md-5", "rand 0.8.5", - "ring", + "ring 0.17.8", "subtle", "thiserror", "tokio", @@ -2975,13 +2775,34 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "system-configuration" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +dependencies = [ + "core-foundation-sys", + "libc", +] + [[package]] name = "tempfile" version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "fastrand", "redox_syscall", "rustix", @@ -3074,33 +2895,32 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.26.0" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ - "autocfg", + "backtrace", "bytes", "libc", - "memchr", "mio", "num_cpus", "parking_lot", "pin-project-lite", "signal-hook-registry", - "socket2 0.4.7", + "socket2 0.5.5", "tokio-macros", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "tokio-macros" -version = "1.8.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9724f9a975fb987ef7a3cd9be0350edcbe130698af5b8f7a631e23d42d052484" +checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 1.0.103", + "syn 2.0.38", ] [[package]] @@ -3225,7 +3045,7 @@ version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "log", "pin-project-lite", "tracing-core", @@ -3248,20 +3068,21 @@ checksum = "59547bce71d9c38b83d9c0e92b6066c4253371f15005def0c30d9657f50c7642" [[package]] name = "turn" -version = "0.6.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4712ee30d123ec7ae26d1e1b218395a16c87cdbaf4b3925d170d684af62ea5e8" +checksum = "ffb2ac4f331064513ad510b7a36edc0df555bd61672986607f7c9ff46f98f415" dependencies = [ "async-trait", - "base64 0.13.1", + "base64", "futures", "log", "md-5", "rand 0.8.5", - "ring", + "ring 0.17.8", "stun", "thiserror", "tokio", + "tokio-util 0.7.4", "webrtc-util", ] @@ -3320,6 +3141,12 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "url" version = "2.3.1" @@ -3337,7 +3164,7 @@ version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" dependencies = [ - "getrandom 0.2.8", + "getrandom", ] [[package]] @@ -3371,12 +3198,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.10.0+wasi-snapshot-preview1" @@ -3395,7 +3216,7 @@ version = "0.2.83" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "wasm-bindgen-macro", ] @@ -3420,7 +3241,7 @@ version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" dependencies = [ - "cfg-if 1.0.0", + "cfg-if", "js-sys", "wasm-bindgen", "web-sys", @@ -3465,26 +3286,16 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring", - "untrusted", -] - [[package]] name = "webrtc" -version = "0.8.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f60dde9fd592872bc371b3842e4616bc4c6984242e3cd2a7d7cb771db278601b" +checksum = "1fbdf025f0fa62f4bf252b2fb0cff0a04d3eac2021c440096649e62f4e48553d" dependencies = [ "arc-swap", "async-trait", "bytes", - "cfg-if 0.1.10", + "cfg-if", "hex", "interceptor", "lazy_static", @@ -3492,7 +3303,7 @@ dependencies = [ "rand 0.8.5", "rcgen", "regex", - "ring", + "ring 0.17.8", "rtcp", "rtp", "rustls", @@ -3520,12 +3331,11 @@ dependencies = [ [[package]] name = "webrtc-data" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c3c7ba7d11733e448d8d2d054814e97c558f52293f0e0a2eb05840f28b3be12" +checksum = "e8c08e648e10572b9edbe741074e0f4d3cb221aa7cdf9a814ee71606de312f33" dependencies = [ "bytes", - "derive_builder", "log", "thiserror", "tokio", @@ -3535,20 +3345,18 @@ dependencies = [ [[package]] name = "webrtc-dtls" -version = "0.7.2" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a00f4242f2db33307347bd5be53263c52a0331c96c14292118c9a6bb48d267" +checksum = "188ce061a2371bdf4df54b136c89a6df243ed0ef6b03431b4bd18482cd718dfe" dependencies = [ - "aes 0.6.0", + "aes", "aes-gcm", "async-trait", "bincode", - "block-modes", "byteorder", + "cbc", "ccm", - "curve25519-dalek 3.2.0", - "der-parser 8.2.0", - "elliptic-curve", + "der-parser", "hkdf", "hmac 0.12.1", "log", @@ -3557,27 +3365,25 @@ dependencies = [ "rand 0.8.5", "rand_core 0.6.4", "rcgen", - "ring", + "ring 0.17.8", "rustls", "sec1", "serde", "sha1", "sha2 0.10.8", - "signature", "subtle", "thiserror", "tokio", - "webpki", "webrtc-util", "x25519-dalek", - "x509-parser 0.13.2", + "x509-parser", ] [[package]] name = "webrtc-ice" -version = "0.9.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "465a03cc11e9a7d7b4f9f99870558fe37a102b65b93f8045392fef7c67b39e80" +checksum = "a1bbd6b3dea22cc6e961e22b012e843d8869e2ac8e76b96e54d4a25e311857ad" dependencies = [ "arc-swap", "async-trait", @@ -3599,12 +3405,12 @@ dependencies = [ [[package]] name = "webrtc-mdns" -version = "0.5.2" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f08dfd7a6e3987e255c4dbe710dde5d94d0f0574f8a21afa95d171376c143106" +checksum = "ce981f93104a8debb3563bb0cedfe4aa2f351fdf6b53f346ab50009424125c08" dependencies = [ "log", - "socket2 0.4.7", + "socket2 0.5.5", "thiserror", "tokio", "webrtc-util", @@ -3612,9 +3418,9 @@ dependencies = [ [[package]] name = "webrtc-media" -version = "0.6.1" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8e3711a321f6a375973144f48065cf705316ab6709672954aace020c668eb6" +checksum = "280017b6b9625ef7329146332518b339c3cceff231cc6f6a9e0e6acab25ca4af" dependencies = [ "byteorder", "bytes", @@ -3625,9 +3431,9 @@ dependencies = [ [[package]] name = "webrtc-sctp" -version = "0.8.0" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7df742d91cfbd982f6ab2bfd45a7c3ddfce5b2f55913b2f63877404d1b3259db" +checksum = "df75ec042002fe995194712cbeb2029107a60a7eab646f1b789eb1be94d0e367" dependencies = [ "arc-swap", "async-trait", @@ -3642,16 +3448,16 @@ dependencies = [ [[package]] name = "webrtc-srtp" -version = "0.10.0" +version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5683b597b3c6af47ff11e695697f881bc42acfd8feeb0d4eb20a5ae9caaee6ae" +checksum = "383b0f0f73ee6cce396bdbc4d54ec661861a59eae9fc988914c1a8d82c5ac272" dependencies = [ - "aead 0.4.3", - "aes 0.7.5", + "aead", + "aes", "aes-gcm", "byteorder", "bytes", - "ctr 0.8.0", + "ctr", "hmac 0.12.1", "log", "rtcp", @@ -3665,14 +3471,13 @@ dependencies = [ [[package]] name = "webrtc-util" -version = "0.7.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93f1db1727772c05cf7a2cfece52c3aca8045ca1e176cd517d323489aa3c6d87" +checksum = "5e85154ef743d9a2a116d104faaaa82740a281b8b4bed5ee691a2df6c133d873" dependencies = [ "async-trait", "bitflags 1.3.2", "bytes", - "cc", "ipnet", "lazy_static", "libc", @@ -3748,6 +3553,15 @@ dependencies = [ "windows-targets 0.48.5", ] +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.3", +] + [[package]] name = "windows-targets" version = "0.42.1" @@ -3778,6 +3592,21 @@ dependencies = [ "windows_x86_64_msvc 0.48.5", ] +[[package]] +name = "windows-targets" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" +dependencies = [ + "windows_aarch64_gnullvm 0.52.3", + "windows_aarch64_msvc 0.52.3", + "windows_i686_gnu 0.52.3", + "windows_i686_msvc 0.52.3", + "windows_x86_64_gnu 0.52.3", + "windows_x86_64_gnullvm 0.52.3", + "windows_x86_64_msvc 0.52.3", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.1" @@ -3790,6 +3619,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" + [[package]] name = "windows_aarch64_msvc" version = "0.42.1" @@ -3802,6 +3637,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" + [[package]] name = "windows_i686_gnu" version = "0.42.1" @@ -3814,6 +3655,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" + [[package]] name = "windows_i686_msvc" version = "0.42.1" @@ -3826,6 +3673,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" + [[package]] name = "windows_x86_64_gnu" version = "0.42.1" @@ -3838,6 +3691,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.1" @@ -3850,6 +3709,12 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" + [[package]] name = "windows_x86_64_msvc" version = "0.42.1" @@ -3862,13 +3727,20 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" + [[package]] name = "winreg" -version = "0.10.1" +version = "0.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" +checksum = "524e57b2c537c0f9b1e69f1965311ec12182b4122e45035b1508cd24d2adadb1" dependencies = [ - "winapi", + "cfg-if", + "windows-sys 0.48.0", ] [[package]] @@ -3877,7 +3749,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fb66477291e7e8d2b0ff1bcb900bf29489a9692816d79874bea351e7a8b6de96" dependencies = [ - "curve25519-dalek 4.1.1", + "curve25519-dalek", "rand_core 0.6.4", "serde", "zeroize", @@ -3885,36 +3757,17 @@ dependencies = [ [[package]] name = "x509-parser" -version = "0.13.2" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb9bace5b5589ffead1afb76e43e34cff39cd0f3ce7e170ae0c29e53b88eb1c" +checksum = "7069fba5b66b9193bd2c5d3d4ff12b839118f6bcbef5328efafafb5395cf63da" dependencies = [ - "asn1-rs 0.3.1", - "base64 0.13.1", + "asn1-rs", "data-encoding", - "der-parser 7.0.0", + "der-parser", "lazy_static", "nom", - "oid-registry 0.4.0", - "rusticata-macros", - "thiserror", - "time 0.3.30", -] - -[[package]] -name = "x509-parser" -version = "0.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0ecbeb7b67ce215e40e3cc7f2ff902f94a223acf44995934763467e7b1febc8" -dependencies = [ - "asn1-rs 0.5.2", - "base64 0.13.1", - "data-encoding", - "der-parser 8.2.0", - "lazy_static", - "nom", - "oid-registry 0.6.1", - "ring", + "oid-registry", + "ring 0.16.20", "rusticata-macros", "thiserror", "time 0.3.30", @@ -3929,6 +3782,7 @@ dependencies = [ "bytesio 0.3.1", "failure", "h264-decoder 0.2.0", + "indexmap 1.9.3", "log", "serde", ] @@ -3989,7 +3843,7 @@ name = "xrtsp" version = "0.1.1" dependencies = [ "async-trait", - "base64 0.21.2", + "base64", "byteorder", "bytes", "bytesio 0.3.1", @@ -4011,6 +3865,7 @@ name = "xwebrtc" version = "0.1.0" dependencies = [ "async-trait", + "audiopus", "byteorder", "bytes", "bytesio 0.3.1", @@ -4020,7 +3875,6 @@ dependencies = [ "http 0.2.9", "indexmap 1.9.3", "log", - "opus", "streamhub 0.1.1", "tokio", "webrtc", @@ -4038,9 +3892,9 @@ dependencies = [ [[package]] name = "zeroize" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" +checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" dependencies = [ "zeroize_derive", ] diff --git a/application/pprtmp/CHANGELOG.md b/application/pprtmp/CHANGELOG.md new file mode 100644 index 00000000..1af30a2a --- /dev/null +++ b/application/pprtmp/CHANGELOG.md @@ -0,0 +1,18 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + + +## [Unreleased] - ReleaseDate + +## [0.1.1] + +## [0.1.0] + + + + diff --git a/application/pprtmp/Cargo.toml b/application/pprtmp/Cargo.toml index 64009460..22f2e578 100644 --- a/application/pprtmp/Cargo.toml +++ b/application/pprtmp/Cargo.toml @@ -2,6 +2,11 @@ name = "pprtmp" version = "0.1.0" edition = "2021" +description = "A pull push RTMP app" +authors = ["HarlanC + +## [Unreleased] - ReleaseDate + +## [0.12.0] +- Support pull/push authentication #95 . +- Support publishing pre-built images and docker images using github action #100 Thanks @svenstaro . +- Fix the issue of incomplete HLS recording file generation #101 Thanks @GameEgg . +- Refactor: extract http mod from RTSP/Webrtc to common library. +- Refactor: extract amf0 mod from RTSP to XFLV library. +- Refactor: remove the dependency of HLS on RTMP. +- Refactor: remove the dependency of HTTP-FLV on RTMP. +- Refactor api_kick_off_client of streamhub to simplify the process. +- Update denpendency library of WebRTC from opus-rs to audiopus to support cross compile. +- Use reqwest's vender feature referenced in streamhub to support cross compile. + +## [0.10.0] +- Remove no used "\n" for error message. +- Support remux from WHIP to RTMP. + +## [0.9.1] +- Support WebRTC(whip/whep). + +## [0.8.0] +- Support HLS record. + +## [0.7.0] +- Support RTSP. + +## [0.6.1] +- Fix error that cannot receive rtmp stream pushed from GStreamer. +- Fix rtmp cts parse error. +- Fix RTMP examples in README. + +## [0.6.0] +- Support notify stream status. +- Support HTTP API to kickoff clients. +- Add a http-server for testing http notify. +- Add a pull rtmp and push rtmp example: pprtmp. +- Fix some RTMP library bugs. + +## [0.5.0] +- Support rtmp gop number configuration. +- Support query stream information using HTTP api. + + + diff --git a/application/xiu/README.md b/application/xiu/README.md index 231d1b8f..91986833 100644 --- a/application/xiu/README.md +++ b/application/xiu/README.md @@ -326,30 +326,6 @@ Use the above methods to push live stream to service 1, when you play the stream ## Others Open issues if you have any problems. Star and pull requests are welcomed. Your stars can make this project go faster and further. - - -## v0.5.0 -- Support rtmp gop number configuration. -- Support query stream information using HTTP api. -## v0.6.0 -- Support notify stream status. -- Support HTTP API to kickoff clients. -- Add a http-server for testing http notify. -- Add a pull rtmp and push rtmp example: pprtmp. -- Fix some RTMP library bugs. -## v0.6.1 -- Fix error that cannot receive rtmp stream pushed from GStreamer. -- Fix rtmp cts parse error. -- Fix RTMP examples in README. -## v0.7.0 -- Support RTSP. -## v0.8.0 -- Support HLS record. -## v0.9.1 -- Support WebRTC(whip/whep). -## v0.10.0 -- Remove no used "\n" for error message. -- Support remux from WHIP to RTMP. diff --git a/application/xiu/src/config/config.toml b/application/xiu/src/config/examples/config.toml similarity index 96% rename from application/xiu/src/config/config.toml rename to application/xiu/src/config/examples/config.toml index 89aa903d..d7981440 100644 --- a/application/xiu/src/config/config.toml +++ b/application/xiu/src/config/examples/config.toml @@ -7,8 +7,8 @@ enabled = true port = 1935 gop_num = 0 [rtmp.auth] -pull_enabled = true -push_enabled = true +pull_enabled = false +push_enabled = false # simple or md5 algorithm = "simple" # pull streams from other server node. @@ -96,6 +96,6 @@ algorithm = "simple" level = "info" [log.file] # write log to file or not(Writing logs to file or console cannot be satisfied at the same time). -enabled = false +enabled = true rotate = "hour" #[day,hour,minute] -path = "./logs" +path = "/app/logs" diff --git a/application/xiu/src/config/config_rtmp.toml b/application/xiu/src/config/examples/config_rtmp.toml similarity index 100% rename from application/xiu/src/config/config_rtmp.toml rename to application/xiu/src/config/examples/config_rtmp.toml diff --git a/application/xiu/src/config/config_rtmp_hls.toml b/application/xiu/src/config/examples/config_rtmp_hls.toml similarity index 100% rename from application/xiu/src/config/config_rtmp_hls.toml rename to application/xiu/src/config/examples/config_rtmp_hls.toml diff --git a/application/xiu/src/config/config_rtmp_httpflv.toml b/application/xiu/src/config/examples/config_rtmp_httpflv.toml similarity index 100% rename from application/xiu/src/config/config_rtmp_httpflv.toml rename to application/xiu/src/config/examples/config_rtmp_httpflv.toml diff --git a/application/xiu/src/config/config_rtmp_httpflv_hls.toml b/application/xiu/src/config/examples/config_rtmp_httpflv_hls.toml similarity index 100% rename from application/xiu/src/config/config_rtmp_httpflv_hls.toml rename to application/xiu/src/config/examples/config_rtmp_httpflv_hls.toml diff --git a/confs/online/flv.Cargo.toml b/confs/online/flv.Cargo.toml index d26e9836..4b8d6f31 100644 --- a/confs/online/flv.Cargo.toml +++ b/confs/online/flv.Cargo.toml @@ -1,7 +1,7 @@ [package] name = "xflv" description = "flv library." -version = "0.4.0" +version = "0.4.1" authors = ["HarlanC "] @@ -25,5 +25,5 @@ base64 = "0.21.2" hex = "0.4.3" bytesio = "0.3.1" -streamhub = "0.2.0" +streamhub = "0.2.1" commonlib = "0.1.0" diff --git a/confs/online/streamhub.Cargo.toml b/confs/online/streamhub.Cargo.toml index e08a8cbd..5b17bc9b 100644 --- a/confs/online/streamhub.Cargo.toml +++ b/confs/online/streamhub.Cargo.toml @@ -1,7 +1,7 @@ [package] name = "streamhub" description = "It receives streams from publishers(rtmp/rtsp etc.) and send streams to subscribers(rtmp/rtsp/httpflv/hls)" -version = "0.2.0" +version = "0.2.1" edition = "2021" authors = ["HarlanC "] license = "MIT" @@ -17,7 +17,8 @@ rand = "0.8" log = "0.4" chrono = "0.4" indexmap = "1.9.3" -reqwest = "0.11.14" +#use vendored feature to enable cross compile for openssl +reqwest = {version = "0.11.24",features = ["native-tls-vendored"]} async-trait = "0.1.70" serde_json = { version = "1", default-features = false, features = [ "alloc", @@ -26,7 +27,7 @@ serde_json = { version = "1", default-features = false, features = [ ] } serde = { version = "1.0", features = ["derive", "rc"] } -xflv = "0.4.0" +xflv = "0.4.1" bytesio = "0.3.1" [dependencies.tokio] diff --git a/confs/online/webrtc.Cargo.toml b/confs/online/webrtc.Cargo.toml index d7d8ebf4..3990e04b 100644 --- a/confs/online/webrtc.Cargo.toml +++ b/confs/online/webrtc.Cargo.toml @@ -1,6 +1,6 @@ [package] name = "xwebrtc" -version = "0.3.0" +version = "0.3.1" description = "A whip/whep library." edition = "2021" authors = ["HarlanC "] @@ -17,12 +17,12 @@ bytes = "1.0.0" tokio = "1.4.0" failure = "0.1.1" log = "0.4" -webrtc = "0.8.0" +webrtc = "0.10.1" async-trait = "0.1.70" fdk-aac = "0.6.0" -opus = "0.3.0" +audiopus = "0.3.0-rc.0" bytesio = "0.3.1" -streamhub = "0.2.0" -xflv = "0.4.0" +streamhub = "0.2.1" +xflv = "0.4.1" commonlib = "0.1.0" diff --git a/confs/online/xiu.Cargo.toml b/confs/online/xiu.Cargo.toml index fffc9655..f03913c1 100644 --- a/confs/online/xiu.Cargo.toml +++ b/confs/online/xiu.Cargo.toml @@ -27,12 +27,12 @@ axum = "0.6.10" tokio-metrics = { version = "0.2.0", default-features = false } env_logger_extend = "0.1.1" -streamhub = "0.2.0" -rtmp = "0.6.1" -xrtsp = "0.2.0" -httpflv = "0.4.1" -hls = "0.5.1" -xwebrtc = "0.3.0" +streamhub = "0.2.1" +rtmp = "0.6.2" +xrtsp = "0.2.1" +httpflv = "0.4.2" +hls = "0.5.2" +xwebrtc = "0.3.1" commonlib = "0.1.0" [features] diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 00000000..227f6961 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,6 @@ +FROM ubuntu:latest +COPY --chmod=755 xiu /app/ +COPY --chmod=755 index.html /app/ +COPY --chmod=755 whep.js /app/ +COPY --chmod=755 config /app/ +COPY --chmod=755 start.sh /app/ \ No newline at end of file diff --git a/docker/start.sh b/docker/start.sh new file mode 100644 index 00000000..47dc8584 --- /dev/null +++ b/docker/start.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +echo "=====================================================" + +echo "Specify configuration file path" + +/app/xiu -c $1 diff --git a/library/container/flv/CHANGELOG.md b/library/container/flv/CHANGELOG.md new file mode 100644 index 00000000..799be4ca --- /dev/null +++ b/library/container/flv/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + + +## [Unreleased] - ReleaseDate + +## [0.4.1] - 2021-02-28 +- Move amf0 mod from RTMP library to this library + +## [0.4.0] +- Remove no used "\n" for error message. +- Add audio specific config generator. + +## [0.3.0] +- Reference bytesio v0.3.0. +- Do some refactoring for rtsp2rtmp. + +## [0.2.1] +- Fix rtmp cts parse error. + +## [0.2.0] +- Read audio and video codec information. + +## [0.1.0] +- Fix #20, clean up the remaing PPS data. +- Fix the error chain. + + + + + diff --git a/library/container/flv/Cargo.toml b/library/container/flv/Cargo.toml index 3e455013..3f8427d4 100644 --- a/library/container/flv/Cargo.toml +++ b/library/container/flv/Cargo.toml @@ -16,6 +16,7 @@ bytes = "1.0.0" failure = "0.1.1" serde = { version = "1.0", features = ["derive", "rc"] } log = "0.4" +indexmap = "1.9.3" bytesio = { path = "../../bytesio/" } h264-decoder = { path = "../../codec/h264/" } diff --git a/library/container/flv/README.md b/library/container/flv/README.md index faebc27b..385a8e67 100644 --- a/library/container/flv/README.md +++ b/library/container/flv/README.md @@ -1,15 +1,3 @@ A flv library. -## v0.1.0 -- Fix #20, clean up the remaing PPS data. -- Fix the error chain. -## v0.2.0 -- Read audio and video codec information. -## v0.2.1 -- Fix rtmp cts parse error. -## v0.3.0 -- Reference bytesio v0.3.0. -- Do some refactoring for rtsp2rtmp. -## v0.4.0 -- Remove no used "\n" for error message. -- Add audio specific config generator. + diff --git a/protocol/rtmp/src/amf0/amf0_markers.rs b/library/container/flv/src/amf0/amf0_markers.rs similarity index 100% rename from protocol/rtmp/src/amf0/amf0_markers.rs rename to library/container/flv/src/amf0/amf0_markers.rs diff --git a/protocol/rtmp/src/amf0/amf0_reader.rs b/library/container/flv/src/amf0/amf0_reader.rs similarity index 100% rename from protocol/rtmp/src/amf0/amf0_reader.rs rename to library/container/flv/src/amf0/amf0_reader.rs diff --git a/protocol/rtmp/src/amf0/amf0_writer.rs b/library/container/flv/src/amf0/amf0_writer.rs similarity index 100% rename from protocol/rtmp/src/amf0/amf0_writer.rs rename to library/container/flv/src/amf0/amf0_writer.rs diff --git a/protocol/rtmp/src/amf0/define.rs b/library/container/flv/src/amf0/define.rs similarity index 100% rename from protocol/rtmp/src/amf0/define.rs rename to library/container/flv/src/amf0/define.rs diff --git a/protocol/rtmp/src/amf0/errors.rs b/library/container/flv/src/amf0/errors.rs similarity index 100% rename from protocol/rtmp/src/amf0/errors.rs rename to library/container/flv/src/amf0/errors.rs diff --git a/protocol/rtmp/src/amf0/mod.rs b/library/container/flv/src/amf0/mod.rs similarity index 100% rename from protocol/rtmp/src/amf0/mod.rs rename to library/container/flv/src/amf0/mod.rs diff --git a/library/container/flv/src/lib.rs b/library/container/flv/src/lib.rs index 70655bba..b4285bde 100644 --- a/library/container/flv/src/lib.rs +++ b/library/container/flv/src/lib.rs @@ -1,3 +1,4 @@ +pub mod amf0; pub mod define; pub mod demuxer; pub mod errors; diff --git a/library/streamhub/CHANGELOG.md b/library/streamhub/CHANGELOG.md new file mode 100644 index 00000000..8f86fb6e --- /dev/null +++ b/library/streamhub/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + + +## [Unreleased] - ReleaseDate + +## [0.2.1] - 2021-02-28 +- Refactor api_kick_off_client of streamhub to simplify the process; +- Rename struct name. +- Use reqwest's vender feature to support cross compile. + +## [0.2.0] +- Remove no used "\n" for error message. +- Support flexible subscription of Frame or packet data. +- Support obtaining the execution results of sub/pub events. +- Fix bug that media info cannot be passed to subscribers. + +## [0.1.2] +- Support transferring rtp packet. + +## [0.1.0] +- The first version. + + + + + + + + + diff --git a/library/streamhub/Cargo.toml b/library/streamhub/Cargo.toml index f1ec3850..ae168970 100644 --- a/library/streamhub/Cargo.toml +++ b/library/streamhub/Cargo.toml @@ -17,7 +17,8 @@ rand = "0.8" log = "0.4" chrono = "0.4" indexmap = "1.9.3" -reqwest = "0.11.14" +#use vendored feature to enable cross compile for openssl +reqwest = {version = "0.11.24",features = ["native-tls-vendored"]} async-trait = "0.1.70" serde_json = { version = "1", default-features = false, features = [ "alloc", diff --git a/library/streamhub/README.md b/library/streamhub/README.md index 284df544..bd0ff492 100644 --- a/library/streamhub/README.md +++ b/library/streamhub/README.md @@ -1,13 +1,3 @@ The streamhub is used for xiu to communicate between publisher/subscirber. -## v0.1.0 -- The first version. -## v0.1.2 -- Support transferring rtp packet. - -## v0.2.0 -- Remove no used "\n" for error message. -- Support flexible subscription of Frame or packet data. -- Support obtaining the execution results of sub/pub events. -- Fix bug that media info cannot be passed to subscribers. diff --git a/library/streamhub/src/define.rs b/library/streamhub/src/define.rs index a389c961..8689533d 100644 --- a/library/streamhub/src/define.rs +++ b/library/streamhub/src/define.rs @@ -1,7 +1,7 @@ use crate::utils; use { - super::errors::ChannelError, + super::errors::StreamHubError, crate::statistics::StreamStatistics, crate::stream::StreamIdentifier, async_trait::async_trait, @@ -98,7 +98,7 @@ impl Serialize for PublisherInfo { let mut state = serializer.serialize_struct("PublisherInfo", 3)?; state.serialize_field("id", &self.id.to_string())?; - state.serialize_field("sub_type", &self.pub_type)?; + state.serialize_field("pub_type", &self.pub_type)?; state.serialize_field("notify_info", &self.notify_info)?; state.end() } @@ -167,9 +167,9 @@ pub type AvStatisticReceiver = mpsc::UnboundedReceiver; pub type StreamStatisticSizeSender = oneshot::Sender; pub type StreamStatisticSizeReceiver = oneshot::Receiver; -pub type SubEventExecuteResultSender = oneshot::Sender>; +pub type SubEventExecuteResultSender = oneshot::Sender>; pub type PubEventExecuteResultSender = - oneshot::Sender, Option), ChannelError>>; + oneshot::Sender, Option), StreamHubError>>; #[async_trait] pub trait TStreamHandler: Send + Sync { @@ -177,7 +177,7 @@ pub trait TStreamHandler: Send + Sync { &self, sender: DataSender, sub_type: SubscribeType, - ) -> Result<(), ChannelError>; + ) -> Result<(), StreamHubError>; async fn get_statistic_data(&self) -> Option; async fn send_information(&self, sender: InformationSender); } @@ -281,16 +281,3 @@ pub enum BroadcastEvent { Subscribe { identifier: StreamIdentifier }, UnSubscribe { identifier: StreamIdentifier }, } - -//Used for kickoff -#[derive(Debug, Clone)] -pub enum PubSubInfo { - Subscribe { - identifier: StreamIdentifier, - sub_info: SubscriberInfo, - }, - - Publish { - identifier: StreamIdentifier, - }, -} diff --git a/library/streamhub/src/errors.rs b/library/streamhub/src/errors.rs index a2bb8bef..16399008 100644 --- a/library/streamhub/src/errors.rs +++ b/library/streamhub/src/errors.rs @@ -4,7 +4,7 @@ use failure::Backtrace; use {failure::Fail, std::fmt}; #[derive(Debug, Fail)] -pub enum ChannelErrorValue { +pub enum StreamHubErrorValue { #[fail(display = "no app name")] NoAppName, #[fail(display = "no stream name")] @@ -27,17 +27,17 @@ pub enum ChannelErrorValue { NotCorrectDataSenderType, } #[derive(Debug)] -pub struct ChannelError { - pub value: ChannelErrorValue, +pub struct StreamHubError { + pub value: StreamHubErrorValue, } -impl fmt::Display for ChannelError { +impl fmt::Display for StreamHubError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::Display::fmt(&self.value, f) } } -impl Fail for ChannelError { +impl Fail for StreamHubError { fn cause(&self) -> Option<&dyn Fail> { self.value.cause() } @@ -47,18 +47,18 @@ impl Fail for ChannelError { } } -impl From for ChannelError { +impl From for StreamHubError { fn from(error: BytesReadError) -> Self { - ChannelError { - value: ChannelErrorValue::BytesReadError(error), + StreamHubError { + value: StreamHubErrorValue::BytesReadError(error), } } } -impl From for ChannelError { +impl From for StreamHubError { fn from(error: BytesWriteError) -> Self { - ChannelError { - value: ChannelErrorValue::BytesWriteError(error), + StreamHubError { + value: StreamHubErrorValue::BytesWriteError(error), } } } diff --git a/library/streamhub/src/lib.rs b/library/streamhub/src/lib.rs index 616e66dc..7ceaa5ab 100644 --- a/library/streamhub/src/lib.rs +++ b/library/streamhub/src/lib.rs @@ -13,12 +13,12 @@ use { crate::notify::Notifier, define::{ AvStatisticSender, BroadcastEvent, BroadcastEventReceiver, BroadcastEventSender, - DataReceiver, DataSender, FrameData, FrameDataSender, Information, PubSubInfo, - StreamHubEvent, StreamHubEventReceiver, StreamHubEventSender, StreamStatisticSizeSender, - SubscribeType, SubscriberInfo, TStreamHandler, TransmitterEvent, TransmitterEventReceiver, + DataReceiver, DataSender, FrameData, FrameDataSender, Information, StreamHubEvent, + StreamHubEventReceiver, StreamHubEventSender, StreamStatisticSizeSender, SubscribeType, + SubscriberInfo, TStreamHandler, TransmitterEvent, TransmitterEventReceiver, TransmitterEventSender, }, - errors::{ChannelError, ChannelErrorValue}, + errors::{StreamHubError, StreamHubErrorValue}, std::collections::HashMap, std::sync::Arc, stream::StreamIdentifier, @@ -76,8 +76,8 @@ impl Transmitter { }; for (_, v) in frame_senders.lock().await.iter() { - if let Err(audio_err) = v.send(data.clone()).map_err(|_| ChannelError { - value: ChannelErrorValue::SendAudioError, + if let Err(audio_err) = v.send(data.clone()).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendAudioError, }) { log::error!("Transmiter send error: {}", audio_err); } @@ -89,8 +89,8 @@ impl Transmitter { data: data.clone(), }; for (_, v) in frame_senders.lock().await.iter() { - if let Err(video_err) = v.send(data.clone()).map_err(|_| ChannelError { - value: ChannelErrorValue::SendVideoError, + if let Err(video_err) = v.send(data.clone()).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendVideoError, }) { log::error!("Transmiter send error: {}", video_err); } @@ -101,8 +101,8 @@ impl Transmitter { media_info: info_value }; for (_, v) in frame_senders.lock().await.iter() { - if let Err(media_err) = v.send(data.clone()).map_err(|_| ChannelError { - value: ChannelErrorValue::SendVideoError, + if let Err(media_err) = v.send(data.clone()).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendVideoError, }) { log::error!("Transmiter send error: {}", media_err); } @@ -139,8 +139,8 @@ impl Transmitter { }; for (_, v) in packet_senders.lock().await.iter() { - if let Err(audio_err) = v.send(data.clone()).map_err(|_| ChannelError { - value: ChannelErrorValue::SendAudioError, + if let Err(audio_err) = v.send(data.clone()).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendAudioError, }) { log::error!("Transmiter send error: {}", audio_err); } @@ -152,8 +152,8 @@ impl Transmitter { data: data.clone(), }; for (_, v) in packet_senders.lock().await.iter() { - if let Err(video_err) = v.send(data.clone()).map_err(|_| ChannelError { - value: ChannelErrorValue::SendVideoError, + if let Err(video_err) = v.send(data.clone()).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendVideoError, }) { log::error!("Transmiter send error: {}", video_err); } @@ -234,7 +234,7 @@ impl Transmitter { }); } - pub async fn run(self) -> Result<(), ChannelError> { + pub async fn run(self) -> Result<(), StreamHubError> { let (tx, _) = broadcast::channel::<()>(1); if let Some(receiver) = self.data_receiver.frame_receiver { @@ -271,8 +271,8 @@ impl Transmitter { pub struct StreamsHub { //app_name to stream_name to producer streams: HashMap, - //save info to kick off client - streams_info: HashMap, + //construct UnSubscribe and UnPublish event from Subscribe and Publish event to kick off client + un_pub_sub_events: HashMap, //event is consumed in Channels, produced from other rtmp sessions hub_event_receiver: StreamHubEventReceiver, //event is produced from other rtmp sessions @@ -298,7 +298,7 @@ impl StreamsHub { Self { streams: HashMap::new(), - streams_info: HashMap::new(), + un_pub_sub_events: HashMap::new(), hub_event_receiver: event_consumer, hub_event_sender: event_producer, client_event_producer: client_producer, @@ -401,8 +401,8 @@ impl StreamsHub { if let Some(notifier) = &self.notifier { notifier.on_publish_notify(event_serialize_str).await; } - self.streams_info - .insert(info.id, PubSubInfo::Publish { identifier }); + self.un_pub_sub_events + .insert(info.id, StreamHubEvent::UnPublish { identifier, info }); Ok((frame_sender, packet_sender)) } @@ -475,13 +475,8 @@ impl StreamsHub { notifier.on_play_notify(event_serialize_str).await; } - self.streams_info.insert( - sub_id, - PubSubInfo::Subscribe { - identifier, - sub_info: info, - }, - ); + self.un_pub_sub_events + .insert(sub_id, StreamHubEvent::UnSubscribe { identifier, info }); Ok(receiver) } Err(err) => { @@ -511,10 +506,8 @@ impl StreamsHub { } } StreamHubEvent::ApiKickClient { id } => { - self.api_kick_off_client(id); - - if let Some(notifier) = &self.notifier { - notifier.on_unpublish_notify(event_serialize_str).await; + if let Err(err) = self.api_kick_off_client(id) { + log::error!("api_kick_off_client api error: {}", err); } } StreamHubEvent::Request { identifier, sender } => { @@ -530,12 +523,12 @@ impl StreamsHub { &mut self, identifier: &StreamIdentifier, sender: mpsc::UnboundedSender, - ) -> Result<(), ChannelError> { + ) -> Result<(), StreamHubError> { if let Some(producer) = self.streams.get_mut(identifier) { let event = TransmitterEvent::Request { sender }; log::info!("Request: stream identifier: {}", identifier); - producer.send(event).map_err(|_| ChannelError { - value: ChannelErrorValue::SendError, + producer.send(event).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendError, })?; } Ok(()) @@ -545,7 +538,7 @@ impl StreamsHub { &mut self, data_sender: AvStatisticSender, size_sender: StreamStatisticSizeSender, - ) -> Result<(), ChannelError> { + ) -> Result<(), StreamHubError> { let mut stream_count: usize = 0; for v in self.streams.values() { stream_count += 1; @@ -553,52 +546,60 @@ impl StreamsHub { sender: data_sender.clone(), }) { log::error!("TransmitterEvent api send data err: {}", err); - return Err(ChannelError { - value: ChannelErrorValue::SendError, + return Err(StreamHubError { + value: StreamHubErrorValue::SendError, }); } } if let Err(err) = size_sender.send(stream_count) { log::error!("TransmitterEvent api send size err: {}", err); - return Err(ChannelError { - value: ChannelErrorValue::SendError, + return Err(StreamHubError { + value: StreamHubErrorValue::SendError, }); } Ok(()) } - fn api_kick_off_client(&mut self, uid: Uuid) { - let info = if let Some(info) = self.streams_info.get(&uid) { - info.clone() - } else { - return; - }; - - match info { - PubSubInfo::Publish { identifier } => { - if let Err(err) = self.unpublish(&identifier) { - log::error!( - "event_loop ApiKickClient pub err: {} with identifier: {}", - err, - identifier - ); + fn api_kick_off_client(&mut self, uid: Uuid) -> Result<(), StreamHubError> { + if let Some(event) = self.un_pub_sub_events.get(&uid) { + match event { + StreamHubEvent::UnPublish { identifier, info } => { + if self + .hub_event_sender + .send(StreamHubEvent::UnPublish { + identifier: identifier.clone(), + info: info.clone(), + }) + .is_err() + { + return Err(StreamHubError { + value: StreamHubErrorValue::SendError, + }); + } } - } - PubSubInfo::Subscribe { - identifier, - sub_info, - } => { - if let Err(err) = self.unsubscribe(&identifier, sub_info) { - log::error!( - "event_loop ApiKickClient pub err: {} with identifier: {}", - err, - identifier - ); + StreamHubEvent::UnSubscribe { identifier, info } => { + if self + .hub_event_sender + .send(StreamHubEvent::UnSubscribe { + identifier: identifier.clone(), + info: info.clone(), + }) + .is_err() + { + return Err(StreamHubError { + value: StreamHubErrorValue::SendError, + }); + } } + _ => {} } - } + } else { + log::warn!("cannot find uid: {}", uid); + }; + + Ok(()) } //player subscribe a stream @@ -607,15 +608,15 @@ impl StreamsHub { identifer: &StreamIdentifier, sub_info: SubscriberInfo, sender: DataSender, - ) -> Result<(), ChannelError> { + ) -> Result<(), StreamHubError> { if let Some(producer) = self.streams.get_mut(identifer) { let event = TransmitterEvent::Subscribe { sender, info: sub_info, }; log::info!("subscribe: stream identifier: {}", identifer); - producer.send(event).map_err(|_| ChannelError { - value: ChannelErrorValue::SendError, + producer.send(event).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendError, })?; return Ok(()); @@ -631,13 +632,13 @@ impl StreamsHub { //send subscribe info to pull clients self.client_event_producer .send(client_event) - .map_err(|_| ChannelError { - value: ChannelErrorValue::SendError, + .map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendError, })?; } - Err(ChannelError { - value: ChannelErrorValue::NoAppOrStreamName, + Err(StreamHubError { + value: StreamHubErrorValue::NoAppOrStreamName, }) } @@ -645,19 +646,20 @@ impl StreamsHub { &mut self, identifer: &StreamIdentifier, sub_info: SubscriberInfo, - ) -> Result<(), ChannelError> { + ) -> Result<(), StreamHubError> { match self.streams.get_mut(identifer) { Some(producer) => { log::info!("unsubscribe....:{}", identifer); let event = TransmitterEvent::UnSubscribe { info: sub_info }; - producer.send(event).map_err(|_| ChannelError { - value: ChannelErrorValue::SendError, + producer.send(event).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendError, })?; } None => { - return Err(ChannelError { - value: ChannelErrorValue::NoAppName, - }) + log::info!("unsubscribe None....:{}", identifer); + return Err(StreamHubError { + value: StreamHubErrorValue::NoAppName, + }); } } @@ -670,10 +672,10 @@ impl StreamsHub { identifier: StreamIdentifier, receiver: DataReceiver, handler: Arc, - ) -> Result<(), ChannelError> { + ) -> Result<(), StreamHubError> { if self.streams.get(&identifier).is_some() { - return Err(ChannelError { - value: ChannelErrorValue::Exists, + return Err(StreamHubError { + value: StreamHubErrorValue::Exists, }); } @@ -700,27 +702,27 @@ impl StreamsHub { //send publish info to push clients self.client_event_producer .send(client_event) - .map_err(|_| ChannelError { - value: ChannelErrorValue::SendError, + .map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendError, })?; } Ok(()) } - fn unpublish(&mut self, identifier: &StreamIdentifier) -> Result<(), ChannelError> { + fn unpublish(&mut self, identifier: &StreamIdentifier) -> Result<(), StreamHubError> { match self.streams.get_mut(identifier) { Some(producer) => { let event = TransmitterEvent::UnPublish {}; - producer.send(event).map_err(|_| ChannelError { - value: ChannelErrorValue::SendError, + producer.send(event).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendError, })?; self.streams.remove(identifier); log::info!("unpublish remove stream, stream identifier: {}", identifier); } None => { - return Err(ChannelError { - value: ChannelErrorValue::NoAppName, + return Err(StreamHubError { + value: StreamHubErrorValue::NoAppName, }) } } diff --git a/library/streamhub/src/utils.rs b/library/streamhub/src/utils.rs index 606da80d..6005c11d 100644 --- a/library/streamhub/src/utils.rs +++ b/library/streamhub/src/utils.rs @@ -34,7 +34,7 @@ fn u8_to_enum(digit: u8) -> RandomDigitCount { } impl Uuid { - pub fn from_str2(uuid: &String) -> Option { + pub fn from_str2(uuid: &str) -> Option { let length = uuid.len(); if !(10..=16).contains(&length) { return None; diff --git a/protocol/hls/CHANGELOG.md b/protocol/hls/CHANGELOG.md new file mode 100644 index 00000000..df232463 --- /dev/null +++ b/protocol/hls/CHANGELOG.md @@ -0,0 +1,67 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + + +## [Unreleased] - ReleaseDate + +## [0.5.2] - 2021-02-28 +- Refactor: remove the dependecy of HLS on RTMP. + +## [0.5.1] +- Fix RTMP build error. + +## [0.5.0] +- Support auth. + +## [0.4.3] +- Remove no used "\n" for error message. +- Replace hyper HTTP library with axum. +- Receive and process sub event result. + +## [0.4.2] +- Reference streamhub new version v0.1.2. + +## [0.4.0] +- Support record. + +## [0.3.0] +- Do some refactoring. +- Reference bytesio v0.3.0. + +## [0.2.1] +- Reference xflv new version v0.2.1. +- Reference rtmp new version v0.3.1. + +## [0.2.0] +- Support stream status notify using HTTP. + +## [0.1.2] +- Refactor codes +- Reference rtmp/xflv/mpegts new version. + +## [0.1.1] +Change the listening port type. + +## [0.1.0] +- Fix the error chain. + +## [0.0.8] +- fix #16 +- clear ts ans m3u8 files when the rtmp streasm is interupted. + +## [0.0.4] +- Reference rtmp version v0.0.8 + +## [0.0.3] +- Reference xmpegts version v0.0.2 + +## [0.0.2] +- Some improvements. + +## [0.0.1] +- Support remux RTMP stream to hls stream. \ No newline at end of file diff --git a/protocol/hls/Cargo.toml b/protocol/hls/Cargo.toml index 01449bbe..908c0c86 100644 --- a/protocol/hls/Cargo.toml +++ b/protocol/hls/Cargo.toml @@ -19,10 +19,9 @@ axum = { version = "0.7.4" } tokio-util = { version = "0.6.5", features = ["codec"] } streamhub = { path = "../../library/streamhub/" } -commonlib = { path = "../../library/common/" } xmpegts = { path = "../../library/container/mpegts/" } xflv = { path = "../../library/container/flv/" } -rtmp = { path = "../rtmp/" } +commonlib = { path = "../../library/common/" } [dependencies.tokio] version = "1.4.0" diff --git a/protocol/hls/README.md b/protocol/hls/README.md index 3a1ee1a0..baf1cfa5 100644 --- a/protocol/hls/README.md +++ b/protocol/hls/README.md @@ -1,42 +1,4 @@ A hls library. -## v0.0.1 -Support remux RTMP stream to hls stream. -## v0.0.2 -Some improvements. -## v0.0.3 -Reference xmpegts version v0.0.2 -## v0.0.4 -Reference rtmp version v0.0.8 -## v0.0.8 -- fix #16 -- clear ts ans m3u8 files when the rtmp streasm is interupted. -## v0.1.0 -- Fix the error chain. -## v0.1.1 -Change the listening port type. -## v0.1.2 -- Refactor codes -- Reference rtmp/xflv/mpegts new version. -## v0.2.0 -- Support stream status notify using HTTP. -## v0.2.1 -- Reference xflv new version v0.2.1. -- Reference rtmp new version v0.3.1. -## 0.3.0 -- Do some refactoring. -- Reference bytesio v0.3.0. -## 0.4.0 -- Support record. -## 0.4.2 -- Reference streamhub new version v0.1.2. -## 0.4.3 -- Remove no used "\n" for error message. -- Replace hyper HTTP library with axum. -- Receive and process sub event result. -## 0.5.0 -- Support auth. -## 0.5.1 -- Fix RTMP build error. diff --git a/protocol/hls/src/errors.rs b/protocol/hls/src/errors.rs index 8f1695f7..66685564 100644 --- a/protocol/hls/src/errors.rs +++ b/protocol/hls/src/errors.rs @@ -1,10 +1,7 @@ use { failure::{Backtrace, Fail}, - rtmp::{ - amf0::errors::Amf0WriteError, cache::errors::MetadataError, session::errors::SessionError, - }, std::fmt, - streamhub::errors::ChannelError, + streamhub::errors::StreamHubError, tokio::sync::broadcast::error::RecvError, tokio::sync::oneshot::error::RecvError as OneshotRecvError, xflv::errors::FlvDemuxerError, @@ -32,12 +29,6 @@ pub enum MediaErrorValue { Error, #[fail(display = "channel recv error")] ChannelRecvError, - #[fail(display = "session error:{}", _0)] - SessionError(#[cause] SessionError), - #[fail(display = "amf write error:{}", _0)] - Amf0WriteError(#[cause] Amf0WriteError), - #[fail(display = "metadata error:{}", _0)] - MetadataError(#[cause] MetadataError), #[fail(display = "flv demuxer error:{}", _0)] FlvDemuxerError(#[cause] FlvDemuxerError), #[fail(display = "mpegts error:{}", _0)] @@ -46,14 +37,6 @@ pub enum MediaErrorValue { IOError(#[cause] std::io::Error), } -impl From for MediaError { - fn from(error: SessionError) -> Self { - MediaError { - value: MediaErrorValue::SessionError(error), - } - } -} - impl From for MediaError { fn from(error: FlvDemuxerError) -> Self { MediaError { @@ -70,22 +53,6 @@ impl From for MediaError { } } -impl From for MediaError { - fn from(error: Amf0WriteError) -> Self { - MediaError { - value: MediaErrorValue::Amf0WriteError(error), - } - } -} - -impl From for MediaError { - fn from(error: MetadataError) -> Self { - MediaError { - value: MediaErrorValue::MetadataError(error), - } - } -} - impl From for MediaError { fn from(error: std::io::Error) -> Self { MediaError { @@ -121,13 +88,7 @@ pub enum HlsErrorValue { #[fail(display = "channel recv error")] ChannelRecvError, #[fail(display = "channel error:{}", _0)] - ChannelError(#[cause] ChannelError), - #[fail(display = "session error:{}", _0)] - SessionError(#[cause] SessionError), - #[fail(display = "amf write error:{}", _0)] - Amf0WriteError(#[cause] Amf0WriteError), - #[fail(display = "metadata error:{}", _0)] - MetadataError(#[cause] MetadataError), + ChannelError(#[cause] StreamHubError), #[fail(display = "flv demuxer error:{}", _0)] FlvDemuxerError(#[cause] FlvDemuxerError), #[fail(display = "media error:{}", _0)] @@ -136,6 +97,8 @@ pub enum HlsErrorValue { RecvError(#[cause] RecvError), #[fail(display = "tokio: oneshot receiver err: {}", _0)] OneshotRecvError(#[cause] OneshotRecvError), + #[fail(display = "stream hub event send error")] + StreamHubEventSendErr, } impl From for HlsError { fn from(error: RecvError) -> Self { @@ -153,14 +116,6 @@ impl From for HlsError { } } -impl From for HlsError { - fn from(error: SessionError) -> Self { - HlsError { - value: HlsErrorValue::SessionError(error), - } - } -} - impl From for HlsError { fn from(error: FlvDemuxerError) -> Self { HlsError { @@ -169,24 +124,8 @@ impl From for HlsError { } } -impl From for HlsError { - fn from(error: Amf0WriteError) -> Self { - HlsError { - value: HlsErrorValue::Amf0WriteError(error), - } - } -} - -impl From for HlsError { - fn from(error: MetadataError) -> Self { - HlsError { - value: HlsErrorValue::MetadataError(error), - } - } -} - -impl From for HlsError { - fn from(error: ChannelError) -> Self { +impl From for HlsError { + fn from(error: StreamHubError) -> Self { HlsError { value: HlsErrorValue::ChannelError(error), } diff --git a/protocol/hls/src/flv_data_receiver.rs b/protocol/hls/src/flv_data_receiver.rs index 58b02ce7..ff24f5ff 100644 --- a/protocol/hls/src/flv_data_receiver.rs +++ b/protocol/hls/src/flv_data_receiver.rs @@ -5,7 +5,6 @@ use { errors::{HlsError, HlsErrorValue}, flv2hls::Flv2HlsRemuxer, }, - rtmp::session::errors::{SessionError, SessionErrorValue}, std::time::Duration, streamhub::{ define::{ @@ -19,7 +18,7 @@ use { xflv::define::FlvData, }; -////https://www.jianshu.com/p/d6311f03b81f +///https://www.jianshu.com/p/d6311f03b81f pub struct FlvDataReceiver { app_name: String, @@ -124,11 +123,8 @@ impl FlvDataReceiver { let rv = self.event_producer.send(subscribe_event); if rv.is_err() { - let session_error = SessionError { - value: SessionErrorValue::StreamHubEventSendErr, - }; return Err(HlsError { - value: HlsErrorValue::SessionError(session_error), + value: HlsErrorValue::StreamHubEventSendErr, }); } diff --git a/protocol/httpflv/CHANGELOG.md b/protocol/httpflv/CHANGELOG.md new file mode 100644 index 00000000..b7b00ffd --- /dev/null +++ b/protocol/httpflv/CHANGELOG.md @@ -0,0 +1,53 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + + +## [Unreleased] - ReleaseDate + +## [0.4.2] - 2021-02-28 +- Refactor: remove the dependency of HTTP-FLV on RTMP. + +## [0.4.1] +- Fix RTMP build error. + +## [0.4.0] +- Support auth. + +## [0.3.3] +- Replace hyper HTTP library with axum. +- Fix bug: when http connection is disconnected , don't need to retry. +- Receive and process sub event result. + +## [0.3.2] +- Reference streamhub new version v0.1.2. + +## [0.3.0] +- Reference bytesio v0.3.0. +- Do some refactoring. + +## [0.2.1] +- Reference xflv new version v0.2.1. +- Reference rtmp new version v0.3.1. + +## [0.2.0] +- Support stream status notify using HTTP. + +## [0.1.1] +- Change the listening port type. + +## [0.1.0] +- Reference flv v0.1.0/rtmp v0.1.0 + +## [0.0.3] +- Reference rtmp v0.0.8 + +## [0.0.2] +- Some improvements. + +## [0.0.1] +- Support remux RTMP stream to httpflv stream. \ No newline at end of file diff --git a/protocol/httpflv/Cargo.toml b/protocol/httpflv/Cargo.toml index 1920e12f..cb644a35 100644 --- a/protocol/httpflv/Cargo.toml +++ b/protocol/httpflv/Cargo.toml @@ -19,9 +19,8 @@ axum = { version = "0.7.4" } futures = "0.3" streamhub = { path = "../../library/streamhub/" } -commonlib = { path = "../../library/common/" } xflv = { path = "../../library/container/flv/" } -rtmp = { path = "../rtmp/" } #"0.0.4" +commonlib = { path = "../../library/common/" } [dependencies.tokio] version = "1.4.0" diff --git a/protocol/httpflv/README.md b/protocol/httpflv/README.md index b88875e7..d85e6c1e 100644 --- a/protocol/httpflv/README.md +++ b/protocol/httpflv/README.md @@ -1,30 +1 @@ -A httpflv library. -## v0.0.1 -- Support remux RTMP stream to httpflv stream. -## v0.0.2 -- Some improvements. -## v0.0.3 -- Reference rtmp v0.0.8 -## v0.1.0 -- Reference flv v0.1.0/rtmp v0.1.0 -## v0.1.1 -- Change the listening port type. -## v0.2.0 -- Support stream status notify using HTTP. -## v0.2.1 -- Reference xflv new version v0.2.1. -- Reference rtmp new version v0.3.1. -## v0.3.0 -- Reference bytesio v0.3.0. -- Do some refactoring. -## 0.3.2 -- Reference streamhub new version v0.1.2. -## 0.3.3 -- Replace hyper HTTP library with axum. -- Fix bug: when http connection is disconnected , don't need to retry. -- Receive and process sub event result. -## 0.4.0 -- Support auth. -## 0.4.1 -- Fix RTMP build error. - +A httpflv library. \ No newline at end of file diff --git a/protocol/httpflv/src/errors.rs b/protocol/httpflv/src/errors.rs index 42022172..704c6cbf 100644 --- a/protocol/httpflv/src/errors.rs +++ b/protocol/httpflv/src/errors.rs @@ -1,13 +1,8 @@ -use streamhub::errors::ChannelError; +use streamhub::errors::StreamHubError; use { - failure::Fail, - futures::channel::mpsc::SendError, - rtmp::{ - amf0::errors::Amf0WriteError, cache::errors::MetadataError, session::errors::SessionError, - }, - std::fmt, - tokio::sync::oneshot::error::RecvError, + failure::Fail, futures::channel::mpsc::SendError, std::fmt, + tokio::sync::oneshot::error::RecvError, xflv::amf0::errors::Amf0WriteError, xflv::errors::FlvMuxerError, }; @@ -30,30 +25,20 @@ pub struct HttpFLvError { pub enum HttpFLvErrorValue { #[fail(display = "server error")] Error, - #[fail(display = "session error")] - SessionError(SessionError), #[fail(display = "flv muxer error")] MuxerError(FlvMuxerError), #[fail(display = "amf write error")] Amf0WriteError(Amf0WriteError), #[fail(display = "metadata error")] - MetadataError(MetadataError), - #[fail(display = "tokio mpsc error")] MpscSendError(SendError), #[fail(display = "event execute error: {}", _0)] - ChannelError(ChannelError), + ChannelError(StreamHubError), #[fail(display = "tokio: oneshot receiver err: {}", _0)] RecvError(#[cause] RecvError), #[fail(display = "channel recv error")] ChannelRecvError, -} - -impl From for HttpFLvError { - fn from(error: SessionError) -> Self { - HttpFLvError { - value: HttpFLvErrorValue::SessionError(error), - } - } + #[fail(display = "send frame data error")] + SendFrameDataErr, } impl From for HttpFLvError { @@ -80,16 +65,8 @@ impl From for HttpFLvError { } } -impl From for HttpFLvError { - fn from(error: MetadataError) -> Self { - HttpFLvError { - value: HttpFLvErrorValue::MetadataError(error), - } - } -} - -impl From for HttpFLvError { - fn from(error: ChannelError) -> Self { +impl From for HttpFLvError { + fn from(error: StreamHubError) -> Self { HttpFLvError { value: HttpFLvErrorValue::ChannelError(error), } diff --git a/protocol/httpflv/src/httpflv.rs b/protocol/httpflv/src/httpflv.rs index 558cb33e..251715e4 100644 --- a/protocol/httpflv/src/httpflv.rs +++ b/protocol/httpflv/src/httpflv.rs @@ -4,10 +4,6 @@ use { define::{tag_type, HttpResponseDataProducer}, errors::{HttpFLvError, HttpFLvErrorValue}, }, - crate::rtmp::{ - cache::metadata::MetaData, - session::errors::{SessionError, SessionErrorValue}, - }, bytes::BytesMut, std::net::SocketAddr, streamhub::define::{ @@ -19,6 +15,7 @@ use { utils::{RandomDigitCount, Uuid}, }, tokio::sync::mpsc, + xflv::amf0::amf0_writer::Amf0Writer, xflv::muxer::{FlvMuxer, HEADER_LENGTH}, }; @@ -99,16 +96,19 @@ impl HttpFlv { self.unsubscribe_from_rtmp_channels().await } + //used for the http-flv protocol + pub fn write_flv_tag(&mut self, channel_data: FrameData) -> Result<(), HttpFLvError> { let (common_data, common_timestamp, tag_type) = match channel_data { FrameData::Audio { timestamp, data } => (data, timestamp, tag_type::AUDIO), FrameData::Video { timestamp, data } => (data, timestamp, tag_type::VIDEO), FrameData::MetaData { timestamp, data } => { - let mut metadata = MetaData::new(); - metadata.save(&data); - let data = metadata.remove_set_data_frame()?; + //remove @setDataFrame from RTMP's metadata + let mut amf_writer: Amf0Writer = Amf0Writer::new(); + amf_writer.write_string(&String::from("@setDataFrame"))?; + let (_, right) = data.split_at(amf_writer.len()); - (data, timestamp, tag_type::SCRIPT_DATA_AMF) + (BytesMut::from(right), timestamp, tag_type::SCRIPT_DATA_AMF) } _ => { log::error!("should not be here!!!"); @@ -189,11 +189,8 @@ impl HttpFlv { let rv = self.event_producer.send(subscribe_event); if rv.is_err() { - let session_error = SessionError { - value: SessionErrorValue::SendFrameDataErr, - }; return Err(HttpFLvError { - value: HttpFLvErrorValue::SessionError(session_error), + value: HttpFLvErrorValue::SendFrameDataErr, }); } diff --git a/protocol/httpflv/src/lib.rs b/protocol/httpflv/src/lib.rs index f50d1467..0d483e19 100644 --- a/protocol/httpflv/src/lib.rs +++ b/protocol/httpflv/src/lib.rs @@ -1,5 +1,3 @@ -extern crate rtmp; - pub mod define; pub mod errors; pub mod httpflv; diff --git a/protocol/rtmp/CHANGELOG.md b/protocol/rtmp/CHANGELOG.md new file mode 100644 index 00000000..0a60c8e9 --- /dev/null +++ b/protocol/rtmp/CHANGELOG.md @@ -0,0 +1,94 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + + +## [Unreleased] - ReleaseDate + +## [0.6.2] - 2021-02-29 +- Move the amf0 mod to FLV library. + +## [0.6.1] +- Fix RTMP build error. + +## [0.6.0] +- Support auth. + +## [0.5.0] +- Remove no used "\n" for error message. +- Receive and process sub event result. +- Fix RTMP chunk parse error. +- Fix RTMP chunks are uncompressed in packetizer mod. +- Fix err: when encountering an unknown RTMP message type, it should be skipped rather than returning an error. +- Support remuxing from WHIP to rtmp. + +## [0.4.2] +- Reference streamhub new version v0.1.2. + +## [0.4.0] +- Reference bytesio v0.3.0. +- Support transferring from rtsp to rtmp. +- Do some refactoring. + +## [0.3.1] +- Fix error that cannot receive rtmp stream pushed from GStreamer. +- Reference xflv new version v0.2.1. +- Fix RTMP examples in README. + +## [0.3.0] +- Support notify stream status. +- Add HTTP API to kickoff clients. +- Fix some client session bugs. + +## [0.2.0] +- Support audio and video information statistics. + +## [0.1.0] +- Update RTMP library version. + +## [0.0.14] +- Fix handshake error.[#23] + +## [0.0.13] +- Add introductions and example codes in doc + +## [0.0.12] +- Fix overflow error.[#17] + +## [0.0.9] +- Support cache GOP; +- Fix bugs; +- Refactor handshake mod; + +## [0.0.8] +- Fix bugs; + +## [0.0.7] +- Fix bugs; +- Add detail logs; +- Improve subscriber id; + +## [0.0.6] +- Refactor some codes,update dependencies + +## [0.0.5] +- Support complex handshake + +## [0.0.4] +- Add timestamp for metadata + +## [0.0.3] +- Add amf0 functions + +## [0.0.2] +- Support rtmp relay pull and static push + +## [0.0.1] +- Support rtmp pushlish and play + + + diff --git a/protocol/rtmp/Cargo.toml b/protocol/rtmp/Cargo.toml index 31a4428c..4f766e90 100644 --- a/protocol/rtmp/Cargo.toml +++ b/protocol/rtmp/Cargo.toml @@ -21,7 +21,6 @@ sha2 = "0.9" log = "0.4" chrono = "0.4" indexmap = "1.9.3" -reqwest = "0.11.14" async-trait = "0.1.70" hex = "0.4" serde_json = { version = "1", default-features = false, features = [ @@ -33,9 +32,9 @@ serde = { version = "1.0", features = ["derive", "rc"] } bytesio = { path = "../../library/bytesio/" } streamhub = { path = "../../library/streamhub/" } -commonlib = { path = "../../library/common/" } h264-decoder = { path = "../../library/codec/h264/" } xflv = { path = "../../library/container/flv/" } +commonlib = { path = "../../library/common/" } [dependencies.tokio] version = "1.4.0" diff --git a/protocol/rtmp/README.md b/protocol/rtmp/README.md index 80b03627..007ed5b7 100644 --- a/protocol/rtmp/README.md +++ b/protocol/rtmp/README.md @@ -113,69 +113,4 @@ async fn main() -> Result<()> { } ``` - For more detailed implementation please reference to [xiu server](https://github.com/harlanc/xiu/blob/master/application/xiu/src/main.rs) - - - -# Version History -## v0.0.1 -- Support rtmp pushlish and play -## v0.0.2 -- Support rtmp relay pull and static push -## v0.0.3 -- Add amf0 functions -## v0.0.4 -- Add timestamp for metadata -## v0.0.5 -- Support complex handshake -## v0.0.6 -- Refactor some codes,update dependencies -## v0.0.7 -- Fix bugs; -- Add detail logs; -- Improve subscriber id; -## v0.0.8 -- Fix bugs; -## v0.0.9 -- Support cache GOP; -- Fix bugs; -- Refactor handshake mod; -## v0.0.12 -- Fix overflow error.[#17] -## v0.0.13 -- Add introductions and example codes in doc -## v0.0.14 -- Fix handshake error.[#23] -## v0.1.0 -- Update RTMP library version. -## v0.2.0 -- Support audio and video information statistics. -## v0.3.0 -- Support notify stream status. -- Add HTTP API to kickoff clients. -- Fix some client session bugs. -## v0.3.1 -- Fix error that cannot receive rtmp stream pushed from GStreamer. -- Reference xflv new version v0.2.1. -- Fix RTMP examples in README. -## v0.4.0 -- Reference bytesio v0.3.0. -- Support transferring from rtsp to rtmp. -- Do some refactoring. -## 0.4.2 -- Reference streamhub new version v0.1.2. -## v0.5.0 -- Remove no used "\n" for error message. -- Receive and process sub event result. -- Fix RTMP chunk parse error. -- Fix RTMP chunks are uncompressed in packetizer mod. -- Fix err: when encountering an unknown RTMP message type, it should be skipped rather than returning an error. -- Support remuxing from WHIP to rtmp. -## 0.6.0 -- Support auth. -## 0.6.1 -- Fix RTMP build error. - - - - + For more detailed implementation please reference to [xiu server](https://github.com/harlanc/xiu/blob/master/application/xiu/src/main.rs) \ No newline at end of file diff --git a/protocol/rtmp/src/cache/errors.rs b/protocol/rtmp/src/cache/errors.rs index fa046418..387f2a9a 100644 --- a/protocol/rtmp/src/cache/errors.rs +++ b/protocol/rtmp/src/cache/errors.rs @@ -1,10 +1,11 @@ use { - crate::{amf0::errors::Amf0WriteError, chunk::errors::PackError}, + crate::chunk::errors::PackError, bytesio::bytes_errors::BytesReadError, failure::{Backtrace, Fail}, h264_decoder::errors::H264Error, std::fmt, - xflv::errors::{FlvDemuxerError, MpegAacError, Mpeg4AvcHevcError}, + xflv::amf0::errors::Amf0WriteError, + xflv::errors::{FlvDemuxerError, Mpeg4AvcHevcError, MpegAacError}, }; #[derive(Debug, Fail)] diff --git a/protocol/rtmp/src/cache/metadata.rs b/protocol/rtmp/src/cache/metadata.rs index 4f366adb..6f789414 100644 --- a/protocol/rtmp/src/cache/metadata.rs +++ b/protocol/rtmp/src/cache/metadata.rs @@ -1,8 +1,7 @@ use { - super::errors::MetadataError, - crate::amf0::{amf0_reader::Amf0Reader, amf0_writer::Amf0Writer, Amf0ValueType}, bytes::BytesMut, bytesio::bytes_reader::BytesReader, + xflv::amf0::{amf0_reader::Amf0Reader, Amf0ValueType}, }; #[derive(Clone)] pub struct MetaData { @@ -30,16 +29,6 @@ impl MetaData { } } - //used for the http-flv protocol - pub fn remove_set_data_frame(&mut self) -> Result { - let mut amf_writer: Amf0Writer = Amf0Writer::new(); - amf_writer.write_string(&String::from("@setDataFrame"))?; - - let (_, right) = self.chunk_body.split_at(amf_writer.len()); - - Ok(BytesMut::from(right)) - } - pub fn is_metadata(&mut self, body: BytesMut) -> bool { let reader = BytesReader::new(body); let result = Amf0Reader::new(reader).read_all(); diff --git a/protocol/rtmp/src/chunk/unpacketizer.rs b/protocol/rtmp/src/chunk/unpacketizer.rs index 65695fd5..7ee5d5b5 100644 --- a/protocol/rtmp/src/chunk/unpacketizer.rs +++ b/protocol/rtmp/src/chunk/unpacketizer.rs @@ -666,7 +666,7 @@ mod tests { queue.push_back(3); queue.push_back(4); - for (_idx, data) in queue.iter().enumerate() { + for data in queue.iter() { println!("{}", data); } } diff --git a/protocol/rtmp/src/lib.rs b/protocol/rtmp/src/lib.rs index d4661a85..efea9768 100644 --- a/protocol/rtmp/src/lib.rs +++ b/protocol/rtmp/src/lib.rs @@ -8,7 +8,6 @@ extern crate rand; extern crate sha2; extern crate tokio; -pub mod amf0; pub mod cache; // pub mod channels; pub mod chunk; diff --git a/protocol/rtmp/src/messages/define.rs b/protocol/rtmp/src/messages/define.rs index 60db8406..b256f14d 100644 --- a/protocol/rtmp/src/messages/define.rs +++ b/protocol/rtmp/src/messages/define.rs @@ -1,4 +1,4 @@ -use {crate::amf0::define::Amf0ValueType, bytes::BytesMut}; +use {bytes::BytesMut, xflv::amf0::define::Amf0ValueType}; #[allow(dead_code)] pub struct SetPeerBandwidthProperties { diff --git a/protocol/rtmp/src/messages/errors.rs b/protocol/rtmp/src/messages/errors.rs index df865569..68bdc2d0 100644 --- a/protocol/rtmp/src/messages/errors.rs +++ b/protocol/rtmp/src/messages/errors.rs @@ -1,12 +1,12 @@ use { crate::{ - amf0::errors::Amf0ReadError, protocol_control_messages::errors::ProtocolControlMessageReaderError, user_control_messages::errors::EventMessagesError, }, - failure::{Backtrace, Fail}, bytesio::bytes_errors::BytesReadError, + failure::{Backtrace, Fail}, std::fmt, + xflv::amf0::errors::Amf0ReadError, }; #[derive(Debug, Fail)] diff --git a/protocol/rtmp/src/messages/parser.rs b/protocol/rtmp/src/messages/parser.rs index 4fd5f53a..479ef046 100644 --- a/protocol/rtmp/src/messages/parser.rs +++ b/protocol/rtmp/src/messages/parser.rs @@ -4,13 +4,13 @@ use { errors::MessageError, }, crate::{ - amf0::{amf0_markers, amf0_reader::Amf0Reader}, chunk::ChunkInfo, protocol_control_messages::reader::ProtocolControlMessageReader, user_control_messages::reader::EventMessagesReader, // utils, }, bytesio::bytes_reader::BytesReader, + xflv::amf0::{amf0_markers, amf0_reader::Amf0Reader}, }; pub struct MessageParser { diff --git a/protocol/rtmp/src/netconnection/errors.rs b/protocol/rtmp/src/netconnection/errors.rs index 4517fdd6..bad50ef3 100644 --- a/protocol/rtmp/src/netconnection/errors.rs +++ b/protocol/rtmp/src/netconnection/errors.rs @@ -1,10 +1,8 @@ use { - crate::{ - amf0::errors::{Amf0ReadError, Amf0WriteError}, - chunk::errors::PackError, - }, + crate::chunk::errors::PackError, failure::{Backtrace, Fail}, std::fmt, + xflv::amf0::errors::{Amf0ReadError, Amf0WriteError}, }; #[derive(Debug)] diff --git a/protocol/rtmp/src/netconnection/reader.rs b/protocol/rtmp/src/netconnection/reader.rs index f92f05b6..e9cd96de 100644 --- a/protocol/rtmp/src/netconnection/reader.rs +++ b/protocol/rtmp/src/netconnection/reader.rs @@ -1,6 +1,6 @@ use { - super::errors::NetConnectionError, crate::amf0::amf0_reader::Amf0Reader, - bytesio::bytes_reader::BytesReader, + super::errors::NetConnectionError, bytesio::bytes_reader::BytesReader, + xflv::amf0::amf0_reader::Amf0Reader, }; #[allow(dead_code)] diff --git a/protocol/rtmp/src/netconnection/writer.rs b/protocol/rtmp/src/netconnection/writer.rs index cf23f078..31e9bb5a 100644 --- a/protocol/rtmp/src/netconnection/writer.rs +++ b/protocol/rtmp/src/netconnection/writer.rs @@ -1,7 +1,6 @@ use { super::errors::NetConnectionError, crate::{ - amf0::{amf0_writer::Amf0Writer, define::Amf0ValueType}, chunk::{define as chunk_define, packetizer::ChunkPacketizer, ChunkInfo}, messages::define as messages_define, }, @@ -9,6 +8,7 @@ use { indexmap::IndexMap, std::sync::Arc, tokio::sync::Mutex, + xflv::amf0::{amf0_writer::Amf0Writer, define::Amf0ValueType}, }; #[derive(Clone, Default, Debug)] pub struct ConnectProperties { diff --git a/protocol/rtmp/src/netstream/errors.rs b/protocol/rtmp/src/netstream/errors.rs index e33630ef..364b3e86 100644 --- a/protocol/rtmp/src/netstream/errors.rs +++ b/protocol/rtmp/src/netstream/errors.rs @@ -1,7 +1,8 @@ use { - crate::{amf0::errors::Amf0WriteError, chunk::errors::PackError}, + crate::chunk::errors::PackError, failure::{Backtrace, Fail}, std::fmt, + xflv::amf0::errors::Amf0WriteError, }; #[derive(Debug)] diff --git a/protocol/rtmp/src/netstream/writer.rs b/protocol/rtmp/src/netstream/writer.rs index fd6e9513..c46f3874 100644 --- a/protocol/rtmp/src/netstream/writer.rs +++ b/protocol/rtmp/src/netstream/writer.rs @@ -1,7 +1,6 @@ use { super::errors::NetStreamError, crate::{ - amf0::{amf0_writer::Amf0Writer, define::Amf0ValueType}, chunk::{define as chunk_define, packetizer::ChunkPacketizer, ChunkInfo}, messages::define as messages_define, }, @@ -9,6 +8,7 @@ use { indexmap::IndexMap, std::sync::Arc, tokio::sync::Mutex, + xflv::amf0::{amf0_writer::Amf0Writer, define::Amf0ValueType}, }; pub struct NetStreamWriter { diff --git a/protocol/rtmp/src/remuxer/errors.rs b/protocol/rtmp/src/remuxer/errors.rs index adb51639..675e37a7 100644 --- a/protocol/rtmp/src/remuxer/errors.rs +++ b/protocol/rtmp/src/remuxer/errors.rs @@ -1,13 +1,12 @@ use { - crate::{ - amf0::errors::Amf0WriteError, cache::errors::MetadataError, session::errors::SessionError, - }, + crate::{cache::errors::MetadataError, session::errors::SessionError}, bytesio::bytes_errors::{BytesReadError, BytesWriteError}, failure::Fail, std::fmt, - streamhub::errors::ChannelError, + streamhub::errors::StreamHubError, tokio::sync::broadcast::error::RecvError, tokio::sync::oneshot::error::RecvError as OneshotRecvError, + xflv::amf0::errors::Amf0WriteError, xflv::errors::FlvMuxerError, xflv::errors::Mpeg4AvcHevcError, }; @@ -39,7 +38,7 @@ pub enum RtmpRemuxerErrorValue { #[fail(display = "stream hub event send error")] StreamHubEventSendErr, #[fail(display = "event execute error: {}", _0)] - ChannelError(#[cause] ChannelError), + ChannelError(#[cause] StreamHubError), #[fail(display = "tokio: oneshot receiver err: {}", _0)] OneshotRecvError(#[cause] OneshotRecvError), #[fail(display = "Channel receive error")] @@ -109,8 +108,8 @@ impl From for RtmpRemuxerError { } } -impl From for RtmpRemuxerError { - fn from(error: ChannelError) -> Self { +impl From for RtmpRemuxerError { + fn from(error: StreamHubError) -> Self { RtmpRemuxerError { value: RtmpRemuxerErrorValue::ChannelError(error), } diff --git a/protocol/rtmp/src/remuxer/rtmp_cooker.rs b/protocol/rtmp/src/remuxer/rtmp_cooker.rs index e0b208f1..a940a2cc 100644 --- a/protocol/rtmp/src/remuxer/rtmp_cooker.rs +++ b/protocol/rtmp/src/remuxer/rtmp_cooker.rs @@ -9,7 +9,7 @@ use xflv::{ }; use super::errors::RtmpRemuxerError; -use crate::amf0::{amf0_writer::Amf0Writer, Amf0ValueType}; +use xflv::amf0::{amf0_writer::Amf0Writer, Amf0ValueType}; #[derive(Default)] pub struct RtmpCooker {} diff --git a/protocol/rtmp/src/session/client_session.rs b/protocol/rtmp/src/session/client_session.rs index 958ff678..ecbd7970 100644 --- a/protocol/rtmp/src/session/client_session.rs +++ b/protocol/rtmp/src/session/client_session.rs @@ -8,7 +8,6 @@ use { errors::{SessionError, SessionErrorValue}, }, crate::{ - amf0::Amf0ValueType, chunk::{ define::CHUNK_SIZE, unpacketizer::{ChunkUnpacketizer, UnpackResult}, @@ -33,6 +32,7 @@ use { streamhub::utils::RandomDigitCount, streamhub::utils::Uuid, tokio::{net::TcpStream, sync::Mutex}, + xflv::amf0::Amf0ValueType, }; #[allow(dead_code)] diff --git a/protocol/rtmp/src/session/common.rs b/protocol/rtmp/src/session/common.rs index a7cb24ec..ced302d3 100644 --- a/protocol/rtmp/src/session/common.rs +++ b/protocol/rtmp/src/session/common.rs @@ -26,7 +26,7 @@ use { PublishType, PublisherInfo, StreamHubEvent, StreamHubEventSender, SubscribeType, SubscriberInfo, TStreamHandler, }, - errors::{ChannelError, ChannelErrorValue}, + errors::{StreamHubError, StreamHubErrorValue}, statistics::StreamStatistics, stream::StreamIdentifier, utils::Uuid, @@ -485,29 +485,29 @@ impl TStreamHandler for RtmpStreamHandler { &self, data_sender: DataSender, sub_type: SubscribeType, - ) -> Result<(), ChannelError> { + ) -> Result<(), StreamHubError> { let sender = match data_sender { DataSender::Frame { sender } => sender, DataSender::Packet { sender: _ } => { - return Err(ChannelError { - value: ChannelErrorValue::NotCorrectDataSenderType, + return Err(StreamHubError { + value: StreamHubErrorValue::NotCorrectDataSenderType, }); } }; if let Some(cache) = &mut *self.cache.lock().await { if let Some(meta_body_data) = cache.get_metadata() { - sender.send(meta_body_data).map_err(|_| ChannelError { - value: ChannelErrorValue::SendError, + sender.send(meta_body_data).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendError, })?; } if let Some(audio_seq_data) = cache.get_audio_seq() { - sender.send(audio_seq_data).map_err(|_| ChannelError { - value: ChannelErrorValue::SendError, + sender.send(audio_seq_data).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendError, })?; } if let Some(video_seq_data) = cache.get_video_seq() { - sender.send(video_seq_data).map_err(|_| ChannelError { - value: ChannelErrorValue::SendError, + sender.send(video_seq_data).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendError, })?; } match sub_type { @@ -518,8 +518,8 @@ impl TStreamHandler for RtmpStreamHandler { if let Some(gops_data) = cache.get_gops_data() { for gop in gops_data { for channel_data in gop.get_frame_data() { - sender.send(channel_data).map_err(|_| ChannelError { - value: ChannelErrorValue::SendError, + sender.send(channel_data).map_err(|_| StreamHubError { + value: StreamHubErrorValue::SendError, })?; } } diff --git a/protocol/rtmp/src/session/errors.rs b/protocol/rtmp/src/session/errors.rs index d4f2bfec..7ca306eb 100644 --- a/protocol/rtmp/src/session/errors.rs +++ b/protocol/rtmp/src/session/errors.rs @@ -1,6 +1,5 @@ use { crate::{ - amf0::errors::Amf0WriteError, cache::errors::CacheError, chunk::errors::{PackError, UnpackError}, handshake::errors::HandshakeError, @@ -14,8 +13,9 @@ use { commonlib::errors::AuthError, failure::{Backtrace, Fail}, std::fmt, - streamhub::errors::ChannelError, + streamhub::errors::StreamHubError, tokio::sync::oneshot::error::RecvError, + xflv::amf0::errors::Amf0WriteError, }; #[derive(Debug)] @@ -56,7 +56,7 @@ pub enum SessionErrorValue { #[fail(display = "tokio: oneshot receiver err: {}", _0)] RecvError(#[cause] RecvError), #[fail(display = "streamhub channel err: {}", _0)] - ChannelError(#[cause] ChannelError), + ChannelError(#[cause] StreamHubError), #[fail(display = "amf0 count not correct error")] Amf0ValueCountNotCorrect, @@ -196,8 +196,8 @@ impl From for SessionError { } } -impl From for SessionError { - fn from(error: ChannelError) -> Self { +impl From for SessionError { + fn from(error: StreamHubError) -> Self { SessionError { value: SessionErrorValue::ChannelError(error), } diff --git a/protocol/rtmp/src/session/server_session.rs b/protocol/rtmp/src/session/server_session.rs index 2ddb6ff4..2bd3d592 100644 --- a/protocol/rtmp/src/session/server_session.rs +++ b/protocol/rtmp/src/session/server_session.rs @@ -8,7 +8,6 @@ use { errors::{SessionError, SessionErrorValue}, }, crate::{ - amf0::Amf0ValueType, chunk::{ define::CHUNK_SIZE, unpacketizer::{ChunkUnpacketizer, UnpackResult}, @@ -35,6 +34,7 @@ use { utils::{RandomDigitCount, Uuid}, }, tokio::{net::TcpStream, sync::Mutex}, + xflv::amf0::Amf0ValueType, }; enum ServerSessionState { diff --git a/protocol/rtmp/src/user_control_messages/errors.rs b/protocol/rtmp/src/user_control_messages/errors.rs index 4cb88c00..6292e252 100644 --- a/protocol/rtmp/src/user_control_messages/errors.rs +++ b/protocol/rtmp/src/user_control_messages/errors.rs @@ -1,8 +1,8 @@ use { - crate::amf0::errors::Amf0WriteError, - failure::{Backtrace, Fail}, bytesio::bytes_errors::{BytesReadError, BytesWriteError}, + failure::{Backtrace, Fail}, std::fmt, + xflv::amf0::errors::Amf0WriteError, }; #[derive(Debug)] diff --git a/protocol/rtsp/CHANGELOG.md b/protocol/rtsp/CHANGELOG.md new file mode 100644 index 00000000..423fb3f7 --- /dev/null +++ b/protocol/rtsp/CHANGELOG.md @@ -0,0 +1,33 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + + +## [Unreleased] - ReleaseDate + +## [0.2.1] - 2021-02-29 +- Reference the new version streamhub library. + +## [0.2.0] +- Support auth. + +## [0.1.3] +- Remove no used "\n" for error message. +- Receive and process sub event result. + +## [0.1.2] +- Reference streamhub new version v0.1.2. + +## [0.1.0] +- Support subscribe/publish RTSP stream +- Support transfer from RTSP to RTMP/HTTP-FLV/HLS. + + + + + + diff --git a/protocol/rtsp/Cargo.toml b/protocol/rtsp/Cargo.toml index 3ada035c..f52a73d6 100644 --- a/protocol/rtsp/Cargo.toml +++ b/protocol/rtsp/Cargo.toml @@ -22,4 +22,4 @@ hex = "0.4.3" bytesio = { path = "../../library/bytesio/" } streamhub = { path = "../../library/streamhub/" } -commonlib = { path = "../../library/common/" } +commonlib = { path = "../../library/common/" } \ No newline at end of file diff --git a/protocol/rtsp/README.md b/protocol/rtsp/README.md index 11f16e24..54634c9b 100644 --- a/protocol/rtsp/README.md +++ b/protocol/rtsp/README.md @@ -1,12 +1,2 @@ A rtsp library. -## v0.1.0 -- Support subscribe/publish RTSP stream -- Support transfer from RTSP to RTMP/HTTP-FLV/HLS. -## v0.1.2 -- Reference streamhub new version v0.1.2. -## v0.1.3 -- Remove no used "\n" for error message. -- Receive and process sub event result. -## 0.2.0 -- Support auth. diff --git a/protocol/rtsp/src/rtp/rtp_aac.rs b/protocol/rtsp/src/rtp/rtp_aac.rs index 01d954e7..b35dc145 100644 --- a/protocol/rtsp/src/rtp/rtp_aac.rs +++ b/protocol/rtsp/src/rtp/rtp_aac.rs @@ -64,7 +64,7 @@ impl TPacker for RtpAacPacker { packet.payload.put(data); if let Some(f) = &self.on_packet_for_rtcp_handler { - f(packet.clone()); + f(packet.clone()).await; } if let Some(f) = &self.on_packet_handler { @@ -114,12 +114,13 @@ impl RtpAacUnPacker { } } +#[async_trait] impl TUnPacker for RtpAacUnPacker { - fn unpack(&mut self, reader: &mut BytesReader) -> Result<(), UnPackerError> { + async fn unpack(&mut self, reader: &mut BytesReader) -> Result<(), UnPackerError> { let rtp_packet = RtpPacket::unmarshal(reader)?; if let Some(f) = &self.on_packet_for_rtcp_handler { - f(rtp_packet.clone()); + f(rtp_packet.clone()).await; } let mut reader_payload = BytesReader::new(rtp_packet.payload); diff --git a/protocol/rtsp/src/rtp/rtp_h264.rs b/protocol/rtsp/src/rtp/rtp_h264.rs index 8284b629..e3e7af12 100644 --- a/protocol/rtsp/src/rtp/rtp_h264.rs +++ b/protocol/rtsp/src/rtp/rtp_h264.rs @@ -84,7 +84,7 @@ impl RtpH264Packer { packet.header.marker = if fu_header & define::FU_END > 0 { 1 } else { 0 }; if let Some(f) = &self.on_packet_for_rtcp_handler { - f(packet.clone()); + f(packet.clone()).await; } if let Some(f) = &self.on_packet_handler { @@ -107,7 +107,7 @@ impl RtpH264Packer { self.header.seq_number += 1; if let Some(f) = &self.on_packet_for_rtcp_handler { - f(packet.clone()); + f(packet.clone()).await; } if let Some(f) = &self.on_packet_handler { @@ -159,12 +159,13 @@ pub struct RtpH264UnPacker { on_packet_for_rtcp_handler: Option, } +#[async_trait] impl TUnPacker for RtpH264UnPacker { - fn unpack(&mut self, reader: &mut BytesReader) -> Result<(), UnPackerError> { + async fn unpack(&mut self, reader: &mut BytesReader) -> Result<(), UnPackerError> { let rtp_packet = RtpPacket::unmarshal(reader)?; if let Some(f) = &self.on_packet_for_rtcp_handler { - f(rtp_packet.clone()); + f(rtp_packet.clone()).await; } self.timestamp = rtp_packet.header.timestamp; diff --git a/protocol/rtsp/src/rtp/rtp_h265.rs b/protocol/rtsp/src/rtp/rtp_h265.rs index 6060a9a0..3caf6d36 100644 --- a/protocol/rtsp/src/rtp/rtp_h265.rs +++ b/protocol/rtsp/src/rtp/rtp_h265.rs @@ -108,7 +108,7 @@ impl RtpH265Packer { } if let Some(f) = &self.on_packet_for_rtcp_handler { - f(packet.clone()); + f(packet.clone()).await; } if let Some(f) = &self.on_packet_handler { @@ -128,7 +128,7 @@ impl RtpH265Packer { self.header.seq_number += 1; if let Some(f) = &self.on_packet_for_rtcp_handler { - f(packet.clone()); + f(packet.clone()).await; } if let Some(f) = &self.on_packet_handler { @@ -178,12 +178,13 @@ pub struct RtpH265UnPacker { on_packet_for_rtcp_handler: Option, } +#[async_trait] impl TUnPacker for RtpH265UnPacker { - fn unpack(&mut self, reader: &mut BytesReader) -> Result<(), UnPackerError> { + async fn unpack(&mut self, reader: &mut BytesReader) -> Result<(), UnPackerError> { let rtp_packet = RtpPacket::unmarshal(reader)?; if let Some(f) = &self.on_packet_for_rtcp_handler { - f(rtp_packet.clone()); + f(rtp_packet.clone()).await; } self.timestamp = rtp_packet.header.timestamp; diff --git a/protocol/rtsp/src/rtp/utils.rs b/protocol/rtsp/src/rtp/utils.rs index 6f9ac3e0..f9eb1d3e 100644 --- a/protocol/rtsp/src/rtp/utils.rs +++ b/protocol/rtsp/src/rtp/utils.rs @@ -58,9 +58,10 @@ pub trait TVideoPacker: TPacker { async fn pack_nalu(&mut self, nalu: BytesMut) -> Result<(), PackerError>; } +#[async_trait] pub trait TUnPacker: TRtpReceiverForRtcp + Send + Sync { /*Assemble rtp fragments into complete frame and send to stream hub*/ - fn unpack(&mut self, reader: &mut BytesReader) -> Result<(), UnPackerError>; + async fn unpack(&mut self, reader: &mut BytesReader) -> Result<(), UnPackerError>; /*Call back function used for processing a frame.*/ fn on_frame_handler(&mut self, f: OnFrameFn); } diff --git a/protocol/rtsp/src/rtsp_channel.rs b/protocol/rtsp/src/rtsp_channel.rs index bd1a4c57..1d48fa20 100644 --- a/protocol/rtsp/src/rtsp_channel.rs +++ b/protocol/rtsp/src/rtsp_channel.rs @@ -69,9 +69,9 @@ impl RtpChannel { } //Receive av frame from network -> pack AV frame to RTP packet -> send to stream hub - pub fn on_packet(&mut self, reader: &mut BytesReader) -> Result<(), UnPackerError> { + pub async fn on_packet(&mut self, reader: &mut BytesReader) -> Result<(), UnPackerError> { if let Some(unpacker) = &mut self.rtp_unpacker { - unpacker.unpack(reader)?; + unpacker.unpack(reader).await?; } Ok(()) } diff --git a/protocol/rtsp/src/rtsp_track.rs b/protocol/rtsp/src/rtsp_track.rs index 49b6a478..347388ef 100644 --- a/protocol/rtsp/src/rtsp_track.rs +++ b/protocol/rtsp/src/rtsp_track.rs @@ -63,7 +63,7 @@ impl RtspTrack { match rtp_io.read().await { Ok(data) => { reader.extend_from_slice(&data[..]); - if let Err(err) = rtp_channel_in.on_packet(&mut reader) { + if let Err(err) = rtp_channel_in.on_packet(&mut reader).await { log::error!("rtp_receive_loop on_packet error: {}", err); } } @@ -111,7 +111,7 @@ impl RtspTrack { } pub async fn on_rtp(&mut self, reader: &mut BytesReader) -> Result<(), UnPackerError> { - self.rtp_channel.lock().await.on_packet(reader) + self.rtp_channel.lock().await.on_packet(reader).await } pub async fn on_rtcp( diff --git a/protocol/rtsp/src/session/errors.rs b/protocol/rtsp/src/session/errors.rs index 9c6c25f9..d594de6a 100644 --- a/protocol/rtsp/src/session/errors.rs +++ b/protocol/rtsp/src/session/errors.rs @@ -6,7 +6,7 @@ use { failure::{Backtrace, Fail}, std::fmt, std::str::Utf8Error, - streamhub::errors::ChannelError, + streamhub::errors::StreamHubError, tokio::sync::oneshot::error::RecvError, }; @@ -34,7 +34,7 @@ pub enum SessionErrorValue { #[fail(display = "pack error: {}", _0)] PackerError(#[cause] PackerError), #[fail(display = "event execute error: {}", _0)] - ChannelError(#[cause] ChannelError), + ChannelError(#[cause] StreamHubError), #[fail(display = "tokio: oneshot receiver err: {}", _0)] RecvError(#[cause] RecvError), #[fail(display = "auth err: {}", _0)] @@ -91,8 +91,8 @@ impl From for SessionError { } } -impl From for SessionError { - fn from(error: ChannelError) -> Self { +impl From for SessionError { + fn from(error: StreamHubError) -> Self { SessionError { value: SessionErrorValue::ChannelError(error), } diff --git a/protocol/rtsp/src/session/mod.rs b/protocol/rtsp/src/session/mod.rs index e35c0d1b..5d014005 100644 --- a/protocol/rtsp/src/session/mod.rs +++ b/protocol/rtsp/src/session/mod.rs @@ -55,7 +55,7 @@ use streamhub::{ FrameData, Information, InformationSender, NotifyInfo, PublishType, PublisherInfo, StreamHubEvent, StreamHubEventSender, SubscribeType, SubscriberInfo, TStreamHandler, }, - errors::{ChannelError, ChannelErrorValue}, + errors::{StreamHubError, StreamHubErrorValue}, statistics::StreamStatistics, stream::StreamIdentifier, utils::{RandomDigitCount, Uuid}, @@ -745,12 +745,12 @@ impl TStreamHandler for RtspStreamHandler { &self, data_sender: DataSender, sub_type: SubscribeType, - ) -> Result<(), ChannelError> { + ) -> Result<(), StreamHubError> { let sender = match data_sender { DataSender::Frame { sender } => sender, DataSender::Packet { sender: _ } => { - return Err(ChannelError { - value: ChannelErrorValue::NotCorrectDataSenderType, + return Err(StreamHubError { + value: StreamHubErrorValue::NotCorrectDataSenderType, }); } }; diff --git a/protocol/webrtc/CHANGELOG.md b/protocol/webrtc/CHANGELOG.md new file mode 100644 index 00000000..a6d27096 --- /dev/null +++ b/protocol/webrtc/CHANGELOG.md @@ -0,0 +1,32 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](http://keepachangelog.com/) +and this project adheres to [Semantic Versioning](http://semver.org/). + + + +## [Unreleased] - ReleaseDate + +## [0.3.1] - 2021-02-29 +- Update the opus library from opus-rs to audiopus for cross compile。 + +## [0.3.0] +- Support auth. + +## [0.2.0] +- Remove no used "\n" for error message. +- Receive and process sub event result. +- Support remux from WHIP to RTMP. + +## [0.1.1] +- Support receiving RTC stream using Whip +- Support sending RTC stream using Whep + + + + + + + diff --git a/protocol/webrtc/Cargo.toml b/protocol/webrtc/Cargo.toml index 7718dec8..7057b8af 100644 --- a/protocol/webrtc/Cargo.toml +++ b/protocol/webrtc/Cargo.toml @@ -17,10 +17,10 @@ bytes = "1.0.0" tokio = "1.4.0" failure = "0.1.1" log = "0.4" -webrtc = "0.8.0" +webrtc = "0.10.1" async-trait = "0.1.70" fdk-aac = "0.6.0" -opus = "0.3.0" +audiopus = "0.3.0-rc.0" bytesio = { path = "../../library/bytesio/" } streamhub = { path = "../../library/streamhub/" } diff --git a/protocol/webrtc/README.md b/protocol/webrtc/README.md index a9ee5d64..39d700ff 100644 --- a/protocol/webrtc/README.md +++ b/protocol/webrtc/README.md @@ -1,12 +1,3 @@ A webrtc library. -## v0.1.1 -- Support receiving RTC stream using Whip -- Support sending RTC stream using Whep -## v0.2.0 -- Remove no used "\n" for error message. -- Receive and process sub event result. -- Support remux from WHIP to RTMP. -## 0.3.0 -- Support auth. diff --git a/protocol/webrtc/src/errors.rs b/protocol/webrtc/src/errors.rs index 830f3722..4185c2a7 100644 --- a/protocol/webrtc/src/errors.rs +++ b/protocol/webrtc/src/errors.rs @@ -1,7 +1,7 @@ use { + audiopus::error::Error as OpusError, failure::{Backtrace, Fail}, fdk_aac::enc::EncoderError as AacEncoderError, - opus::Error as OpusError, std::fmt, std::num::ParseIntError, webrtc::error::Error as RTCError, diff --git a/protocol/webrtc/src/opus2aac.rs b/protocol/webrtc/src/opus2aac.rs index 07238e2d..6af68634 100644 --- a/protocol/webrtc/src/opus2aac.rs +++ b/protocol/webrtc/src/opus2aac.rs @@ -1,6 +1,7 @@ use crate::errors::Opus2AacError; +use audiopus::coder::Decoder as OpusDecoder; +use audiopus::MutSignals; use fdk_aac::enc::{Encoder as AacEncoder, EncoderParams}; -use opus::Decoder as OpusDecoder; pub struct Opus2AacTranscoder { decoder_channels_size: usize, decoder: OpusDecoder, @@ -10,12 +11,15 @@ pub struct Opus2AacTranscoder { impl Opus2AacTranscoder { pub fn new( - decoder_sample_rate: u32, - decoder_channels: opus::Channels, + decoder_sample_rate: i32, + decoder_channels: audiopus::Channels, encoder_sample_rate: u32, encoder_channels: fdk_aac::enc::ChannelMode, ) -> Result { - let decoder = OpusDecoder::new(decoder_sample_rate, decoder_channels)?; + let decoder = OpusDecoder::new( + audiopus::SampleRate::try_from(decoder_sample_rate)?, + decoder_channels, + )?; let encoder = AacEncoder::new(EncoderParams { bit_rate: fdk_aac::enc::BitRate::VbrMedium, transport: fdk_aac::enc::Transport::Raw, @@ -24,8 +28,8 @@ impl Opus2AacTranscoder { })?; let decoder_channels_size = match decoder_channels { - opus::Channels::Stereo => 2, - opus::Channels::Mono => 1, + audiopus::Channels::Stereo | audiopus::Channels::Auto => 2, + audiopus::Channels::Mono => 1, }; Ok(Opus2AacTranscoder { @@ -39,7 +43,11 @@ impl Opus2AacTranscoder { pub fn transcode(&mut self, input: &[u8]) -> Result>, Opus2AacError> { //https://opus-codec.org/docs/opus_api-1.1.2/group__opus__decoder.html#ga7d1111f64c36027ddcb81799df9b3fc9 let mut pcm_output: Vec = vec![0; 1024 * 2]; - let pcm_output_len = self.decoder.decode(input, &mut pcm_output[..], false)?; + let input_packet = audiopus::packet::Packet::try_from(input)?; + let mut_signals = MutSignals::try_from(&mut pcm_output)?; + let pcm_output_len = self + .decoder + .decode(Some(input_packet), mut_signals, false)?; self.pcm_data .extend_from_slice(&pcm_output[..pcm_output_len * self.decoder_channels_size]); diff --git a/protocol/webrtc/src/session/errors.rs b/protocol/webrtc/src/session/errors.rs index ddf30dbc..280b4f1e 100644 --- a/protocol/webrtc/src/session/errors.rs +++ b/protocol/webrtc/src/session/errors.rs @@ -1,4 +1,4 @@ -use streamhub::errors::ChannelError; +use streamhub::errors::StreamHubError; use { bytesio::bytes_errors::BytesReadError, bytesio::{bytes_errors::BytesWriteError, bytesio_errors::BytesIOError}, @@ -26,7 +26,7 @@ pub enum SessionErrorValue { #[fail(display = "Utf8Error: {}", _0)] Utf8Error(#[cause] Utf8Error), #[fail(display = "event execute error: {}", _0)] - ChannelError(#[cause] ChannelError), + ChannelError(#[cause] StreamHubError), #[fail(display = "webrtc error: {}", _0)] RTCError(#[cause] RTCError), #[fail(display = "tokio: oneshot receiver err: {}", _0)] @@ -89,8 +89,8 @@ impl From for SessionError { } } -impl From for SessionError { - fn from(error: ChannelError) -> Self { +impl From for SessionError { + fn from(error: StreamHubError) -> Self { SessionError { value: SessionErrorValue::ChannelError(error), } diff --git a/protocol/webrtc/src/session/mod.rs b/protocol/webrtc/src/session/mod.rs index 1c89c0ff..ca1a6f4a 100644 --- a/protocol/webrtc/src/session/mod.rs +++ b/protocol/webrtc/src/session/mod.rs @@ -4,7 +4,7 @@ use streamhub::{ DataSender, InformationSender, NotifyInfo, PublishType, PublisherInfo, StreamHubEvent, StreamHubEventSender, SubscribeType, SubscriberInfo, TStreamHandler, }, - errors::ChannelError, + errors::StreamHubError, statistics::StreamStatistics, stream::StreamIdentifier, utils::{RandomDigitCount, Uuid}, @@ -562,7 +562,7 @@ impl TStreamHandler for WebRTCStreamHandler { &self, _data_sender: DataSender, _sub_type: SubscribeType, - ) -> Result<(), ChannelError> { + ) -> Result<(), StreamHubError> { Ok(()) } async fn get_statistic_data(&self) -> Option { diff --git a/protocol/webrtc/src/whip.rs b/protocol/webrtc/src/whip.rs index 84cab1d7..dcc05d4b 100644 --- a/protocol/webrtc/src/whip.rs +++ b/protocol/webrtc/src/whip.rs @@ -185,7 +185,7 @@ pub async fn handle_whip( let mut vcodec: VideoCodecType = VideoCodecType::H264; let mut opus2aac_transcoder = Opus2AacTranscoder::new( 48000, - opus::Channels::Stereo, + audiopus::Channels::Stereo, 48000, fdk_aac::enc::ChannelMode::Stereo, ) @@ -212,13 +212,13 @@ pub async fn handle_whip( audio_codec = codec; let channels = match audio_codec.encoding_parameters.as_str() { - "1" => opus::Channels::Mono, - "2" => opus::Channels::Stereo, - _ => opus::Channels::Stereo, + "1" => audiopus::Channels::Mono, + "2" => audiopus::Channels::Stereo, + _ => audiopus::Channels::Stereo, }; opus2aac_transcoder = Opus2AacTranscoder::new( - audio_codec.clock_rate, + audio_codec.clock_rate as i32, channels, audio_codec.clock_rate, fdk_aac::enc::ChannelMode::Stereo,