diff --git a/.github/workflows/RockyArm64_build.yml b/.github/workflows/RockyArm64_build.yml new file mode 100644 index 0000000..a07eaa0 --- /dev/null +++ b/.github/workflows/RockyArm64_build.yml @@ -0,0 +1,80 @@ +name: rocky Arm64 build workflows + +on: + push: + branches: + - 'develop' + paths: + - 'XEngine_Source/**' + - 'XEngine_Release/**' + - '.github/**' + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-24.04 + env: + IMAGE_NAME: rockylinux/rockylinux:9.5 + + strategy: + fail-fast: false + matrix: + arch: [linux/arm64] + + steps: + # 检出您的主仓库代码 + - name: Checkout main repository code + uses: actions/checkout@v4 + with: + ref: 'develop' + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Build ${{ matrix.arch }} + run: | + docker run --platform ${{ matrix.arch }} --rm \ + -v ${{ github.workspace }}:/workspace \ + -w /workspace ${{ env.IMAGE_NAME }} /bin/sh -c ' + set -e + dnf update -y + dnf install --allowerasing git make g++ wget curl jq unzip -y + + git config --global --add safe.directory /workspace + git submodule init + git submodule update + + latest_tag=$(curl -s https://api.github.com/repos/libxengine/libxengine/releases/latest | jq -r .tag_name) + wget https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_RockyLinux_9_Arm64.zip + unzip ./XEngine_RockyLinux_9_Arm64.zip -d ./XEngine_RockyLinux_9_Arm64 + cd XEngine_RockyLinux_9_Arm64 + + chmod 777 ./XEngine_LINEnv.sh + ./XEngine_LINEnv.sh -i 0 + + dnf install libsrtp-devel srt-devel -y + + cp -rf ./XEngine_Include /usr/local/include + find ./XEngine_Linux -name "*.so" -exec cp {} /usr/lib64 \; + ldconfig + cd .. + + cd XEngine_Source + make ARCH=Arm64 RELEASE=1 + make FLAGS=InstallAll + make FLAGS=CleanAll + cd .. + + cd XEngine_Release + ./XEngine_StreamMediaApp -t + chown -R $(id -u):$(id -g) . + chmod -R a+r . ' + + - name: Upload folder as artifact with RockyLinux + uses: actions/upload-artifact@v4 + with: + name: XEngine_StreamMediaApp-RockyLinux_9_Arm64 + path: XEngine_Release/ + retention-days: 1 diff --git a/.github/workflows/RockyX86_64_build.yml b/.github/workflows/RockyX86_64_build.yml new file mode 100644 index 0000000..de5c3a7 --- /dev/null +++ b/.github/workflows/RockyX86_64_build.yml @@ -0,0 +1,85 @@ +name: rocky x86_64 build workflows + +on: + push: + branches: + - 'develop' + paths: + - 'XEngine_Source/**' + - 'XEngine_Release/**' + - '.github/**' + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + container: + image: rockylinux/rockylinux:9.5 + + steps: + # 检出您的主仓库代码 + - name: Checkout main repository code + uses: actions/checkout@v4 + with: + ref: 'develop' + + # 检出依赖的xengine仓库到指定的xengine目录 + - name: Checkout dependency repository (xengine) + uses: actions/checkout@v4 + with: + repository: libxengine/libxengine + path: libxengine + + - name: sub module checkout (opensource) + uses: actions/checkout@v4 + with: + repository: libxengine/XEngine_OPenSource + path: XEngine_Source/XEngine_Depend + + - name: install system package + run: | + dnf update -y + dnf install gcc g++ make git jq unzip -y + # 设置依赖库的环境变量 + - name: Set up Dependency rocky linux Environment + run: | + cd libxengine + chmod 777 * + ./XEngine_LINEnv.sh -i 0 + dnf install libsrtp-devel srt-devel -y + + - name: install xengine library + run: | + latest_tag=$(curl -s https://api.github.com/repos/libxengine/libxengine/releases/latest | jq -r .tag_name) + wget https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_RockyLinux_9_x86-64.zip + unzip ./XEngine_RockyLinux_9_x86-64.zip -d ./XEngine_RockyLinux_9_x86-64 + cd XEngine_RockyLinux_9_x86-64 + + cp -rf ./XEngine_Include /usr/local/include + find ./XEngine_Linux -name "*.so" -exec cp {} /usr/lib64 \; + ldconfig + + - name: make + run: | + cd XEngine_Source + make + make FLAGS=InstallAll + make FLAGS=CleanAll + + make RELEASE=1 + make FLAGS=InstallAll + make FLAGS=CleanAll + + - name: test + run: | + cd XEngine_Release + ./XEngine_StreamMediaApp -t + + - name: Upload folder as artifact with RockyLinux + uses: actions/upload-artifact@v4 + with: + name: XEngine_StreamMediaApp-RockyLinux_9_x86_64 + path: XEngine_Release/ + retention-days: 1 diff --git a/.github/workflows/UbuntuArm64_build.yml b/.github/workflows/UbuntuArm64_build.yml new file mode 100644 index 0000000..f564013 --- /dev/null +++ b/.github/workflows/UbuntuArm64_build.yml @@ -0,0 +1,75 @@ +name: ubuntu Arm64 build workflows + +on: + push: + branches: + - 'develop' + paths: + - 'XEngine_Source/**' + - 'XEngine_Release/**' + - '.github/**' + +jobs: + build: + runs-on: ubuntu-24.04 + env: + IMAGE_NAME: ubuntu:24.04 + + strategy: + fail-fast: false + matrix: + arch: [linux/arm64] + + steps: + - name: Checkout main repository code + uses: actions/checkout@v4 + with: + ref: 'develop' + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Build ${{ matrix.arch }} + run: | + docker run --platform ${{ matrix.arch }} --rm \ + -v ${{ github.workspace }}:/workspace \ + -w /workspace ${{ env.IMAGE_NAME }} /bin/sh -c ' + set -e + apt update -y + apt install git make g++ wget curl jq unzip -y + apt install libsrt-gnutls-dev libsrtp2-dev -y + + git config --global --add safe.directory /workspace + git submodule init + git submodule update + + latest_tag=$(curl -s https://api.github.com/repos/libxengine/libxengine/releases/latest | jq -r .tag_name) + wget https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_UBuntu_24.04_Arm64.zip + unzip ./XEngine_UBuntu_24.04_Arm64.zip -d ./XEngine_UBuntu_24.04_Arm64 + cd XEngine_UBuntu_24.04_Arm64 + + chmod 777 ./XEngine_LINEnv.sh + ./XEngine_LINEnv.sh -i 0 + + cp -rf ./XEngine_Include /usr/local/include + find ./XEngine_Linux -name "*.so" -exec cp {} /usr/local/lib \; + ldconfig + cd .. + + cd XEngine_Source + make ARCH=Arm64 RELEASE=1 + make FLAGS=InstallAll + make FLAGS=CleanAll + cd .. + + cd XEngine_Release + ./XEngine_StreamMediaApp -t + chown -R $(id -u):$(id -g) . + chmod -R a+r . ' + + - name: Upload folder as artifact with ubuntu Arm64 + uses: actions/upload-artifact@v4 + with: + name: XEngine_StreamMediaApp-Ubuntu_24.04_Arm64 + path: XEngine_Release/ + retention-days: 1 \ No newline at end of file diff --git a/.github/workflows/macbuild.yml b/.github/workflows/macbuild.yml index 1a36dc8..2e814f0 100644 --- a/.github/workflows/macbuild.yml +++ b/.github/workflows/macbuild.yml @@ -80,8 +80,7 @@ jobs: make PLATFORM=mac FLAGS=InstallAll make PLATFORM=mac FLAGS=CleanAll - - name: test (srt bug on macos-arm64,not run) - if: matrix.os == 'macos-13' + - name: test (srt bug on macos,not run) run: | cd XEngine_Release ./XEngine_StreamMediaApp -t @@ -90,13 +89,13 @@ jobs: if: matrix.os == 'macos-13' uses: actions/upload-artifact@v4 with: - name: XEngine_StreamMediaApp-x86_64-Mac + name: XEngine_StreamMediaApp-Mac_x86_64 path: XEngine_Release/ - retention-days: 3 + retention-days: 1 - name: Upload folder as artifact with mac arm if: matrix.os == 'macos-14' uses: actions/upload-artifact@v4 with: - name: XEngine_StreamMediaApp-Arm64-Mac + name: XEngine_StreamMediaApp-Mac_Arm64 path: XEngine_Release/ - retention-days: 3 \ No newline at end of file + retention-days: 1 \ No newline at end of file diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index 713c01b..7795dc7 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -18,7 +18,7 @@ jobs: fail-fast: false matrix: configuration: [Debug ,Release] - platform: [x86 ,x64] + platform: [x86 ,x64 ,ARM64] runs-on: windows-latest @@ -62,6 +62,14 @@ jobs: ./vcpkg.exe install libsrt:x64-windows libsrtp:x64-windows ./vcpkg.exe integrate install shell: pwsh + - name: vcpkg install (ARM64) + if: matrix.platform == 'ARM64' + run: | + cd vcpkg + ./bootstrap-vcpkg.bat + ./vcpkg.exe install libsrt:Arm64-windows libsrtp:Arm64-windows + ./vcpkg.exe integrate install + shell: pwsh - name: Set up Dependency x86_64 Environment if: matrix.platform == 'x64' @@ -83,6 +91,20 @@ jobs: echo "XENGINE_INCLUDE=${{ github.workspace }}/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append echo "XENGINE_LIB32=${{ github.workspace }}/XEngine_Windows/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append shell: pwsh + - name: Set up Dependency ARM64 Environment + if: matrix.platform == 'ARM64' + run: | + $response = Invoke-RestMethod -Uri "https://api.github.com/repos/libxengine/libxengine/releases/latest" -Headers @{"Accept"="application/vnd.github.v3+json"} + $latest_tag = $response.tag_name + Write-Host "Latest Tag: $latest_tag" + + $url = "https://github.com/libxengine/libxengine/releases/download/$latest_tag/XEngine_Windows_Arm64.zip" + Invoke-WebRequest -Uri $url -OutFile "XEngine_Windows_Arm64.zip" + Expand-Archive -Path ./XEngine_Windows_Arm64.zip -DestinationPath ./XEngine_Windows -Force + + echo "XENGINE_INCLUDE=${{ github.workspace }}/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append + echo "XENGINE_LIBARM64=${{ github.workspace }}/XEngine_Windows/XEngine_Windows" | Out-File -FilePath $env:GITHUB_ENV -Append + shell: pwsh - name: Setup MSBuild uses: microsoft/setup-msbuild@v2 @@ -109,19 +131,35 @@ jobs: cd XEngine_Release .\VSCopy_x64.bat shell: pwsh + - name: Conditional Step for ARM64 Release + if: matrix.configuration == 'Release' && matrix.platform == 'ARM64' + run: | + cp -r XEngine_Source/ARM64/Release/*.dll XEngine_Release/ + cp -r XEngine_Source/ARM64/Release/*.exe XEngine_Release/ + cp -r XEngine_Source/VSCopy_Arm64.bat XEngine_Release/ + cd XEngine_Release + .\VSCopy_Arm64.bat + shell: pwsh - name: Upload folder as artifact with x86 if: matrix.configuration == 'Release' && matrix.platform == 'x86' uses: actions/upload-artifact@v4 with: - name: XEngine_StreamMediaApp-x86_32-Windows + name: XEngine_StreamMediaApp-Windows_x86_32 path: XEngine_Release/ - retention-days: 3 + retention-days: 1 - name: Upload folder as artifact with x64 if: matrix.configuration == 'Release' && matrix.platform == 'x64' uses: actions/upload-artifact@v4 with: - name: XEngine_StreamMediaApp-x86_64-Windows + name: XEngine_StreamMediaApp-Windows_x86_64 + path: XEngine_Release/ + retention-days: 1 + - name: Upload folder as artifact with ARM64 + if: matrix.configuration == 'Release' && matrix.platform == 'ARM64' + uses: actions/upload-artifact@v4 + with: + name: XEngine_StreamMediaApp-Windows_Arm64 path: XEngine_Release/ - retention-days: 3 \ No newline at end of file + retention-days: 1 \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0c200df..434cafc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,10 +15,37 @@ jobs: with: fetch-depth: 0 - - name: Download ubuntubuild + - name: Download x86_64 ubuntu build uses: dawidd6/action-download-artifact@v6 with: - workflow: ubuntubuild.yml + workflow: ubuntux86_64_build.yml + workflow_conclusion: success + check_artifacts: false + skip_unpack: true + if_no_artifact_found: fail + path: ./XRelease/ + - name: Download Arm64 ubuntu build + uses: dawidd6/action-download-artifact@v6 + with: + workflow: UbuntuArm64_build.yml + workflow_conclusion: success + check_artifacts: false + skip_unpack: true + if_no_artifact_found: fail + path: ./XRelease/ + - name: Download x86_64 rockylinux build + uses: dawidd6/action-download-artifact@v6 + with: + workflow: RockyX86_64_build.yml + workflow_conclusion: success + check_artifacts: false + skip_unpack: true + if_no_artifact_found: fail + path: ./XRelease/ + - name: Download Arm64 rockylinux build + uses: dawidd6/action-download-artifact@v6 + with: + workflow: RockyArm64_build.yml workflow_conclusion: success check_artifacts: false skip_unpack: true diff --git a/.github/workflows/ubuntubuild.yml b/.github/workflows/ubuntux86_64_build.yml similarity index 94% rename from .github/workflows/ubuntubuild.yml rename to .github/workflows/ubuntux86_64_build.yml index 8fd36e1..3516963 100644 --- a/.github/workflows/ubuntubuild.yml +++ b/.github/workflows/ubuntux86_64_build.yml @@ -87,13 +87,13 @@ jobs: if: matrix.os == 'ubuntu-22.04' uses: actions/upload-artifact@v4 with: - name: XEngine_StreamMediaApp-x86_64-Ubuntu-22.04 + name: XEngine_StreamMediaApp-Ubuntu_22.04_x86_64 path: XEngine_Release/ - retention-days: 3 + retention-days: 1 - name: Upload folder as artifact with ubuntu24.04 if: matrix.os == 'ubuntu-24.04' uses: actions/upload-artifact@v4 with: - name: XEngine_StreamMediaApp-x86_64-Ubuntu-24.04 + name: XEngine_StreamMediaApp-Ubuntu_24.04_x86_64 path: XEngine_Release/ - retention-days: 3 \ No newline at end of file + retention-days: 1 \ No newline at end of file diff --git a/CHANGELOG b/CHANGELOG index 14d18b2..93beff2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,23 @@ +XEngine_StreamMedia V2.11.0.1001 + +增加:预拉流的协议支持 +增加:更多系统发布版本支持 +更新:xengine 最新版本匹配 +更新:三方库 +修改:推流的数据使用了内存池技术 +修改:当debug模式的时候不报告信息 +修复:日志输出错误增加日志类型支持 +修复:当拉流请求的时候现在可以正常响应成功失败了 + +added:pre pull stream support for xstream ts srt rtmp flv +added:more release system supported +update:xengine newer version supported +update:depend library +modify:use memory pool for memory of push stream +modify:does not report info when debug start +fixed:log print error and log type support +fixed:reply error when strema not found for rtmp and flv and xstream with play +======================================================= XEngine_StreamMedia V2.10.0.1001 增加:windows coredump支持 diff --git a/README.en.md b/README.en.md index 73c9294..06b75dc 100644 --- a/README.en.md +++ b/README.en.md @@ -27,6 +27,7 @@ feature: 11. Support text language transcription (planning) 12. Support recording (planning) 13. Support audio and video recoding (planning) +14. Support pre-pull stream Publish Stream: diff --git a/README.md b/README.md index d4f7c82..ffb1b12 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ c c++ streammedia server 11. 支持文本语言转录(planning) 12. 支持录像(planning) 13. 支持音视频重编解码(planning) +14. 支持预拉流 推流协议: diff --git a/XEngine_Docment/Docment_en.docx b/XEngine_Docment/Docment_en.docx index 39e43be..cf015ee 100644 Binary files a/XEngine_Docment/Docment_en.docx and b/XEngine_Docment/Docment_en.docx differ diff --git a/XEngine_Docment/Docment_zh.docx b/XEngine_Docment/Docment_zh.docx index 0d74d20..73a94f1 100644 Binary files a/XEngine_Docment/Docment_zh.docx and b/XEngine_Docment/Docment_zh.docx differ diff --git a/XEngine_Release/XEngine_Config/XEngine_Config.json b/XEngine_Release/XEngine_Config/XEngine_Config.json index 3f27141..d3e9688 100644 --- a/XEngine_Release/XEngine_Config/XEngine_Config.json +++ b/XEngine_Release/XEngine_Config/XEngine_Config.json @@ -28,23 +28,28 @@ }, "XPull": { "XStream": { - "bEnable": true + "bEnable": true, + "bPrePull": true }, "RTMP": { - "bEnable": true + "bEnable": true, + "bPrePull": true }, "FLV": { - "bEnable": true + "bEnable": true, + "bPrePull": true }, "RTSP": { "bEnable": true, + "bPrePull": true, "nVRTPPort": 56001, "nVRTCPPort": 56002, "nARTPPort": 56003, "nARTCPPort": 56004 }, "RTC": { - "bEnable": true, + "bEnable": false, + "bPrePull": false, "tszICEUser": "xengine", "tszICEPass": "3321308h8i6vt3769r6638l1409d50jz", "tszCertStr": "./XEngine_Key/server.crt", @@ -52,13 +57,16 @@ "tszDerStr": "./XEngine_Key/server.der" }, "SRT": { - "bEnable": true + "bEnable": true, + "bPrePull": true }, "TS": { - "bEnable": true + "bEnable": true, + "bPrePull": true }, "HLS": { "bEnable": false, + "bPrePull": true, "bClear": false, "nTime": 15, "tszHLSPath": "./XEngine_File" @@ -68,7 +76,8 @@ "LogFile": "./XEngine_XLog/XEngine_StreamMediaApp.Log", "MaxSize": 1024000, "MaxCount": 10, - "LogLeave": 17 + "LogLeave": 17, + "LogType": 32 }, "XReport":{ "bEnable":true, diff --git a/XEngine_Release/XEngine_Config/XEngine_Version.json b/XEngine_Release/XEngine_Config/XEngine_Version.json index ba0fcd2..1a0367c 100644 --- a/XEngine_Release/XEngine_Config/XEngine_Version.json +++ b/XEngine_Release/XEngine_Config/XEngine_Version.json @@ -1,5 +1,6 @@ { "XVer": [ + "V2.11.0.1001 Build20250409", "V2.10.0.1001 Build20250124", "V2.9.0.1001 Build20241011", "V2.8.0.1001 Build20240531", diff --git a/XEngine_Source/VSCopy_Arm64.bat b/XEngine_Source/VSCopy_Arm64.bat new file mode 100644 index 0000000..9128790 --- /dev/null +++ b/XEngine_Source/VSCopy_Arm64.bat @@ -0,0 +1,40 @@ +copy /y "%XEngine_LibArm64%\XEngine_BaseLib\XEngine_BaseLib.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_BaseLib\XEngine_BaseSafe.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_BaseLib\XEngine_Algorithm.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_Core\XEngine_Core.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_Core\XEngine_ManagePool.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_Core\XEngine_Cryption.dll" "./" + +copy /y "%XEngine_LibArm64%\XEngine_Client\XClient_Stream.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_Client\XClient_APIHelp.dll" "./" + +copy /y "%XEngine_LibArm64%\XEngine_NetHelp\NetHelp_XSocket.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_NetHelp\NetHelp_APIHelp.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_NetHelp\NetHelp_APIAddr.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_SystemSdk\XEngine_SystemConfig.dll" "./" + +copy /y "%XEngine_LibArm64%\XEngine_HelpComponents\HelpComponents_Packets.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_HelpComponents\HelpComponents_XLog.dll" "./" + +copy /y "%XEngine_LibArm64%\XEngine_RfcComponents\RfcComponents_HttpProtocol.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_RfcComponents\RfcComponents_NatProtocol.dll" "./" + +copy /y "%XEngine_LibArm64%\XEngine_StreamMedia\StreamMedia_SDPProtocol.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_StreamMedia\StreamMedia_FLVProtocol.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_StreamMedia\StreamMedia_RTMPProtocol.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_StreamMedia\StreamMedia_RTSPProtocol.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_StreamMedia\StreamMedia_RTPProtocol.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_StreamMedia\StreamMedia_RTCPProtocol.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_StreamMedia\StreamMedia_HLSProtocol.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_AVCodec\XEngine_AVHelp.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_AVCodec\XEngine_AudioCodec.dll" "./" + +copy /y "%XEngine_LibArm64%\XEngine_AVCodec\avcodec-61.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_AVCodec\avdevice-61.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_AVCodec\avfilter-10.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_AVCodec\avformat-61.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_AVCodec\avutil-59.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_AVCodec\postproc-58.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_AVCodec\swresample-5.dll" "./" +copy /y "%XEngine_LibArm64%\XEngine_AVCodec\swscale-8.dll" "./" \ No newline at end of file diff --git a/XEngine_Source/VSCopy_Debug.bat b/XEngine_Source/VSCopy_Debug.bat index bee8dc5..0380452 100644 --- a/XEngine_Source/VSCopy_Debug.bat +++ b/XEngine_Source/VSCopy_Debug.bat @@ -1,9 +1,9 @@ copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_BaseLib.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_BaseSafe.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_Algorithm.dll" "./" -copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_Cryption.dll" "./" +copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_Core.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_ManagePool.dll" "./" -copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_OPenSsl.dll" "./" +copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_Cryption.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XClient_Stream.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XClient_APIHelp.dll" "./" @@ -12,6 +12,7 @@ copy /y "D:\XEngine\XEngine_SourceCode\Debug\NetHelp_XSocket.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\NetHelp_APIHelp.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\NetHelp_APIAddr.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_SystemApi.dll" "./" +copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_SystemConfig.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\HelpComponents_Packets.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\HelpComponents_XLog.dll" "./" @@ -29,11 +30,11 @@ copy /y "D:\XEngine\XEngine_SourceCode\Debug\StreamMedia_HLSProtocol.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_AVHelp.dll" "./" copy /y "D:\XEngine\XEngine_SourceCode\Debug\XEngine_AudioCodec.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\avcodec-60.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\avdevice-60.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\avfilter-9.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\avformat-60.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\avutil-58.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\postproc-57.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\swresample-4.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\swscale-7.dll" "./" \ No newline at end of file +copy /y "%XEngine_Lib32%\XEngine_AVCodec\avcodec-61.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\avdevice-61.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\avfilter-10.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\avformat-61.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\avutil-59.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\postproc-58.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\swresample-5.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\swscale-8.dll" "./" \ No newline at end of file diff --git a/XEngine_Source/VSCopy_x64.bat b/XEngine_Source/VSCopy_x64.bat index 1a3a932..c4c4739 100644 --- a/XEngine_Source/VSCopy_x64.bat +++ b/XEngine_Source/VSCopy_x64.bat @@ -12,6 +12,7 @@ copy /y "%XEngine_Lib64%\XEngine_NetHelp\NetHelp_XSocket.dll" "./" copy /y "%XEngine_Lib64%\XEngine_NetHelp\NetHelp_APIHelp.dll" "./" copy /y "%XEngine_Lib64%\XEngine_NetHelp\NetHelp_APIAddr.dll" "./" copy /y "%XEngine_Lib64%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_SystemSdk\XEngine_SystemConfig.dll" "./" copy /y "%XEngine_Lib64%\XEngine_HelpComponents\HelpComponents_Packets.dll" "./" copy /y "%XEngine_Lib64%\XEngine_HelpComponents\HelpComponents_XLog.dll" "./" @@ -29,11 +30,11 @@ copy /y "%XEngine_Lib64%\XEngine_StreamMedia\StreamMedia_HLSProtocol.dll" "./" copy /y "%XEngine_Lib64%\XEngine_AVCodec\XEngine_AVHelp.dll" "./" copy /y "%XEngine_Lib64%\XEngine_AVCodec\XEngine_AudioCodec.dll" "./" -copy /y "%XEngine_Lib64%\XEngine_AVCodec\avcodec-60.dll" "./" -copy /y "%XEngine_Lib64%\XEngine_AVCodec\avdevice-60.dll" "./" -copy /y "%XEngine_Lib64%\XEngine_AVCodec\avfilter-9.dll" "./" -copy /y "%XEngine_Lib64%\XEngine_AVCodec\avformat-60.dll" "./" -copy /y "%XEngine_Lib64%\XEngine_AVCodec\avutil-58.dll" "./" -copy /y "%XEngine_Lib64%\XEngine_AVCodec\postproc-57.dll" "./" -copy /y "%XEngine_Lib64%\XEngine_AVCodec\swresample-4.dll" "./" -copy /y "%XEngine_Lib64%\XEngine_AVCodec\swscale-7.dll" "./" \ No newline at end of file +copy /y "%XEngine_Lib64%\XEngine_AVCodec\avcodec-61.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_AVCodec\avdevice-61.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_AVCodec\avfilter-10.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_AVCodec\avformat-61.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_AVCodec\avutil-59.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_AVCodec\postproc-58.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_AVCodec\swresample-5.dll" "./" +copy /y "%XEngine_Lib64%\XEngine_AVCodec\swscale-8.dll" "./" \ No newline at end of file diff --git a/XEngine_Source/VSCopy_x86.bat b/XEngine_Source/VSCopy_x86.bat index 55e617d..fce463a 100644 --- a/XEngine_Source/VSCopy_x86.bat +++ b/XEngine_Source/VSCopy_x86.bat @@ -12,6 +12,7 @@ copy /y "%XEngine_Lib32%\XEngine_NetHelp\NetHelp_XSocket.dll" "./" copy /y "%XEngine_Lib32%\XEngine_NetHelp\NetHelp_APIHelp.dll" "./" copy /y "%XEngine_Lib32%\XEngine_NetHelp\NetHelp_APIAddr.dll" "./" copy /y "%XEngine_Lib32%\XEngine_SystemSdk\XEngine_SystemApi.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_SystemSdk\XEngine_SystemConfig.dll" "./" copy /y "%XEngine_Lib32%\XEngine_HelpComponents\HelpComponents_Packets.dll" "./" copy /y "%XEngine_Lib32%\XEngine_HelpComponents\HelpComponents_XLog.dll" "./" @@ -29,11 +30,11 @@ copy /y "%XEngine_Lib32%\XEngine_StreamMedia\StreamMedia_HLSProtocol.dll" "./" copy /y "%XEngine_Lib32%\XEngine_AVCodec\XEngine_AVHelp.dll" "./" copy /y "%XEngine_Lib32%\XEngine_AVCodec\XEngine_AudioCodec.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\avcodec-60.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\avdevice-60.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\avfilter-9.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\avformat-60.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\avutil-58.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\postproc-57.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\swresample-4.dll" "./" -copy /y "%XEngine_Lib32%\XEngine_AVCodec\swscale-7.dll" "./" \ No newline at end of file +copy /y "%XEngine_Lib32%\XEngine_AVCodec\avcodec-61.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\avdevice-61.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\avfilter-10.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\avformat-61.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\avutil-59.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\postproc-58.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\swresample-5.dll" "./" +copy /y "%XEngine_Lib32%\XEngine_AVCodec\swscale-8.dll" "./" \ No newline at end of file diff --git a/XEngine_Source/XEngine.sln b/XEngine_Source/XEngine.sln index 4662416..cfdc81a 100644 --- a/XEngine_Source/XEngine.sln +++ b/XEngine_Source/XEngine.sln @@ -49,72 +49,106 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XEngine_InfoReport", "XEngi EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|ARM64 = Release|ARM64 Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {F54F152C-594F-4465-A44E-2DB915B39760}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F54F152C-594F-4465-A44E-2DB915B39760}.Debug|ARM64.Build.0 = Debug|ARM64 {F54F152C-594F-4465-A44E-2DB915B39760}.Debug|x64.ActiveCfg = Debug|x64 {F54F152C-594F-4465-A44E-2DB915B39760}.Debug|x64.Build.0 = Debug|x64 {F54F152C-594F-4465-A44E-2DB915B39760}.Debug|x86.ActiveCfg = Debug|Win32 {F54F152C-594F-4465-A44E-2DB915B39760}.Debug|x86.Build.0 = Debug|Win32 + {F54F152C-594F-4465-A44E-2DB915B39760}.Release|ARM64.ActiveCfg = Release|ARM64 + {F54F152C-594F-4465-A44E-2DB915B39760}.Release|ARM64.Build.0 = Release|ARM64 {F54F152C-594F-4465-A44E-2DB915B39760}.Release|x64.ActiveCfg = Release|x64 {F54F152C-594F-4465-A44E-2DB915B39760}.Release|x64.Build.0 = Release|x64 {F54F152C-594F-4465-A44E-2DB915B39760}.Release|x86.ActiveCfg = Release|Win32 {F54F152C-594F-4465-A44E-2DB915B39760}.Release|x86.Build.0 = Release|Win32 + {6C935BE1-77E3-4719-A7A6-C76ABAFEE010}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {6C935BE1-77E3-4719-A7A6-C76ABAFEE010}.Debug|ARM64.Build.0 = Debug|ARM64 {6C935BE1-77E3-4719-A7A6-C76ABAFEE010}.Debug|x64.ActiveCfg = Debug|x64 {6C935BE1-77E3-4719-A7A6-C76ABAFEE010}.Debug|x64.Build.0 = Debug|x64 {6C935BE1-77E3-4719-A7A6-C76ABAFEE010}.Debug|x86.ActiveCfg = Debug|Win32 {6C935BE1-77E3-4719-A7A6-C76ABAFEE010}.Debug|x86.Build.0 = Debug|Win32 + {6C935BE1-77E3-4719-A7A6-C76ABAFEE010}.Release|ARM64.ActiveCfg = Release|ARM64 + {6C935BE1-77E3-4719-A7A6-C76ABAFEE010}.Release|ARM64.Build.0 = Release|ARM64 {6C935BE1-77E3-4719-A7A6-C76ABAFEE010}.Release|x64.ActiveCfg = Release|x64 {6C935BE1-77E3-4719-A7A6-C76ABAFEE010}.Release|x64.Build.0 = Release|x64 {6C935BE1-77E3-4719-A7A6-C76ABAFEE010}.Release|x86.ActiveCfg = Release|Win32 {6C935BE1-77E3-4719-A7A6-C76ABAFEE010}.Release|x86.Build.0 = Release|Win32 + {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}.Debug|ARM64.Build.0 = Debug|ARM64 {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}.Debug|x64.ActiveCfg = Debug|x64 {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}.Debug|x64.Build.0 = Debug|x64 {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}.Debug|x86.ActiveCfg = Debug|Win32 {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}.Debug|x86.Build.0 = Debug|Win32 + {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}.Release|ARM64.ActiveCfg = Release|ARM64 + {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}.Release|ARM64.Build.0 = Release|ARM64 {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}.Release|x64.ActiveCfg = Release|x64 {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}.Release|x64.Build.0 = Release|x64 {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}.Release|x86.ActiveCfg = Release|Win32 {6D0FCB40-D544-4AB2-A239-2FEBC4B98F6D}.Release|x86.Build.0 = Release|Win32 + {98DB01B5-30B7-4C00-9A84-39886680F069}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {98DB01B5-30B7-4C00-9A84-39886680F069}.Debug|ARM64.Build.0 = Debug|ARM64 {98DB01B5-30B7-4C00-9A84-39886680F069}.Debug|x64.ActiveCfg = Debug|x64 {98DB01B5-30B7-4C00-9A84-39886680F069}.Debug|x64.Build.0 = Debug|x64 {98DB01B5-30B7-4C00-9A84-39886680F069}.Debug|x86.ActiveCfg = Debug|Win32 {98DB01B5-30B7-4C00-9A84-39886680F069}.Debug|x86.Build.0 = Debug|Win32 + {98DB01B5-30B7-4C00-9A84-39886680F069}.Release|ARM64.ActiveCfg = Release|ARM64 + {98DB01B5-30B7-4C00-9A84-39886680F069}.Release|ARM64.Build.0 = Release|ARM64 {98DB01B5-30B7-4C00-9A84-39886680F069}.Release|x64.ActiveCfg = Release|x64 {98DB01B5-30B7-4C00-9A84-39886680F069}.Release|x64.Build.0 = Release|x64 {98DB01B5-30B7-4C00-9A84-39886680F069}.Release|x86.ActiveCfg = Release|Win32 {98DB01B5-30B7-4C00-9A84-39886680F069}.Release|x86.Build.0 = Release|Win32 + {2E55D676-E9F5-48B8-B65E-FE0E7C3D2AEB}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {2E55D676-E9F5-48B8-B65E-FE0E7C3D2AEB}.Debug|ARM64.Build.0 = Debug|ARM64 {2E55D676-E9F5-48B8-B65E-FE0E7C3D2AEB}.Debug|x64.ActiveCfg = Debug|x64 {2E55D676-E9F5-48B8-B65E-FE0E7C3D2AEB}.Debug|x64.Build.0 = Debug|x64 {2E55D676-E9F5-48B8-B65E-FE0E7C3D2AEB}.Debug|x86.ActiveCfg = Debug|Win32 {2E55D676-E9F5-48B8-B65E-FE0E7C3D2AEB}.Debug|x86.Build.0 = Debug|Win32 + {2E55D676-E9F5-48B8-B65E-FE0E7C3D2AEB}.Release|ARM64.ActiveCfg = Release|ARM64 + {2E55D676-E9F5-48B8-B65E-FE0E7C3D2AEB}.Release|ARM64.Build.0 = Release|ARM64 {2E55D676-E9F5-48B8-B65E-FE0E7C3D2AEB}.Release|x64.ActiveCfg = Release|x64 {2E55D676-E9F5-48B8-B65E-FE0E7C3D2AEB}.Release|x64.Build.0 = Release|x64 {2E55D676-E9F5-48B8-B65E-FE0E7C3D2AEB}.Release|x86.ActiveCfg = Release|Win32 {2E55D676-E9F5-48B8-B65E-FE0E7C3D2AEB}.Release|x86.Build.0 = Release|Win32 + {9FF6FA78-456E-4A7E-86B1-17E4DB5403C9}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {9FF6FA78-456E-4A7E-86B1-17E4DB5403C9}.Debug|ARM64.Build.0 = Debug|ARM64 {9FF6FA78-456E-4A7E-86B1-17E4DB5403C9}.Debug|x64.ActiveCfg = Debug|x64 {9FF6FA78-456E-4A7E-86B1-17E4DB5403C9}.Debug|x64.Build.0 = Debug|x64 {9FF6FA78-456E-4A7E-86B1-17E4DB5403C9}.Debug|x86.ActiveCfg = Debug|Win32 {9FF6FA78-456E-4A7E-86B1-17E4DB5403C9}.Debug|x86.Build.0 = Debug|Win32 + {9FF6FA78-456E-4A7E-86B1-17E4DB5403C9}.Release|ARM64.ActiveCfg = Release|ARM64 + {9FF6FA78-456E-4A7E-86B1-17E4DB5403C9}.Release|ARM64.Build.0 = Release|ARM64 {9FF6FA78-456E-4A7E-86B1-17E4DB5403C9}.Release|x64.ActiveCfg = Release|x64 {9FF6FA78-456E-4A7E-86B1-17E4DB5403C9}.Release|x64.Build.0 = Release|x64 {9FF6FA78-456E-4A7E-86B1-17E4DB5403C9}.Release|x86.ActiveCfg = Release|Win32 {9FF6FA78-456E-4A7E-86B1-17E4DB5403C9}.Release|x86.Build.0 = Release|Win32 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|ARM64.Build.0 = Debug|ARM64 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|x64.ActiveCfg = Debug|x64 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|x64.Build.0 = Debug|x64 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|x86.ActiveCfg = Debug|Win32 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Debug|x86.Build.0 = Debug|Win32 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|ARM64.ActiveCfg = Release|ARM64 + {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|ARM64.Build.0 = Release|ARM64 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|x64.ActiveCfg = Release|x64 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|x64.Build.0 = Release|x64 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|x86.ActiveCfg = Release|Win32 {F1736B3F-03A2-4FC7-B045-A12BA8D724FB}.Release|x86.Build.0 = Release|Win32 + {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|ARM64.Build.0 = Debug|ARM64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|x64.ActiveCfg = Debug|x64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|x64.Build.0 = Debug|x64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|x86.ActiveCfg = Debug|Win32 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Debug|x86.Build.0 = Debug|Win32 + {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|ARM64.ActiveCfg = Release|ARM64 + {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|ARM64.Build.0 = Release|ARM64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|x64.ActiveCfg = Release|x64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|x64.Build.0 = Release|x64 {F6520D2C-BB8E-45BB-964B-F5D6A4318A89}.Release|x86.ActiveCfg = Release|Win32 diff --git a/XEngine_Source/XEngine_BuildSwitch.h b/XEngine_Source/XEngine_BuildSwitch.h index e7d51f9..3dc2f27 100644 --- a/XEngine_Source/XEngine_BuildSwitch.h +++ b/XEngine_Source/XEngine_BuildSwitch.h @@ -10,5 +10,5 @@ // Purpose: 编译开关选项 // History: *********************************************************************/ -#define _XENGINE_STREAMMEDIA_BUILDSWITCH_SRT 1 //SRT协议编译开关选项 +#define _XENGINE_STREAMMEDIA_BUILDSWITCH_SRT 0 //SRT协议编译开关选项 #define _XENGINE_STREAMMEDIA_BUILDSWITCH_RTC 1 //WEBRTC协议编译开关选项 \ No newline at end of file diff --git a/XEngine_Source/XEngine_Depend b/XEngine_Source/XEngine_Depend index d022f0c..fda9f7d 160000 --- a/XEngine_Source/XEngine_Depend +++ b/XEngine_Source/XEngine_Depend @@ -1 +1 @@ -Subproject commit d022f0c7d2298275d663543afd33e18243c5f25d +Subproject commit fda9f7d9140cc6a32eecb499e2acb67e8e1c7e6f diff --git a/XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h b/XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h index 651a7d2..8868fc4 100644 --- a/XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h +++ b/XEngine_Source/XEngine_ModuleConfigure/ModuleConfig_Define.h @@ -51,6 +51,7 @@ typedef struct tag_XEngine_ServiceConfig int nMaxSize; //最大日志大小 int nMaxCount; //最大日志个数 int nLogLeave; //日志等级 + int nLogType; //输出类型 }st_XLog; //拉流服务配置,启动越多,服务器性能越差 struct @@ -58,33 +59,40 @@ typedef struct tag_XEngine_ServiceConfig struct { bool bEnable; + bool bPrePull; }st_PullXStream; struct { bool bEnable; + bool bPrePull; }st_PullRtmp; struct { bool bEnable; + bool bPrePull; }st_PullFlv; struct { XCHAR tszHLSPath[MAX_PATH]; int nTime; bool bEnable; + bool bPrePull; bool bClear; }st_PullHls; struct { bool bEnable; + bool bPrePull; }st_PullSrt; struct { bool bEnable; + bool bPrePull; }st_PullTs; struct { bool bEnable; + bool bPrePull; int nVRTPPort; int nVRTCPPort; int nARTPPort; @@ -98,6 +106,7 @@ typedef struct tag_XEngine_ServiceConfig XCHAR tszKeyStr[MAX_PATH]; XCHAR tszDerStr[MAX_PATH]; bool bEnable; + bool bPrePull; }st_PullWebRtc; }st_XPull; struct diff --git a/XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp b/XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp index 89c0957..e3b4cee 100644 --- a/XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp +++ b/XEngine_Source/XEngine_ModuleConfigure/ModuleConfigure_Json/ModuleConfigure_Json.cpp @@ -139,14 +139,25 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE Json::Value st_PullTs = st_Pull["TS"]; pSt_ServerConfig->st_XPull.st_PullXStream.bEnable = st_PullXStream["bEnable"].asBool(); + pSt_ServerConfig->st_XPull.st_PullXStream.bPrePull = st_PullXStream["bPrePull"].asBool(); + pSt_ServerConfig->st_XPull.st_PullRtmp.bEnable = st_PullRtmp["bEnable"].asBool(); + pSt_ServerConfig->st_XPull.st_PullRtmp.bPrePull = st_PullRtmp["bPrePull"].asBool(); + pSt_ServerConfig->st_XPull.st_PullFlv.bEnable = st_PullFlv["bEnable"].asBool(); + pSt_ServerConfig->st_XPull.st_PullFlv.bPrePull = st_PullFlv["bPrePull"].asBool(); + pSt_ServerConfig->st_XPull.st_PullHls.bEnable = st_PullHls["bEnable"].asBool(); - pSt_ServerConfig->st_XPull.st_PullWebRtc.bEnable = st_PullWebRtc["bEnable"].asBool(); + pSt_ServerConfig->st_XPull.st_PullHls.bPrePull = st_PullHls["bPrePull"].asBool(); + pSt_ServerConfig->st_XPull.st_PullSrt.bEnable = st_PullSrt["bEnable"].asBool(); + pSt_ServerConfig->st_XPull.st_PullSrt.bPrePull = st_PullSrt["bPrePull"].asBool(); + pSt_ServerConfig->st_XPull.st_PullTs.bEnable = st_Pull["bEnable"].asBool(); + pSt_ServerConfig->st_XPull.st_PullTs.bPrePull = st_Pull["bPrePull"].asBool(); pSt_ServerConfig->st_XPull.st_PullRtsp.bEnable = st_PullRtsp["bEnable"].asBool(); + pSt_ServerConfig->st_XPull.st_PullRtsp.bPrePull = st_PullRtsp["bPrePull"].asBool(); pSt_ServerConfig->st_XPull.st_PullRtsp.nVRTPPort = st_PullRtsp["nVRTPPort"].asInt(); pSt_ServerConfig->st_XPull.st_PullRtsp.nVRTCPPort = st_PullRtsp["nVRTCPPort"].asInt(); pSt_ServerConfig->st_XPull.st_PullRtsp.nARTPPort = st_PullRtsp["nARTPPort"].asInt(); @@ -156,13 +167,15 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE pSt_ServerConfig->st_XPull.st_PullHls.nTime = st_PullHls["nTime"].asInt(); _tcsxcpy(pSt_ServerConfig->st_XPull.st_PullHls.tszHLSPath, st_PullHls["tszHLSPath"].asCString()); + pSt_ServerConfig->st_XPull.st_PullWebRtc.bEnable = st_PullWebRtc["bEnable"].asBool(); + pSt_ServerConfig->st_XPull.st_PullWebRtc.bPrePull = st_PullWebRtc["bPrePull"].asBool(); _tcsxcpy(pSt_ServerConfig->st_XPull.st_PullWebRtc.tszICEUser, st_PullWebRtc["tszICEUser"].asCString()); _tcsxcpy(pSt_ServerConfig->st_XPull.st_PullWebRtc.tszICEPass, st_PullWebRtc["tszICEPass"].asCString()); _tcsxcpy(pSt_ServerConfig->st_XPull.st_PullWebRtc.tszCertStr, st_PullWebRtc["tszCertStr"].asCString()); _tcsxcpy(pSt_ServerConfig->st_XPull.st_PullWebRtc.tszKeyStr, st_PullWebRtc["tszKeyStr"].asCString()); _tcsxcpy(pSt_ServerConfig->st_XPull.st_PullWebRtc.tszDerStr, st_PullWebRtc["tszDerStr"].asCString()); //日志配置 - if (st_JsonRoot["XLog"].empty() || (4 != st_JsonRoot["XLog"].size())) + if (st_JsonRoot["XLog"].empty() || (5 != st_JsonRoot["XLog"].size())) { Config_IsErrorOccur = true; Config_dwErrorCode = ERROR_MODULE_CONFIGURE_JSON_XLOG; @@ -172,6 +185,7 @@ bool CModuleConfigure_Json::ModuleConfigure_Json_File(LPCXSTR lpszConfigFile, XE pSt_ServerConfig->st_XLog.nMaxSize = st_JsonXLog["MaxSize"].asInt(); pSt_ServerConfig->st_XLog.nMaxCount = st_JsonXLog["MaxCount"].asInt(); pSt_ServerConfig->st_XLog.nLogLeave = st_JsonXLog["LogLeave"].asInt(); + pSt_ServerConfig->st_XLog.nLogType = st_JsonXLog["LogType"].asInt(); _tcsxcpy(pSt_ServerConfig->st_XLog.tszLogFile, st_JsonXLog["LogFile"].asCString()); //信息报告 if (st_JsonRoot["XReport"].empty() || (3 != st_JsonRoot["XReport"].size())) diff --git a/XEngine_Source/XEngine_ModuleConfigure/XEngine_ModuleConfigure.vcxproj b/XEngine_Source/XEngine_ModuleConfigure/XEngine_ModuleConfigure.vcxproj index dcb4d51..c721427 100644 --- a/XEngine_Source/XEngine_ModuleConfigure/XEngine_ModuleConfigure.vcxproj +++ b/XEngine_Source/XEngine_ModuleConfigure/XEngine_ModuleConfigure.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -45,6 +53,12 @@ v143 Unicode + + DynamicLibrary + true + v143 + Unicode + DynamicLibrary false @@ -52,6 +66,13 @@ true Unicode + + DynamicLibrary + false + v143 + true + Unicode + @@ -66,9 +87,15 @@ + + + + + + true @@ -84,11 +111,20 @@ true $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + + true + $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + false $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + false + $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + Level3 @@ -152,6 +188,25 @@ XEngine_ModuleConfigure.def + + + Level3 + true + _DEBUG;XENGINEMODULECONFIGURE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + 4819 + stdcpp20 + stdc17 + + + Windows + true + false + XEngine_ModuleConfigure.def + + Level3 @@ -177,6 +232,31 @@ XEngine_ModuleConfigure.def + + + Level3 + true + true + true + NDEBUG;XENGINEMODULECONFIGURE_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + MultiThreadedDLL + 4819 + /utf-8 %(AdditionalOptions) + stdcpp20 + stdc17 + + + Windows + true + true + true + false + XEngine_ModuleConfigure.def + + @@ -190,8 +270,10 @@ Create Create + Create Create Create + Create diff --git a/XEngine_Source/XEngine_ModuleConfigure/pch.h b/XEngine_Source/XEngine_ModuleConfigure/pch.h index e4091ee..0458e69 100644 --- a/XEngine_Source/XEngine_ModuleConfigure/pch.h +++ b/XEngine_Source/XEngine_ModuleConfigure/pch.h @@ -40,16 +40,20 @@ extern XLONG Config_dwErrorCode; #ifdef _MSC_BUILD #ifdef _DEBUG -#ifdef _WIN64 -#pragma comment(lib,"../x64/Debug/jsoncpp") -#else -#pragma comment(lib,"../Debug/jsoncpp") +#ifdef _M_X64 +#pragma comment(lib,"../x64/Debug/jsoncpp.lib") +#elif _M_ARM64 +#pragma comment(lib,"../ARM64/Debug/jsoncpp.lib") +#elif _M_IX86 +#pragma comment(lib,"../Debug/jsoncpp.lib") #endif #else -#ifdef _WIN64 -#pragma comment(lib,"../x64/Release/jsoncpp") -#else -#pragma comment(lib,"../Release/jsoncpp") +#ifdef _M_X64 +#pragma comment(lib,"../x64/Release/jsoncpp.lib") +#elif _M_ARM64 +#pragma comment(lib,"../ARM64/Release/jsoncpp.lib") +#elif _M_IX86 +#pragma comment(lib,"../Release/jsoncpp.lib") #endif #endif #endif \ No newline at end of file diff --git a/XEngine_Source/XEngine_ModuleHelp/Makefile b/XEngine_Source/XEngine_ModuleHelp/Makefile index 10a5555..6b5ec21 100644 --- a/XEngine_Source/XEngine_ModuleHelp/Makefile +++ b/XEngine_Source/XEngine_ModuleHelp/Makefile @@ -19,7 +19,12 @@ ifeq ($(MACRO_SRT_SUPPORT),1) ifeq ($(PLATFORM),mac) LIB += -lsrt else - LIB += -lsrt-gnutls + ifeq (/etc/redhat-release,$(wildcard /etc/redhat-release)) + LIB += -lsrt + else + LIB += -lsrt-gnutls + endif + endif endif ifeq ($(MACRO_RTC_SUPPORT),1) diff --git a/XEngine_Source/XEngine_ModuleHelp/XEngine_ModuleHelp.vcxproj b/XEngine_Source/XEngine_ModuleHelp/XEngine_ModuleHelp.vcxproj index 3a7ef3d..9e78bb0 100644 --- a/XEngine_Source/XEngine_ModuleHelp/XEngine_ModuleHelp.vcxproj +++ b/XEngine_Source/XEngine_ModuleHelp/XEngine_ModuleHelp.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -45,6 +53,12 @@ v143 Unicode + + DynamicLibrary + true + v143 + Unicode + DynamicLibrary false @@ -52,6 +66,13 @@ true Unicode + + DynamicLibrary + false + v143 + true + Unicode + @@ -66,9 +87,15 @@ + + + + + + true @@ -85,11 +112,21 @@ $(XEngine_Include);../XEngine_ThirdPart/opencc/include;$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + true + $(XEngine_Include);../XEngine_ThirdPart/opencc/include;$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + false $(XEngine_Include);../XEngine_ThirdPart/opencc/include;$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + false + $(XEngine_Include);../XEngine_ThirdPart/opencc/include;$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + false @@ -156,6 +193,24 @@ XEngine_ModuleHelp.def + + + Level3 + true + _DEBUG;XENGINEMODULEHELP_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + + + Windows + true + false + XEngine_ModuleHelp.def + + Level3 @@ -179,6 +234,29 @@ XEngine_ModuleHelp.def + + + Level3 + true + true + true + NDEBUG;XENGINEMODULEHELP_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + /utf-8 %(AdditionalOptions) + stdcpp20 + stdc17 + + + Windows + true + true + true + false + XEngine_ModuleHelp.def + + @@ -200,8 +278,10 @@ Create Create + Create Create Create + Create diff --git a/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.vcxproj b/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.vcxproj index f9b13fe..932b5f3 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.vcxproj +++ b/XEngine_Source/XEngine_ModuleProtocol/XEngine_ModuleProtocol.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -45,6 +53,12 @@ v143 Unicode + + DynamicLibrary + true + v143 + Unicode + DynamicLibrary false @@ -52,6 +66,13 @@ true Unicode + + DynamicLibrary + false + v143 + true + Unicode + @@ -66,9 +87,15 @@ + + + + + + true @@ -85,11 +112,21 @@ $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + true + $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + false $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + false + $(XEngine_Include);../XEngine_Depend/XEngine_Module/jsoncpp;$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + Level3 @@ -149,6 +186,24 @@ XEngine_ModuleProtocol.def + + + Level3 + true + _DEBUG;XENGINEMODULEPROTOCOL_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + + + Windows + true + false + XEngine_ModuleProtocol.def + + Level3 @@ -172,6 +227,29 @@ XEngine_ModuleProtocol.def + + + Level3 + true + true + true + NDEBUG;XENGINEMODULEPROTOCOL_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + /utf-8 %(AdditionalOptions) + stdcpp20 + stdc17 + + + Windows + true + true + true + false + XEngine_ModuleProtocol.def + + @@ -187,8 +265,10 @@ Create Create + Create Create Create + Create diff --git a/XEngine_Source/XEngine_ModuleProtocol/pch.h b/XEngine_Source/XEngine_ModuleProtocol/pch.h index fb09612..3ee5b0b 100644 --- a/XEngine_Source/XEngine_ModuleProtocol/pch.h +++ b/XEngine_Source/XEngine_ModuleProtocol/pch.h @@ -40,16 +40,20 @@ extern XLONG ModuleProtocol_dwErrorCode; #ifdef _MSC_BUILD #ifdef _DEBUG -#ifdef _WIN64 -#pragma comment(lib,"../x64/Debug/jsoncpp") -#else -#pragma comment(lib,"../Debug/jsoncpp") +#ifdef _M_X64 +#pragma comment(lib,"../x64/Debug/jsoncpp.lib") +#elif _M_ARM64 +#pragma comment(lib,"../ARM64/Debug/jsoncpp.lib") +#elif _M_IX86 +#pragma comment(lib,"../Debug/jsoncpp.lib") #endif #else -#ifdef _WIN64 -#pragma comment(lib,"../x64/Release/jsoncpp") -#else -#pragma comment(lib,"../Release/jsoncpp") +#ifdef _M_X64 +#pragma comment(lib,"../x64/Release/jsoncpp.lib") +#elif _M_ARM64 +#pragma comment(lib,"../ARM64/Release/jsoncpp.lib") +#elif _M_IX86 +#pragma comment(lib,"../Release/jsoncpp.lib") #endif #endif #endif \ No newline at end of file diff --git a/XEngine_Source/XEngine_ModuleQueue/XEngine_ModuleQueue.vcxproj b/XEngine_Source/XEngine_ModuleQueue/XEngine_ModuleQueue.vcxproj index 88d660d..ac67acc 100644 --- a/XEngine_Source/XEngine_ModuleQueue/XEngine_ModuleQueue.vcxproj +++ b/XEngine_Source/XEngine_ModuleQueue/XEngine_ModuleQueue.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -45,6 +53,12 @@ v143 Unicode + + DynamicLibrary + true + v143 + Unicode + DynamicLibrary false @@ -52,6 +66,13 @@ true Unicode + + DynamicLibrary + false + v143 + true + Unicode + @@ -66,9 +87,15 @@ + + + + + + $(XEngine_Include);$(IncludePath) @@ -79,9 +106,15 @@ $(XEngine_Include);$(IncludePath) + + $(XEngine_Include);$(IncludePath) + $(XEngine_Include);$(IncludePath) + + $(XEngine_Include);$(IncludePath) + Level3 @@ -141,6 +174,24 @@ XEngine_ModuleQueue.def + + + Level3 + true + _DEBUG;XENGINEMODULEQUEUE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + + + Windows + true + false + XEngine_ModuleQueue.def + + Level3 @@ -164,6 +215,29 @@ XEngine_ModuleQueue.def + + + Level3 + true + true + true + NDEBUG;XENGINEMODULEQUEUE_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + /utf-8 %(AdditionalOptions) + stdcpp20 + stdc17 + + + Windows + true + true + true + false + XEngine_ModuleQueue.def + + @@ -177,8 +251,10 @@ Create Create + Create Create Create + Create diff --git a/XEngine_Source/XEngine_ModuleSession/ModuleSession_Define.h b/XEngine_Source/XEngine_ModuleSession/ModuleSession_Define.h index 063ce8c..0fc0df8 100644 --- a/XEngine_Source/XEngine_ModuleSession/ModuleSession_Define.h +++ b/XEngine_Source/XEngine_ModuleSession/ModuleSession_Define.h @@ -41,6 +41,7 @@ typedef struct XCHAR tszAudioCName[MAX_PATH]; XCHAR tszAudioLabel[MAX_PATH]; }st_WEBRtc; + XCHAR tszClientAddr[MAX_PATH]; XCHAR tszSMSAddr[MAX_PATH]; XCHAR tszPushAddr[MAX_PATH]; int nFLVTag; @@ -84,6 +85,25 @@ extern "C" XLONG ModuleSession_GetLastError(int *pInt_SysError = NULL); *********************************************************************/ extern "C" bool ModuleSession_PullStream_Insert(LPCXSTR lpszClientAddr, LPCXSTR lpszSMSAddr, LPCXSTR lpszPushAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE enStreamType); /******************************************************************** +函数名称:ModuleSession_PullStream_SetPushAddr +函数功能:设置客户端的推流地址 + 参数.一:lpszClientAddr + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要操作的客户端 + 参数.二:lpszPushAddr + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入推流地址 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +extern "C" bool ModuleSession_PullStream_SetPushAddr(LPCXSTR lpszClientAddr, LPCXSTR lpszPushAddr); +/******************************************************************** 函数名称:ModuleSession_PullStream_GetSMSAddr 函数功能:获取客户端绑定的流ID 参数.一:lpszClientAddr @@ -181,12 +201,17 @@ extern "C" bool ModuleSession_PullStream_PublishDelete(LPCXSTR lpszClientAddr); 类型:整数型指针 可空:N 意思:输出列表个数 + 参数.三:lpszSMSAddr + In/Out:Out + 类型:常量字符指针 + 可空:Y + 意思:可以查找指定流媒体ID的拉流地址 返回值 类型:逻辑型 意思:是否成功 备注: *********************************************************************/ -extern "C" bool ModuleSession_PullStream_GetList(STREAMMEDIA_PULLLISTINFO*** pppSt_PullList, int* pInt_ListCount); +extern "C" bool ModuleSession_PullStream_GetList(STREAMMEDIA_PULLLISTINFO*** pppSt_PullList, int* pInt_ListCount, LPCXSTR lpszSMSAddr = NULL); ////////////////////////////////////////////////////////////////////////// /******************************************************************** 函数名称:ModuleSession_PullStream_FLVTagSet diff --git a/XEngine_Source/XEngine_ModuleSession/ModuleSession_PullStream/ModuleSession_PullStream.cpp b/XEngine_Source/XEngine_ModuleSession/ModuleSession_PullStream/ModuleSession_PullStream.cpp index eaf495c..e64773b 100644 --- a/XEngine_Source/XEngine_ModuleSession/ModuleSession_PullStream/ModuleSession_PullStream.cpp +++ b/XEngine_Source/XEngine_ModuleSession/ModuleSession_PullStream/ModuleSession_PullStream.cpp @@ -62,15 +62,64 @@ bool CModuleSession_PullStream::ModuleSession_PullStream_Insert(LPCXSTR lpszClie memset(pSt_PullStream, '\0', sizeof(STREAMMEDIA_PULLLISTINFO)); pSt_PullStream->enStreamType = enStreamType; - _tcsxcpy(pSt_PullStream->tszSMSAddr, lpszSMSAddr); - _tcsxcpy(pSt_PullStream->tszPushAddr, lpszPushAddr); - + if (NULL != lpszSMSAddr) + { + _tcsxcpy(pSt_PullStream->tszSMSAddr, lpszSMSAddr); + } + if (NULL != lpszPushAddr) + { + _tcsxcpy(pSt_PullStream->tszPushAddr, lpszPushAddr); + } + _tcsxcpy(pSt_PullStream->tszClientAddr, lpszClientAddr); + st_Locker.lock(); stl_MapClient.insert(make_pair(lpszClientAddr, pSt_PullStream)); st_Locker.unlock(); return true; } /******************************************************************** +函数名称:ModuleSession_PullStream_SetPushAddr +函数功能:设置客户端的推流地址 + 参数.一:lpszClientAddr + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入要操作的客户端 + 参数.二:lpszPushAddr + In/Out:In + 类型:常量字符指针 + 可空:N + 意思:输入推流地址 +返回值 + 类型:逻辑型 + 意思:是否成功 +备注: +*********************************************************************/ +bool CModuleSession_PullStream::ModuleSession_PullStream_SetPushAddr(LPCXSTR lpszClientAddr, LPCXSTR lpszPushAddr) +{ + Session_IsErrorOccur = false; + + if (NULL == lpszClientAddr) + { + Session_IsErrorOccur = true; + Session_dwErrorCode = ERROR_STREAMMEDIA_MODULE_SESSION_PARAMENT; + return false; + } + st_Locker.lock_shared(); + //查找最小 + auto stl_MapIterator = stl_MapClient.find(lpszClientAddr); + if (stl_MapIterator == stl_MapClient.end()) + { + Session_IsErrorOccur = true; + Session_dwErrorCode = ERROR_STREAMMEDIA_MODULE_SESSION_NOTFOUND; + st_Locker.unlock_shared(); + return false; + } + _tcsxcpy(stl_MapIterator->second->tszPushAddr, lpszPushAddr); + st_Locker.unlock_shared(); + return true; +} +/******************************************************************** 函数名称:ModuleSession_PullStream_Delete 函数功能:删除一个拉流端 参数.一:lpszClientAddr @@ -279,26 +328,45 @@ bool CModuleSession_PullStream::ModuleSession_PullStream_GetStreamType(LPCXSTR l 类型:整数型指针 可空:N 意思:输出列表个数 + 参数.三:lpszSMSAddr + In/Out:Out + 类型:常量字符指针 + 可空:Y + 意思:可以查找指定流媒体ID的拉流地址 返回值 类型:逻辑型 意思:是否成功 备注: *********************************************************************/ -bool CModuleSession_PullStream::ModuleSession_PullStream_GetList(STREAMMEDIA_PULLLISTINFO*** pppSt_PullList, int* pInt_ListCount) +bool CModuleSession_PullStream::ModuleSession_PullStream_GetList(STREAMMEDIA_PULLLISTINFO*** pppSt_PullList, int* pInt_ListCount, LPCXSTR lpszSMSAddr) { Session_IsErrorOccur = false; - st_Locker.lock_shared(); - - *pInt_ListCount = stl_MapClient.size(); - BaseLib_Memory_Malloc((XPPPMEM)pppSt_PullList, stl_MapClient.size(), sizeof(STREAMMEDIA_PULLLISTINFO)); + list stl_ListPullInfo; + st_Locker.lock_shared(); auto stl_MapIterator = stl_MapClient.begin(); for (int i = 0; stl_MapIterator != stl_MapClient.end(); stl_MapIterator++, i++) { - (*pppSt_PullList)[i] = stl_MapIterator->second; + if (NULL != lpszSMSAddr) + { + if ((0 != _tcsxnicmp(lpszSMSAddr, stl_MapIterator->second->tszSMSAddr, _tcsxlen(lpszSMSAddr))) && (_tcsxlen(stl_MapIterator->second->tszPushAddr) == 0)) + { + continue; + } + } + stl_ListPullInfo.push_back(*stl_MapIterator->second); } st_Locker.unlock_shared(); + + *pInt_ListCount = stl_ListPullInfo.size(); + BaseLib_Memory_Malloc((XPPPMEM)pppSt_PullList, stl_ListPullInfo.size(), sizeof(STREAMMEDIA_PULLLISTINFO)); + auto stl_ListIterator = stl_ListPullInfo.begin(); + for (size_t i = 0; i < stl_ListPullInfo.size(); i++) + { + *(*pppSt_PullList)[i] = *stl_ListIterator; + } + stl_ListPullInfo.clear(); return true; } /******************************************************************** diff --git a/XEngine_Source/XEngine_ModuleSession/ModuleSession_PullStream/ModuleSession_PullStream.h b/XEngine_Source/XEngine_ModuleSession/ModuleSession_PullStream/ModuleSession_PullStream.h index 840f925..3dc3815 100644 --- a/XEngine_Source/XEngine_ModuleSession/ModuleSession_PullStream/ModuleSession_PullStream.h +++ b/XEngine_Source/XEngine_ModuleSession/ModuleSession_PullStream/ModuleSession_PullStream.h @@ -17,12 +17,13 @@ class CModuleSession_PullStream ~CModuleSession_PullStream(); public: bool ModuleSession_PullStream_Insert(LPCXSTR lpszClientAddr, LPCXSTR lpszSMSAddr, LPCXSTR lpszPushAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE enStreamType); + bool ModuleSession_PullStream_SetPushAddr(LPCXSTR lpszClientAddr, LPCXSTR lpszPushAddr); bool ModuleSession_PullStream_GetSMSAddr(LPCXSTR lpszClientAddr, XCHAR* ptszSMSAddr); bool ModuleSession_PullStream_GetPushAddr(LPCXSTR lpszClientAddr, XCHAR* ptszPushAddr); bool ModuleSession_PullStream_GetStreamType(LPCXSTR lpszClientAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE* penStreamType); bool ModuleSession_PullStream_Delete(LPCXSTR lpszClientAddr); bool ModuleSession_PullStream_PublishDelete(LPCXSTR lpszClientAddr); - bool ModuleSession_PullStream_GetList(STREAMMEDIA_PULLLISTINFO*** pppSt_PullList, int* pInt_ListCount); + bool ModuleSession_PullStream_GetList(STREAMMEDIA_PULLLISTINFO*** pppSt_PullList, int* pInt_ListCount, LPCXSTR lpszSMSAddr = NULL); public: bool ModuleSession_PullStream_FLVTagSet(LPCXSTR lpszClientAddr, int nTagSize); bool ModuleSession_PullStream_FLVTagGet(LPCXSTR lpszClientAddr, int* pInt_TagSize); diff --git a/XEngine_Source/XEngine_ModuleSession/XEngine_ModuleSession.def b/XEngine_Source/XEngine_ModuleSession/XEngine_ModuleSession.def index 0fb0cc9..bb12091 100644 --- a/XEngine_Source/XEngine_ModuleSession/XEngine_ModuleSession.def +++ b/XEngine_Source/XEngine_ModuleSession/XEngine_ModuleSession.def @@ -4,6 +4,7 @@ EXPORTS ModuleSession_GetLastError ModuleSession_PullStream_Insert + ModuleSession_PullStream_SetPushAddr ModuleSession_PullStream_GetSMSAddr ModuleSession_PullStream_GetPushAddr ModuleSession_PullStream_GetStreamType diff --git a/XEngine_Source/XEngine_ModuleSession/XEngine_ModuleSession.vcxproj b/XEngine_Source/XEngine_ModuleSession/XEngine_ModuleSession.vcxproj index a54ebd3..413b10e 100644 --- a/XEngine_Source/XEngine_ModuleSession/XEngine_ModuleSession.vcxproj +++ b/XEngine_Source/XEngine_ModuleSession/XEngine_ModuleSession.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -45,6 +53,12 @@ v143 Unicode + + DynamicLibrary + true + v143 + Unicode + DynamicLibrary false @@ -52,6 +66,13 @@ true Unicode + + DynamicLibrary + false + v143 + true + Unicode + @@ -66,9 +87,15 @@ + + + + + + true @@ -85,11 +112,21 @@ $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + true + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + false $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + false + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + Level3 @@ -149,6 +186,24 @@ XEngine_ModuleSession.def + + + Level3 + true + _DEBUG;XENGINEMODULESESSION_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + stdcpp20 + stdc17 + + + Windows + true + false + XEngine_ModuleSession.def + + Level3 @@ -172,6 +227,29 @@ XEngine_ModuleSession.def + + + Level3 + true + true + true + NDEBUG;XENGINEMODULESESSION_EXPORTS;_WINDOWS;_USRDLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + Use + pch.h + /utf-8 %(AdditionalOptions) + stdcpp20 + stdc17 + + + Windows + true + true + true + false + XEngine_ModuleSession.def + + @@ -187,8 +265,10 @@ Create Create + Create Create Create + Create diff --git a/XEngine_Source/XEngine_ModuleSession/pch.cpp b/XEngine_Source/XEngine_ModuleSession/pch.cpp index 21512b1..0505e13 100644 --- a/XEngine_Source/XEngine_ModuleSession/pch.cpp +++ b/XEngine_Source/XEngine_ModuleSession/pch.cpp @@ -35,6 +35,10 @@ extern "C" bool ModuleSession_PullStream_Insert(LPCXSTR lpszClientAddr, LPCXSTR { return m_PullStream.ModuleSession_PullStream_Insert(lpszClientAddr, lpszSMSAddr, lpszPushAddr, enStreamType); } +extern "C" bool ModuleSession_PullStream_SetPushAddr(LPCXSTR lpszClientAddr, LPCXSTR lpszPushAddr) +{ + return m_PullStream.ModuleSession_PullStream_SetPushAddr(lpszClientAddr, lpszPushAddr); +} extern "C" bool ModuleSession_PullStream_GetSMSAddr(LPCXSTR lpszClientAddr, XCHAR * ptszSMSAddr) { return m_PullStream.ModuleSession_PullStream_GetSMSAddr(lpszClientAddr, ptszSMSAddr); @@ -51,9 +55,9 @@ extern "C" bool ModuleSession_PullStream_PublishDelete(LPCXSTR lpszClientAddr) { return m_PullStream.ModuleSession_PullStream_PublishDelete(lpszClientAddr); } -extern "C" bool ModuleSession_PullStream_GetList(STREAMMEDIA_PULLLISTINFO*** pppSt_PullList, int* pInt_ListCount) +extern "C" bool ModuleSession_PullStream_GetList(STREAMMEDIA_PULLLISTINFO*** pppSt_PullList, int* pInt_ListCount, LPCXSTR lpszSMSAddr) { - return m_PullStream.ModuleSession_PullStream_GetList(pppSt_PullList, pInt_ListCount); + return m_PullStream.ModuleSession_PullStream_GetList(pppSt_PullList, pInt_ListCount, lpszSMSAddr); } ////////////////////////////////////////////////////////////////////////// extern "C" bool ModuleSession_PullStream_FLVTagSet(LPCXSTR lpszClientAddr, int nTagSize) diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/Makefile b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/Makefile index f8c9fe9..57e3cf2 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/Makefile +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/Makefile @@ -29,10 +29,10 @@ DEBUG = else ifeq ($(PLATFORM),mac) FLAGS = -c - DEBUG = -g + DEBUG = -g -D _DEBUG else FLAGS = -c -lc_p - DEBUG = -g -pg + DEBUG = -g -pg -D _DEBUG endif endif diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PullStream/PullStream_ClientGet.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PullStream/PullStream_ClientGet.cpp index 3f7fa06..88b1313 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PullStream/PullStream_ClientGet.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PullStream/PullStream_ClientGet.cpp @@ -10,6 +10,72 @@ // Purpose: 拉流任务处理函数 // History: *********************************************************************/ +bool PullStream_ClientGet_FLVPlay(LPCXSTR lpszClientAddr, LPCXSTR lpszPushAddr, XCHAR* ptszSDBuffer, XCHAR* ptszRVBuffer) +{ + int nRVLen = 0; + int nSDLen = 0; + XENGINE_PROTOCOL_AVINFO st_AVInfo = {}; + //拷贝头 + FLVProtocol_Packet_FrameHdr(lpszPushAddr, ptszRVBuffer, &nRVLen); + nSDLen = _xstprintf(ptszSDBuffer, _X("%x\r\n"), nRVLen); + memcpy(ptszSDBuffer + nSDLen, ptszRVBuffer, nRVLen); + nSDLen += nRVLen; + memcpy(ptszSDBuffer + nSDLen, _X("\r\n"), 2); + nSDLen += 2; + XEngine_Network_Send(lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); + //标签信息 + int nTagSize = 0; + ModuleSession_PushStream_GetAVInfo(lpszPushAddr, &st_AVInfo); + FLVProtocol_Packet_FrameScript(lpszPushAddr, ptszRVBuffer, &nRVLen, &st_AVInfo, &nTagSize); + nSDLen = _xstprintf(ptszSDBuffer, _X("%x\r\n"), nRVLen); + memcpy(ptszSDBuffer + nSDLen, ptszRVBuffer, nRVLen); + nSDLen += nRVLen; + memcpy(ptszSDBuffer + nSDLen, _X("\r\n"), 2); + nSDLen += 2; + XEngine_Network_Send(lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); + //发送音视频信息 + if (st_AVInfo.st_VideoInfo.bEnable) + { + FLVProtocol_Packet_FrameAVCConfigure(lpszPushAddr, ptszRVBuffer, &nRVLen, &st_AVInfo, &nTagSize); + nSDLen = _xstprintf(ptszSDBuffer, _X("%x\r\n"), nRVLen); + memcpy(ptszSDBuffer + nSDLen, ptszRVBuffer, nRVLen); + nSDLen += nRVLen; + memcpy(ptszSDBuffer + nSDLen, _X("\r\n"), 2); + nSDLen += 2; + XEngine_Network_Send(lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); + } + + if (st_AVInfo.st_AudioInfo.bEnable) + { + FLVProtocol_Packet_FrameAACConfigure(lpszPushAddr, ptszRVBuffer, &nRVLen, &st_AVInfo, &nTagSize); + nSDLen = _xstprintf(ptszSDBuffer, _X("%x\r\n"), nRVLen); + memcpy(ptszSDBuffer + nSDLen, ptszRVBuffer, nRVLen); + nSDLen += nRVLen; + memcpy(ptszSDBuffer + nSDLen, _X("\r\n"), 2); + nSDLen += 2; + XEngine_Network_Send(lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); + } + ModuleSession_PullStream_FLVTagSet(lpszClientAddr, nTagSize); + ModuleSession_PushStream_ClientInsert(lpszPushAddr, lpszClientAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_FLV); + return true; +} +bool PullStream_ClientGet_XStreamPlay(LPCXSTR lpszClientAddr, LPCXSTR lpszPushAddr, XCHAR* ptszSDBuffer, XCHAR* ptszRVBuffer) +{ + int nRVLen = 0; + int nSDLen = 0; + XENGINE_PROTOCOL_AVINFO st_AVInfo = {}; + //拷贝头 + ModuleSession_PushStream_GetAVInfo(lpszPushAddr, &st_AVInfo); + nRVLen = sizeof(XENGINE_PROTOCOL_AVINFO); + nSDLen = _xstprintf(ptszSDBuffer, _X("%x\r\n"), nRVLen); + memcpy(ptszSDBuffer + nSDLen, ptszRVBuffer, nRVLen); + nSDLen += nRVLen; + memcpy(ptszSDBuffer + nSDLen, _X("\r\n"), 2); + nSDLen += 2; + XEngine_Network_Send(lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); + ModuleSession_PushStream_ClientInsert(lpszPushAddr, lpszClientAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_XSTREAM); + return true; +} bool PullStream_ClientGet_Handle(LPCXSTR lpszClientAddr, XCHAR*** ppptszListHdr, int nListCount) { int nRVLen = 0; @@ -45,25 +111,31 @@ bool PullStream_ClientGet_Handle(LPCXSTR lpszClientAddr, XCHAR*** ppptszListHdr, memset(tszVluBuffer, '\0', sizeof(tszVluBuffer)); BaseLib_String_GetKeyValue((*ppptszListHdr)[1], "=", tszKeyBuffer, tszSMSAddr); - - if (!ModuleSession_PushStream_FindStream(tszSMSAddr, tszPushAddr)) - { - ModuleProtocol_Packet_Comm(tszRVBuffer, &nRVLen, NULL, 404, "not found"); - HttpProtocol_Server_SendMsgEx(xhHttpPacket, tszSDBuffer, &nSDLen, &st_HDRParam, tszRVBuffer, nRVLen); - XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("拉流端:%s,请求拉流的URL参数不正确:%s,错误:%lX"), lpszClientAddr, tszVluBuffer, ModuleSession_GetLastError()); - return false; - } memset(tszVluBuffer, '\0', sizeof(tszVluBuffer)); BaseLib_String_GetKeyValue((*ppptszListHdr)[2], "=", tszKeyBuffer, tszVluBuffer); ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE enStreamType; if (0 == _tcsxnicmp(tszVluBuffer, "flv", 3)) { - int nTagSize = 0; + bool bSMSFound = false; + if (ModuleSession_PushStream_FindStream(tszSMSAddr, tszPushAddr)) + { + bSMSFound = true; + } + else + { + if (!st_ServiceConfig.st_XPull.st_PullFlv.bPrePull) + { + ModuleProtocol_Packet_Comm(tszRVBuffer, &nRVLen, NULL, 404, "not found"); + HttpProtocol_Server_SendMsgEx(xhHttpPacket, tszSDBuffer, &nSDLen, &st_HDRParam, tszRVBuffer, nRVLen); + XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("拉流端:%s,请求拉流的URL参数不正确:%s,可能流不存在,错误:%lX"), lpszClientAddr, tszVluBuffer, ModuleSession_GetLastError()); + return false; + } + bSMSFound = false; + } enStreamType = ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_FLV; - //拷贝数据 - FLVProtocol_Packet_FrameHdr(tszPushAddr, tszRVBuffer, &nRVLen); + //返回数据,为HTTP CHUNKED nSDLen = _xstprintf(tszSDBuffer, _X("HTTP/1.1 200 OK\r\n" "Connection: Close\r\n" @@ -71,66 +143,37 @@ bool PullStream_ClientGet_Handle(LPCXSTR lpszClientAddr, XCHAR*** ppptszListHdr, "Server: XEngine/%s\r\n" "Access-Control-Allow-Origin: *\r\n" "Access-Control-Allow-Credentials: true\r\n" - "Transfer-Encoding: chunked\r\n\r\n" - "%x\r\n"), BaseLib_Version_XTypeStr(), nRVLen); - memcpy(tszSDBuffer + nSDLen, tszRVBuffer, nRVLen); - nSDLen += nRVLen; - memcpy(tszSDBuffer + nSDLen, _X("\r\n"), 2); - nSDLen += 2; + "Transfer-Encoding: chunked\r\n\r\n"), BaseLib_Version_XTypeStr()); XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); - //发送脚本信息 - XENGINE_PROTOCOL_AVINFO st_AVInfo; - - memset(&st_AVInfo, '\0', sizeof(XENGINE_PROTOCOL_AVINFO)); - memset(tszRVBuffer, '\0', sizeof(tszRVBuffer)); - memset(tszSDBuffer, '\0', sizeof(tszSDBuffer)); - ModuleSession_PushStream_GetAVInfo(tszPushAddr, &st_AVInfo); - FLVProtocol_Packet_FrameScript(tszPushAddr, tszRVBuffer, &nRVLen, &st_AVInfo, &nTagSize); - nSDLen = _xstprintf(tszSDBuffer, _X("%x\r\n"), nRVLen); - memcpy(tszSDBuffer + nSDLen, tszRVBuffer, nRVLen); - nSDLen += nRVLen; - memcpy(tszSDBuffer + nSDLen, _X("\r\n"), 2); - nSDLen += 2; - XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); - //发送音视频信息 - if (st_AVInfo.st_VideoInfo.bEnable) - { - FLVProtocol_Packet_FrameAVCConfigure(tszPushAddr, tszRVBuffer, &nRVLen, &st_AVInfo, &nTagSize); - nSDLen = _xstprintf(tszSDBuffer, _X("%x\r\n"), nRVLen); - memcpy(tszSDBuffer + nSDLen, tszRVBuffer, nRVLen); - nSDLen += nRVLen; - memcpy(tszSDBuffer + nSDLen, _X("\r\n"), 2); - nSDLen += 2; - XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); - } - - if (st_AVInfo.st_AudioInfo.bEnable) + ModuleSession_PullStream_Insert(lpszClientAddr, tszSMSAddr, tszPushAddr, enStreamType); + if (bSMSFound) { - FLVProtocol_Packet_FrameAACConfigure(tszPushAddr, tszRVBuffer, &nRVLen, &st_AVInfo, &nTagSize); - nSDLen = _xstprintf(tszSDBuffer, _X("%x\r\n"), nRVLen); - memcpy(tszSDBuffer + nSDLen, tszRVBuffer, nRVLen); - nSDLen += nRVLen; - memcpy(tszSDBuffer + nSDLen, _X("\r\n"), 2); - nSDLen += 2; - XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); + PullStream_ClientGet_FLVPlay(lpszClientAddr, tszPushAddr, tszSDBuffer, tszRVBuffer); } - - ModuleSession_PullStream_Insert(lpszClientAddr, tszSMSAddr, tszPushAddr, enStreamType); - ModuleSession_PushStream_ClientInsert(tszPushAddr, lpszClientAddr, enStreamType); - ModuleSession_PullStream_FLVTagSet(lpszClientAddr, nTagSize); } else if (0 == _tcsxnicmp(tszVluBuffer, "xstream", 7)) { + bool bSMSFound = false; + if (st_ServiceConfig.st_XPull.st_PullXStream.bPrePull) + { + bSMSFound = true; + } + else + { + if (!ModuleSession_PushStream_FindStream(tszSMSAddr, tszPushAddr)) + { + ModuleProtocol_Packet_Comm(tszRVBuffer, &nRVLen, NULL, 404, "not found"); + HttpProtocol_Server_SendMsgEx(xhHttpPacket, tszSDBuffer, &nSDLen, &st_HDRParam, tszRVBuffer, nRVLen); + XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("拉流端:%s,请求拉流的URL参数不正确:%s,可能流不存在,错误:%lX"), lpszClientAddr, tszVluBuffer, ModuleSession_GetLastError()); + return false; + } + bSMSFound = false; + } enStreamType = ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_XSTREAM; - XENGINE_PROTOCOL_AVINFO st_AVInfo; - - memset(&st_AVInfo, '\0', sizeof(XENGINE_PROTOCOL_AVINFO)); + memset(tszSDBuffer, '\0', sizeof(tszSDBuffer)); - - ModuleSession_PushStream_GetAVInfo(tszPushAddr, &st_AVInfo); - - nRVLen = sizeof(XENGINE_PROTOCOL_AVINFO); //返回数据,为HTTP CHUNKED nSDLen = _xstprintf(tszSDBuffer, _X("HTTP/1.1 200 OK\r\n" "Connection: Close\r\n" @@ -138,20 +181,36 @@ bool PullStream_ClientGet_Handle(LPCXSTR lpszClientAddr, XCHAR*** ppptszListHdr, "Server: XEngine/%s\r\n" "Access-Control-Allow-Origin: *\r\n" "Access-Control-Allow-Credentials: true\r\n" - "Transfer-Encoding: chunked\r\n\r\n" - "%x\r\n"), BaseLib_Version_XTypeStr(), nRVLen); - memcpy(tszSDBuffer + nSDLen, &st_AVInfo, nRVLen); - nSDLen += nRVLen; - memcpy(tszSDBuffer + nSDLen, _X("\r\n"), 2); - nSDLen += 2; - + "Transfer-Encoding: chunked\r\n\r\n"), BaseLib_Version_XTypeStr()); XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); - + ModuleSession_PullStream_Insert(lpszClientAddr, tszSMSAddr, tszPushAddr, enStreamType); - ModuleSession_PushStream_ClientInsert(tszPushAddr, lpszClientAddr, enStreamType); + if (bSMSFound) + { + PullStream_ClientGet_XStreamPlay(lpszClientAddr, tszPushAddr, tszSDBuffer, tszRVBuffer); + } } else if (0 == _tcsxnicmp(tszVluBuffer, "ts", 2)) { + bool bSMSFound = false; + + if (ModuleSession_PushStream_FindStream(tszSMSAddr, tszPushAddr)) + { + bSMSFound = true; + } + else + { + if (!st_ServiceConfig.st_XPull.st_PullTs.bPrePull) + { + ModuleProtocol_Packet_Comm(tszRVBuffer, &nRVLen, NULL, 404, "not found"); + HttpProtocol_Server_SendMsgEx(xhHttpPacket, tszSDBuffer, &nSDLen, &st_HDRParam, tszRVBuffer, nRVLen); + XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("拉流端:%s,请求拉流的URL参数不正确:%s,可能流不存在,错误:%lX"), lpszClientAddr, tszVluBuffer, ModuleSession_GetLastError()); + return false; + } + bSMSFound = false; + } + enStreamType = ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_TS; //返回数据,为HTTP CHUNKED nSDLen = _xstprintf(tszSDBuffer, _X("HTTP/1.1 200 OK\r\n" @@ -164,7 +223,10 @@ bool PullStream_ClientGet_Handle(LPCXSTR lpszClientAddr, XCHAR*** ppptszListHdr, XEngine_Network_Send(lpszClientAddr, tszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_HTTP); ModuleSession_PullStream_Insert(lpszClientAddr, tszSMSAddr, tszPushAddr, enStreamType); - ModuleSession_PushStream_ClientInsert(tszPushAddr, lpszClientAddr, enStreamType); + if (bSMSFound) + { + ModuleSession_PushStream_ClientInsert(tszPushAddr, lpszClientAddr, enStreamType); + } } else { @@ -174,7 +236,7 @@ bool PullStream_ClientGet_Handle(LPCXSTR lpszClientAddr, XCHAR*** ppptszListHdr, XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("拉流端:%s,请求拉流的数据类型不支持:%s,错误:%lX"), lpszClientAddr, tszVluBuffer, ModuleSession_GetLastError()); return false; } - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("拉流端:%s,请求拉流数据成功:%s"), lpszClientAddr, tszVluBuffer); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("拉流端:%s,请求拉流数据类型:%s,地址:%s 成功"), lpszClientAddr, tszVluBuffer, tszSMSAddr); } else if (0 == _tcsxnicmp(lpszStreamStop, tszVluBuffer, _tcsxlen(lpszStreamStop))) { diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PullStream/PullStream_ClientGet.h b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PullStream/PullStream_ClientGet.h index 55c6c99..3afb160 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PullStream/PullStream_ClientGet.h +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PullStream/PullStream_ClientGet.h @@ -10,5 +10,7 @@ // Purpose: 拉流任务处理函数 // History: *********************************************************************/ +bool PullStream_ClientGet_FLVPlay(LPCXSTR lpszClientAddr, LPCXSTR lpszPushAddr, XCHAR* ptszSDBuffer, XCHAR* ptszRVBuffer); +bool PullStream_ClientGet_XStreamPlay(LPCXSTR lpszClientAddr, LPCXSTR lpszPushAddr, XCHAR* ptszSDBuffer, XCHAR* ptszRVBuffer); //任务处理相关函数,处理包的内容 bool PullStream_ClientGet_Handle(LPCXSTR lpszClientAddr, XCHAR*** ppptszListHdr, int nListCount); \ No newline at end of file diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_JT1078Task.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_JT1078Task.cpp index 11dfa7b..a3baf89 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_JT1078Task.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_JT1078Task.cpp @@ -77,8 +77,8 @@ bool PushStream_JT1078Task_Handle(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nSDLen = 0; XCHAR tszSMSAddr[MAX_PATH]; XCHAR tszDeviceNumber[128]; - XCHAR* ptszRVBuffer = (XCHAR*)malloc(XENGINE_MEMORY_SIZE_MAX); - XCHAR* ptszSDBuffer = (XCHAR*)malloc(XENGINE_MEMORY_SIZE_MAX); + XCHAR* ptszRVBuffer = (XCHAR*)ManagePool_Memory_Alloc(xhMemoryPool, XENGINE_MEMORY_SIZE_MAX); + XCHAR* ptszSDBuffer = (XCHAR*)ManagePool_Memory_Alloc(xhMemoryPool, XENGINE_MEMORY_SIZE_MAX); memset(tszSMSAddr, '\0', sizeof(tszSMSAddr)); memset(tszDeviceNumber, '\0', sizeof(tszDeviceNumber)); @@ -136,10 +136,8 @@ bool PushStream_JT1078Task_Handle(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, } } } - free(ptszSDBuffer); - free(ptszRVBuffer); - ptszRVBuffer = NULL; - ptszSDBuffer = NULL; + ManagePool_Memory_Free(xhMemoryPool, ptszRVBuffer); + ManagePool_Memory_Free(xhMemoryPool, ptszSDBuffer); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_DEBUG, _X("JT1078:%s,开始推送数据,设备ID:%s,通道:%d,大小:%d"), lpszClientAddr, tszDeviceNumber, pSt_RTPHdr->byChannel, nMsgLen); return true; } \ No newline at end of file diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_RTMPTask.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_RTMPTask.cpp index 71ab898..cda1a57 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_RTMPTask.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_RTMPTask.cpp @@ -48,15 +48,38 @@ XHTHREAD CALLBACK PushStream_RTMPTask_Thread(XPVOID lParam) } return 0; } +bool PushStream_RTMPTask_Play(LPCXSTR lpszClientAddr, LPCXSTR lpszPushAddr, XCHAR* ptszSDBuffer, XCHAR* ptszRVBuffer) +{ + int nHLen = 0; + int nPLen = 0; + XENGINE_PROTOCOL_AVINFO st_AVInfo = {}; + + ModuleSession_PushStream_GetAVInfo(lpszPushAddr, &st_AVInfo); + RTMPProtocol_Packet_FrameAVScript(ptszSDBuffer + nHLen, &nPLen, &st_AVInfo); + nHLen += nPLen; + if (st_AVInfo.st_VideoInfo.bEnable) + { + RTMPProtocol_Packet_FrameAVCConfigure(ptszSDBuffer + nHLen, &nPLen, &st_AVInfo); + nHLen += nPLen; + } + if (st_AVInfo.st_AudioInfo.bEnable) + { + RTMPProtocol_Packet_FrameAACConfigure(ptszSDBuffer + nHLen, &nPLen, &st_AVInfo); + nHLen += nPLen; + } + //返回数据, + XEngine_Network_Send(lpszClientAddr, ptszSDBuffer, nHLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_RTMP); + ModuleSession_PushStream_ClientInsert(lpszPushAddr, lpszClientAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_RTMP); + return true; +} bool PushStream_RTMPTask_Handle(XENGINE_RTMPHDR* pSt_RTMPHdr, LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen) { int nRVLen = 0; int nSDLen = 0; int nPMLen = 0; - XCHAR* ptszRVBuffer = (XCHAR*)malloc(XENGINE_MEMORY_SIZE_MAX); - XCHAR* ptszSDBuffer = (XCHAR*)malloc(XENGINE_MEMORY_SIZE_MAX); - XCHAR* ptszMSGBuffer = (XCHAR*)malloc(XENGINE_MEMORY_SIZE_MAX); - + XCHAR* ptszRVBuffer = (XCHAR*)ManagePool_Memory_Alloc(xhMemoryPool, XENGINE_MEMORY_SIZE_MAX); + XCHAR* ptszSDBuffer = (XCHAR*)ManagePool_Memory_Alloc(xhMemoryPool, XENGINE_MEMORY_SIZE_MAX); + XCHAR* ptszMSGBuffer = (XCHAR*)ManagePool_Memory_Alloc(xhMemoryPool, XENGINE_MEMORY_SIZE_MAX); if (XENGINE_STREAMMEDIA_RTMP_MSGTYPE_CONNREQ == pSt_RTMPHdr->byTypeID) { XBYTE byVersion = 0; @@ -188,6 +211,8 @@ bool PushStream_RTMPTask_Handle(XENGINE_RTMPHDR* pSt_RTMPHdr, LPCXSTR lpszClient XEngine_AVPacket_AVSetTime(lpszClientAddr, st_AVInfo.st_VideoInfo.nFrameRate, st_AVInfo.st_AudioInfo.nSampleRate); ModuleSession_PushStream_SetAVInfo(lpszClientAddr, &st_AVInfo); BaseLib_Memory_Free((XPPPMEM)&st_RTMPData.ppSt_CMDProperty, st_RTMPData.nCount); + //如果启用了预拉流 + XEngine_AVPacket_AVPrePlay(lpszClientAddr, ptszSDBuffer, ptszRVBuffer, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_RTMP); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("RTMP推流端:%s,请求数据协议解析成功,数据列表个数:%d"), lpszClientAddr, st_RTMPData.nCount); } else if (XENGINE_STREAMMEDIA_RTMP_MSGTYPE_COMMAND == pSt_RTMPHdr->byTypeID) @@ -333,6 +358,7 @@ bool PushStream_RTMPTask_Handle(XENGINE_RTMPHDR* pSt_RTMPHdr, LPCXSTR lpszClient } else if (0 == _tcsxnicmp(XENGINE_STREAMMEDIA_RTMP_COMMAND_PLAY, st_RTMPCommand.tszCMDName, strlen(XENGINE_STREAMMEDIA_RTMP_COMMAND_PLAY))) { + bool bSMSFound = false; XCHAR tszSMSAddr[2048]; XCHAR tszLiveName[MAX_PATH]; XCHAR tszPushAddr[MAX_PATH]; @@ -349,6 +375,50 @@ bool PushStream_RTMPTask_Handle(XENGINE_RTMPHDR* pSt_RTMPHdr, LPCXSTR lpszClient memset(st_RTMPCommand.tszCMDName, '\0', sizeof(st_RTMPCommand.tszCMDName)); st_RTMPCommand.nProCount = 0; st_RTMPCommand.nObCount = 0; + //查找流 + if (ModuleSession_PushStream_FindStream(tszSMSAddr, tszPushAddr)) + { + bSMSFound = true; + } + else + { + bSMSFound = false; + //不存在,看看是否支持预拉流 + if (!st_ServiceConfig.st_XPull.st_PullRtmp.bPrePull) + { + st_RTMPCommand.nProCount = 4; + BaseLib_Memory_Malloc((XPPPMEM)&st_RTMPCommand.ppSt_CMDProperty, st_RTMPCommand.nProCount, sizeof(XENGINE_RTMPCMDPROPERTY)); + + strcpy(st_RTMPCommand.tszCMDName, XENGINE_STREAMMEDIA_RTMP_COMMAND_ONSTATUS); + + _tcsxcpy(st_RTMPCommand.ppSt_CMDProperty[0]->tszKeyBuffer, "level"); + st_RTMPCommand.ppSt_CMDProperty[0]->st_CMDOBJect.byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING; + st_RTMPCommand.ppSt_CMDProperty[0]->st_CMDOBJect.nMLen = 5; + _tcsxcpy(st_RTMPCommand.ppSt_CMDProperty[0]->st_CMDOBJect.tszMsgBuffer, "error"); + + LPCXSTR lpszCMDString = _X("NetStream.Play.StreamNotFound"); + _tcsxcpy(st_RTMPCommand.ppSt_CMDProperty[1]->tszKeyBuffer, "code"); + st_RTMPCommand.ppSt_CMDProperty[1]->st_CMDOBJect.byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING; + st_RTMPCommand.ppSt_CMDProperty[1]->st_CMDOBJect.nMLen = (XSHOT)_tcsxlen(lpszCMDString); + _tcsxcpy(st_RTMPCommand.ppSt_CMDProperty[1]->st_CMDOBJect.tszMsgBuffer, lpszCMDString); + + LPCXSTR lpszCMDDescription = _X("The stream does not exist"); + _tcsxcpy(st_RTMPCommand.ppSt_CMDProperty[2]->tszKeyBuffer, "description"); + st_RTMPCommand.ppSt_CMDProperty[2]->st_CMDOBJect.byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING; + st_RTMPCommand.ppSt_CMDProperty[2]->st_CMDOBJect.nMLen = (XSHOT)_tcsxlen(lpszCMDDescription); + _tcsxcpy(st_RTMPCommand.ppSt_CMDProperty[2]->st_CMDOBJect.tszMsgBuffer, lpszCMDDescription); + + _tcsxcpy(st_RTMPCommand.ppSt_CMDProperty[3]->tszKeyBuffer, "details"); + st_RTMPCommand.ppSt_CMDProperty[3]->st_CMDOBJect.byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING; + st_RTMPCommand.ppSt_CMDProperty[3]->st_CMDOBJect.nMLen = (XSHOT)_tcsxlen(tszSMSAddr); + _tcsxcpy(st_RTMPCommand.ppSt_CMDProperty[3]->st_CMDOBJect.tszMsgBuffer, tszSMSAddr); + + RTMPProtocol_Help_PKTCommand(ptszSDBuffer, &nSDLen, 3, &st_RTMPCommand); + XEngine_Network_Send(lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_RTMP); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("拉流端:%s,请求拉流的参数不正确:%s,流没有找到,错误:%lX"), lpszClientAddr, tszSMSAddr, ModuleSession_GetLastError()); + return false; + } + } //RTMP拉流端 XENGINE_RTMPUSERCONTROL st_RTMPControl; memset(&st_RTMPControl, '\0', sizeof(XENGINE_RTMPUSERCONTROL)); @@ -358,7 +428,7 @@ bool PushStream_RTMPTask_Handle(XENGINE_RTMPHDR* pSt_RTMPHdr, LPCXSTR lpszClient //流开始 RTMPProtocol_Help_PKTUserControl(ptszSDBuffer, &nSDLen, &st_RTMPControl); XEngine_Network_Send(lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_RTMP); - //状态,有没有这个流 + //状态 st_RTMPCommand.nProCount = 3; BaseLib_Memory_Malloc((XPPPMEM)&st_RTMPCommand.ppSt_CMDProperty, st_RTMPCommand.nProCount, sizeof(XENGINE_RTMPCMDPROPERTY)); @@ -378,39 +448,17 @@ bool PushStream_RTMPTask_Handle(XENGINE_RTMPHDR* pSt_RTMPHdr, LPCXSTR lpszClient st_RTMPCommand.ppSt_CMDProperty[2]->st_CMDOBJect.byType = XENGINE_STREAMMEDIA_RTMP_PLTYPE_AFM0_STRING; st_RTMPCommand.ppSt_CMDProperty[2]->st_CMDOBJect.nMLen = 10; _tcsxcpy(st_RTMPCommand.ppSt_CMDProperty[2]->st_CMDOBJect.tszMsgBuffer, "Start live"); + RTMPProtocol_Help_PKTCommand(ptszSDBuffer, &nSDLen, 5, &st_RTMPCommand); XEngine_Network_Send(lpszClientAddr, ptszSDBuffer, nSDLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_RTMP); - //发送RTMP包头 - if (!ModuleSession_PushStream_FindStream(tszSMSAddr, tszPushAddr)) - { - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("拉流端:%s,请求拉流的参数不正确:%s,错误:%lX"), lpszClientAddr, tszSMSAddr, ModuleSession_GetLastError()); - return false; - } - //配置头 - int nHLen = 0; - int nPLen = 0; - XENGINE_PROTOCOL_AVINFO st_AVInfo; - memset(&st_AVInfo, '\0', sizeof(XENGINE_PROTOCOL_AVINFO)); - ModuleSession_PushStream_GetAVInfo(tszPushAddr, &st_AVInfo); - - RTMPProtocol_Packet_FrameAVScript(ptszSDBuffer + nHLen, &nPLen, &st_AVInfo); - nHLen += nPLen; - if (st_AVInfo.st_VideoInfo.bEnable) - { - RTMPProtocol_Packet_FrameAVCConfigure(ptszSDBuffer + nHLen, &nPLen, &st_AVInfo); - nHLen += nPLen; - } - if (st_AVInfo.st_AudioInfo.bEnable) + //配置头 + if (bSMSFound) { - RTMPProtocol_Packet_FrameAACConfigure(ptszSDBuffer + nHLen, &nPLen, &st_AVInfo); - nHLen += nPLen; + PushStream_RTMPTask_Play(lpszClientAddr, tszPushAddr, ptszSDBuffer, ptszRVBuffer); } - //返回数据, - XEngine_Network_Send(lpszClientAddr, ptszSDBuffer, nHLen, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_RTMP); - ModuleSession_PullStream_Insert(lpszClientAddr, tszSMSAddr, tszPushAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_RTMP); - ModuleSession_PushStream_ClientInsert(tszPushAddr, lpszClientAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_RTMP); + return true; } else { @@ -455,11 +503,8 @@ bool PushStream_RTMPTask_Handle(XENGINE_RTMPHDR* pSt_RTMPHdr, LPCXSTR lpszClient XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_DEBUG, _X("RTMP推流端:%s,接受推流数据,数据大小:%d"), lpszClientAddr, nMsgLen); } - free(ptszRVBuffer); - free(ptszSDBuffer); - free(ptszMSGBuffer); - ptszRVBuffer = NULL; - ptszSDBuffer = NULL; - ptszMSGBuffer = NULL; + ManagePool_Memory_Free(xhMemoryPool, ptszRVBuffer); + ManagePool_Memory_Free(xhMemoryPool, ptszSDBuffer); + ManagePool_Memory_Free(xhMemoryPool, ptszMSGBuffer); return true; } \ No newline at end of file diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_RTMPTask.h b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_RTMPTask.h index 519e855..ae39a32 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_RTMPTask.h +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_RTMPTask.h @@ -12,5 +12,7 @@ *********************************************************************/ //任务处理池,用来获取一个完整包 XHTHREAD CALLBACK PushStream_RTMPTask_Thread(XPVOID lParam); +//预处理封包 +bool PushStream_RTMPTask_Play(LPCXSTR lpszClientAddr, LPCXSTR lpszPushAddr, XCHAR* ptszSDBuffer, XCHAR* ptszRVBuffer); //任务处理相关函数,处理包的内容 bool PushStream_RTMPTask_Handle(XENGINE_RTMPHDR* pSt_RTMPHdr, LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen); \ No newline at end of file diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_SrtTask.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_SrtTask.cpp index d235a30..33c7a2c 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_SrtTask.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_SrtTask.cpp @@ -35,14 +35,27 @@ bool PushStream_SrtTask_Connct(LPCXSTR lpszClientAddr, XSOCKET hSocket) { XCHAR tszPushAddr[128]; memset(tszPushAddr, '\0', sizeof(tszPushAddr)); + + bool bSMSFound = false; //得到推流地址 - if (!ModuleSession_PushStream_FindStream(tszSMSAddr, tszPushAddr)) + if (ModuleSession_PushStream_FindStream(tszSMSAddr, tszPushAddr)) { - XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("SRT客户端:%s,请求拉流的参数不正确:%s,错误:%lX"), lpszClientAddr, tszSMSAddr, ModuleSession_GetLastError()); - return false; + bSMSFound = true; + } + else + { + if (!st_ServiceConfig.st_XPull.st_PullSrt.bPrePull) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("SRT客户端:%s,请求拉流的参数不正确:%s,错误:%lX"), lpszClientAddr, tszSMSAddr, ModuleSession_GetLastError()); + return false; + } + bSMSFound = false; } ModuleSession_PullStream_Insert(lpszClientAddr, tszSMSAddr, tszPushAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_SRT); - ModuleSession_PushStream_ClientInsert(tszPushAddr, lpszClientAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_SRT); + if (bSMSFound) + { + ModuleSession_PushStream_ClientInsert(tszPushAddr, lpszClientAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_SRT); + } XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("SRT客户端:%s,拉取流成功,拉流地址:%s,类型:拉流端"), lpszClientAddr, tszSMSAddr); } return true; @@ -101,8 +114,8 @@ bool PushStream_SrtTask_ThreadProcess(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuf { int nRVLen = 0; int nSDLen = 0; - XCHAR* ptszRVBuffer = (XCHAR*)malloc(XENGINE_MEMORY_SIZE_MAX); - XCHAR* ptszSDBuffer = (XCHAR*)malloc(XENGINE_MEMORY_SIZE_MAX); + XCHAR* ptszRVBuffer = (XCHAR*)ManagePool_Memory_Alloc(xhMemoryPool, XENGINE_MEMORY_SIZE_MAX); + XCHAR* ptszSDBuffer = (XCHAR*)ManagePool_Memory_Alloc(xhMemoryPool, XENGINE_MEMORY_SIZE_MAX); if (0x1b == byAVType) { @@ -141,9 +154,7 @@ bool PushStream_SrtTask_ThreadProcess(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuf XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_DEBUG, _X("SRT推流端:%s,接受音频推流数据,数据大小:%d"), lpszClientAddr, nMsgLen); } - free(ptszRVBuffer); - free(ptszSDBuffer); - ptszRVBuffer = NULL; - ptszSDBuffer = NULL; + ManagePool_Memory_Free(xhMemoryPool, ptszRVBuffer); + ManagePool_Memory_Free(xhMemoryPool, ptszSDBuffer); return true; } \ No newline at end of file diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_XStreamTask.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_XStreamTask.cpp index 4f170ea..3c66251 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_XStreamTask.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/StreamMedia_PushStream/PushStream_XStreamTask.cpp @@ -53,8 +53,8 @@ bool PushStream_XStreamTask_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR { int nRVLen = 0; int nSDLen = 0; - XCHAR* ptszRVBuffer = (XCHAR*)malloc(XENGINE_MEMORY_SIZE_MAX); - XCHAR* ptszSDBuffer = (XCHAR*)malloc(XENGINE_MEMORY_SIZE_MAX); + XCHAR* ptszRVBuffer = (XCHAR*)ManagePool_Memory_Alloc(xhMemoryPool, XENGINE_MEMORY_SIZE_MAX); + XCHAR* ptszSDBuffer = (XCHAR*)ManagePool_Memory_Alloc(xhMemoryPool, XENGINE_MEMORY_SIZE_MAX); if (ENUM_XENGINE_COMMUNICATION_PROTOCOL_TYPE_HEARTBEAT == pSt_ProtocolHdr->unOperatorType) { @@ -130,9 +130,7 @@ bool PushStream_XStreamTask_Handle(XENGINE_PROTOCOLHDR* pSt_ProtocolHdr, LPCXSTR XEngine_Network_Send(lpszClientAddr, (LPCXSTR)pSt_ProtocolHdr, sizeof(XENGINE_PROTOCOLHDR), ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_XSTREAM); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X("XStream推流端:%s,主协议错误,协议:%x 不支持"), lpszClientAddr, pSt_ProtocolHdr->unOperatorType); } - free(ptszRVBuffer); - free(ptszSDBuffer); - ptszRVBuffer = NULL; - ptszSDBuffer = NULL; + ManagePool_Memory_Free(xhMemoryPool, ptszRVBuffer); + ManagePool_Memory_Free(xhMemoryPool, ptszSDBuffer); return true; } \ No newline at end of file diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_AVPacket.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_AVPacket.cpp index 9dce294..c3b5e30 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_AVPacket.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_AVPacket.cpp @@ -80,6 +80,51 @@ bool XEngine_AVPacket_AVSetTime(LPCXSTR lpszClientAddr, int nVideoParament, int } return true; } +bool XEngine_AVPacket_AVPrePlay(LPCXSTR lpszClientAddr, XCHAR* ptszSDBuffer, XCHAR* ptszRVBuffer, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE enPushType) +{ + XCHAR tszSMSAddr[MAX_PATH] = {}; + ModuleSession_PushStream_GetAddrForAddr(lpszClientAddr, tszSMSAddr); + //获得所有预拉流客户端 + int nListCount = 0; + STREAMMEDIA_PULLLISTINFO** ppSt_PullList; + ModuleSession_PullStream_GetList(&ppSt_PullList, &nListCount, tszSMSAddr); + for (int i = 0; i < nListCount; i++) + { + //rtmp预拉流 + if (ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PUSH_RTMP == enPushType) + { + //判断客户端 + if (st_ServiceConfig.st_XPull.st_PullRtmp.bPrePull && ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_RTMP == ppSt_PullList[i]->enStreamType) + { + PushStream_RTMPTask_Play(ppSt_PullList[i]->tszClientAddr, lpszClientAddr, ptszSDBuffer, ptszRVBuffer); + ModuleSession_PullStream_SetPushAddr(ppSt_PullList[i]->tszClientAddr, lpszClientAddr); + } + if (st_ServiceConfig.st_XPull.st_PullFlv.bPrePull && ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_FLV == ppSt_PullList[i]->enStreamType) + { + PullStream_ClientGet_FLVPlay(ppSt_PullList[i]->tszClientAddr, lpszClientAddr, ptszSDBuffer, ptszRVBuffer); + ModuleSession_PullStream_SetPushAddr(ppSt_PullList[i]->tszClientAddr, lpszClientAddr); + } + if (st_ServiceConfig.st_XPull.st_PullXStream.bPrePull && ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_XSTREAM == ppSt_PullList[i]->enStreamType) + { + PullStream_ClientGet_XStreamPlay(ppSt_PullList[i]->tszClientAddr, lpszClientAddr, ptszSDBuffer, ptszRVBuffer); + ModuleSession_PullStream_SetPushAddr(ppSt_PullList[i]->tszClientAddr, lpszClientAddr); + } + if (st_ServiceConfig.st_XPull.st_PullTs.bPrePull && ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_TS == ppSt_PullList[i]->enStreamType) + { + ModuleSession_PushStream_ClientInsert(ppSt_PullList[i]->tszClientAddr, lpszClientAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_TS); + ModuleSession_PullStream_SetPushAddr(ppSt_PullList[i]->tszClientAddr, lpszClientAddr); + } + if (st_ServiceConfig.st_XPull.st_PullSrt.bPrePull && ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_SRT == ppSt_PullList[i]->enStreamType) + { + ModuleSession_PushStream_ClientInsert(ppSt_PullList[i]->tszClientAddr, lpszClientAddr, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE_PULL_SRT); + ModuleSession_PullStream_SetPushAddr(ppSt_PullList[i]->tszClientAddr, lpszClientAddr); + } + } + } + BaseLib_Memory_Free((XPPPMEM)&ppSt_PullList, nListCount); + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("RTMP推流端:%s,预发布流通知成功,个数:%d"), lpszClientAddr, nListCount); + return true; +} bool XEngine_AVPacket_AVHdr(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, XBYTE byAVType, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE enClientType) { XENGINE_PROTOCOL_AVINFO st_AVInfo = {}; @@ -279,8 +324,6 @@ bool XEngine_AVPacket_AVHdr(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int n XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("推流端:%s,初始化音频解码器失败,错误:%lX"), lpszClientAddr, AudioCodec_GetLastError()); return false; } - int nTmp = 0; - AudioCodec_Stream_SetResample(xhDecodec, &nTmp, st_AVInfo.st_AudioInfo.nSampleRate, st_AVInfo.st_AudioInfo.nSampleRate, ENUM_AVCODEC_AUDIO_SAMPLEFMT_FLTP, ENUM_AVCODEC_AUDIO_SAMPLEFMT_S16, st_AVInfo.st_AudioInfo.nChannel, st_AVInfo.st_AudioInfo.nChannel); st_AVInfo.st_AudioInfo.enAVCodec = ENUM_XENGINE_AVCODEC_AUDIO_TYPE_AAC; if (!AudioCodec_Stream_EnInit(&xhEncodec, &st_AVInfo.st_AudioInfo)) @@ -289,7 +332,6 @@ bool XEngine_AVPacket_AVHdr(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int n XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("推流端:%s,初始化音频编码器失败,错误:%lX"), lpszClientAddr, AudioCodec_GetLastError()); return false; } - AudioCodec_Stream_SetResample(xhEncodec, &nTmp, st_AVInfo.st_AudioInfo.nSampleRate, st_AVInfo.st_AudioInfo.nSampleRate, ENUM_AVCODEC_AUDIO_SAMPLEFMT_S16, ENUM_AVCODEC_AUDIO_SAMPLEFMT_FLTP, st_AVInfo.st_AudioInfo.nChannel, st_AVInfo.st_AudioInfo.nChannel); if (!ModuleSession_PushStream_AudioCodecSet(lpszClientAddr, xhDecodec, xhEncodec)) { diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_AVPacket.h b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_AVPacket.h index d42f2f1..32bff5c 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_AVPacket.h +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_AVPacket.h @@ -20,5 +20,6 @@ typedef struct bool XEngine_AVPacket_AVCreate(LPCXSTR lpszClientAddr); bool XEngine_AVPacket_AVDelete(LPCXSTR lpszClientAddr); bool XEngine_AVPacket_AVSetTime(LPCXSTR lpszClientAddr, int nVideoParament, int nAudioParament); +bool XEngine_AVPacket_AVPrePlay(LPCXSTR lpszClientAddr, XCHAR* ptszSDBuffer, XCHAR* ptszRVBuffer, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE enPushType); bool XEngine_AVPacket_AVHdr(LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, XBYTE byAVType, ENUM_XENGINE_STREAMMEDIA_CLIENT_TYPE enClientType); bool XEngine_AVPacket_AVFrame(XCHAR* ptszSDBuffer, int* pInt_SDLen, XCHAR* ptszRVBuffer, int* pInt_RVLen, LPCXSTR lpszClientAddr, LPCXSTR lpszMsgBuffer, int nMsgLen, XBYTE byAVType); \ No newline at end of file diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_Hdr.h b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_Hdr.h index 326061b..f34bfbf 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_Hdr.h +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_Hdr.h @@ -108,6 +108,7 @@ using namespace std; extern bool bIsRun; extern bool bIsTest; extern XHANDLE xhLog; +extern XHANDLE xhMemoryPool; //HTTP服务器 extern XHANDLE xhHttpSocket; extern XHANDLE xhHttpHeart; @@ -144,34 +145,70 @@ extern XENGINE_SERVICECONFIG st_ServiceConfig; //调试 extern FILE* pSt_VFile; extern FILE* pSt_AFile; - //连接库 #ifdef _MSC_BUILD -#ifdef _WIN64 +#pragma comment(lib,"Ws2_32.lib") +#pragma comment(lib,"Dbghelp.lib") +#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib.lib") +#pragma comment(lib,"XEngine_Core/XEngine_Core.lib") +#pragma comment(lib,"XEngine_Core/XEngine_ManagePool.lib") +#pragma comment(lib,"XEngine_Core/XEngine_Cryption.lib") +#pragma comment(lib,"XEngine_NetHelp/NetHelp_XSocket.lib") +#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIHelp.lib") +#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIAddr.lib") +#pragma comment(lib,"XEngine_HelpComponents/HelpComponents_XLog.lib") +#pragma comment(lib,"XEngine_HelpComponents/HelpComponents_Packets") +#pragma comment(lib,"XEngine_RfcComponents/RfcComponents_HttpProtocol.lib") +#pragma comment(lib,"XEngine_RfcComponents/RfcComponents_NatProtocol.lib") +#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_SDPProtocol.lib") +#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_FLVProtocol.lib") +#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_RTMPProtocol.lib") +#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_HLSProtocol.lib") +#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_RTSPProtocol.lib") +#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_RTPProtocol.lib") +#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_RTCPProtocol.lib") +#pragma comment(lib,"XEngine_AVCodec/XEngine_AVHelp.lib") +#pragma comment(lib,"XEngine_AVCodec/XEngine_AudioCodec.lib") +#pragma comment(lib,"XEngine_SystemSdk/XEngine_SystemApi.lib") #ifdef _DEBUG +#ifdef _M_X64 #pragma comment(lib,"../../x64/Debug/XEngine_ModuleConfigure.lib") #pragma comment(lib,"../../x64/Debug/XEngine_ModuleProtocol.lib") #pragma comment(lib,"../../x64/Debug/XEngine_ModuleSession.lib") #pragma comment(lib,"../../x64/Debug/XEngine_ModuleHelp") #pragma comment(lib,"../../x64/Debug/XEngine_ModuleQueue") #pragma comment(lib,"../../x64/Debug/XEngine_InfoReport") -#else -#pragma comment(lib,"../../x64/Release/XEngine_ModuleConfigure.lib") -#pragma comment(lib,"../../x64/Release/XEngine_ModuleProtocol.lib") -#pragma comment(lib,"../../x64/Release/XEngine_ModuleSession.lib") -#pragma comment(lib,"../../x64/Release/XEngine_ModuleHelp") -#pragma comment(lib,"../../x64/Release/XEngine_ModuleQueue") -#pragma comment(lib,"../../x64/Release/XEngine_InfoReport") -#endif -#else -#ifdef _DEBUG +#elif _M_ARM64 +#pragma comment(lib,"../../ARM64/Debug/XEngine_ModuleConfigure.lib") +#pragma comment(lib,"../../ARM64/Debug/XEngine_ModuleProtocol.lib") +#pragma comment(lib,"../../ARM64/Debug/XEngine_ModuleSession.lib") +#pragma comment(lib,"../../ARM64/Debug/XEngine_ModuleHelp") +#pragma comment(lib,"../../ARM64/Debug/XEngine_ModuleQueue") +#pragma comment(lib,"../../ARM64/Debug/XEngine_InfoReport") +#elif _M_IX86 #pragma comment(lib,"../../Debug/XEngine_ModuleConfigure.lib") #pragma comment(lib,"../../Debug/XEngine_ModuleProtocol.lib") #pragma comment(lib,"../../Debug/XEngine_ModuleSession.lib") #pragma comment(lib,"../../Debug/XEngine_ModuleHelp") #pragma comment(lib,"../../Debug/XEngine_ModuleQueue") #pragma comment(lib,"../../Debug/XEngine_InfoReport") +#endif #else +#ifdef _M_X64 +#pragma comment(lib,"../../x64/Release/XEngine_ModuleConfigure.lib") +#pragma comment(lib,"../../x64/Release/XEngine_ModuleProtocol.lib") +#pragma comment(lib,"../../x64/Release/XEngine_ModuleSession.lib") +#pragma comment(lib,"../../x64/Release/XEngine_ModuleHelp") +#pragma comment(lib,"../../x64/Release/XEngine_ModuleQueue") +#pragma comment(lib,"../../x64/Release/XEngine_InfoReport") +#elif _M_ARM64 +#pragma comment(lib,"../../ARM64/Release/XEngine_ModuleConfigure.lib") +#pragma comment(lib,"../../ARM64/Release/XEngine_ModuleProtocol.lib") +#pragma comment(lib,"../../ARM64/Release/XEngine_ModuleSession.lib") +#pragma comment(lib,"../../ARM64/Release/XEngine_ModuleHelp") +#pragma comment(lib,"../../ARM64/Release/XEngine_ModuleQueue") +#pragma comment(lib,"../../ARM64/Release/XEngine_InfoReport") +#elif _M_IX86 #pragma comment(lib,"../../Release/XEngine_ModuleConfigure.lib") #pragma comment(lib,"../../Release/XEngine_ModuleProtocol.lib") #pragma comment(lib,"../../Release/XEngine_ModuleSession.lib") @@ -180,27 +217,4 @@ extern FILE* pSt_AFile; #pragma comment(lib,"../../Release/XEngine_InfoReport") #endif #endif -#pragma comment(lib,"XEngine_BaseLib/XEngine_BaseLib.lib") -#pragma comment(lib,"XEngine_Core/XEngine_Core.lib") -#pragma comment(lib,"XEngine_Core/XEngine_ManagePool.lib") -#pragma comment(lib,"XEngine_Core/XEngine_Cryption.lib") -#pragma comment(lib,"XEngine_NetHelp/NetHelp_XSocket.lib") -#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIHelp.lib") -#pragma comment(lib,"XEngine_NetHelp/NetHelp_APIAddr.lib") -#pragma comment(lib,"XEngine_HelpComponents/HelpComponents_XLog.lib") -#pragma comment(lib,"XEngine_HelpComponents/HelpComponents_Packets") -#pragma comment(lib,"XEngine_RfcComponents/RfcComponents_HttpProtocol.lib") -#pragma comment(lib,"XEngine_RfcComponents/RfcComponents_NatProtocol.lib") -#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_SDPProtocol.lib") -#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_FLVProtocol.lib") -#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_RTMPProtocol.lib") -#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_HLSProtocol.lib") -#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_RTSPProtocol.lib") -#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_RTPProtocol.lib") -#pragma comment(lib,"XEngine_StreamMedia/StreamMedia_RTCPProtocol.lib") -#pragma comment(lib,"XEngine_AVCodec/XEngine_AVHelp.lib") -#pragma comment(lib,"XEngine_AVCodec/XEngine_AudioCodec.lib") -#pragma comment(lib,"XEngine_SystemSdk/XEngine_SystemApi.lib") -#pragma comment(lib,"Ws2_32.lib") -#pragma comment(lib,"Dbghelp.lib") #endif \ No newline at end of file diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_StreamMediaApp.cpp b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_StreamMediaApp.cpp index f28e027..3ec29c0 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_StreamMediaApp.cpp +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_StreamMediaApp.cpp @@ -13,6 +13,7 @@ bool bIsRun = false; bool bIsTest = false; XHANDLE xhLog = NULL; +XHANDLE xhMemoryPool = NULL; //HTTP服务器 XHANDLE xhHttpSocket = NULL; XHANDLE xhHttpHeart = NULL; @@ -96,6 +97,7 @@ void ServiceApp_Stop(int signo) ModuleHelp_SRTPCore_Destory(); HLSProtocol_M3u8Packet_Delete(xhHLSFile); + ManagePool_Memory_Destory(xhMemoryPool); HelpComponents_XLog_Destroy(xhLog); if (NULL != pSt_AFile) { @@ -221,13 +223,21 @@ int main(int argc, char** argv) goto XENGINE_SERVICEAPP_EXIT; } //设置日志打印级别 - HelpComponents_XLog_SetLogPriority(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO); + HelpComponents_XLog_SetLogPriority(xhLog, st_ServiceConfig.st_XLog.nLogType); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化日志系统成功")); signal(SIGINT, ServiceApp_Stop); signal(SIGTERM, ServiceApp_Stop); signal(SIGABRT, ServiceApp_Stop); XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化信号量成功")); + + xhMemoryPool = ManagePool_Memory_Create(); + if (NULL == xhMemoryPool) + { + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("启动服务中,初始化内存池失败,错误:%lX"), ManagePool_GetLastError()); + goto XENGINE_SERVICEAPP_EXIT; + } + XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,初始化内存池成功")); //启动HTTP服务相关代码 if (st_ServiceConfig.nHttpPort > 0) { @@ -457,7 +467,6 @@ int main(int argc, char** argv) XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("启动服务中,启动JT1078处理线程池成功,线程个数:%d"), st_ServiceConfig.st_XMax.nJT1078Thread); } #if 1 == _XENGINE_STREAMMEDIA_BUILDSWITCH_SRT - if (!ModuleHelp_SrtCore_Init()) { XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_ERROR, _X("启动服务中,初始化SRT服务失败,错误:%lX"), ModuleHelp_GetLastError()); @@ -524,7 +533,7 @@ int main(int argc, char** argv) #else XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X("启动服务中,SRTP协议编译选项被禁用,无法使用SRTP协议")); #endif - + if (st_ServiceConfig.st_XPull.st_PullRtsp.bEnable) { xhVRTPSocket = NetCore_UDPXCore_StartEx(st_ServiceConfig.st_XPull.st_PullRtsp.nVRTPPort, 1); @@ -611,6 +620,7 @@ int main(int argc, char** argv) { XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X("启动服务中,HLS(M3U8)文件流被设置为禁用")); } +#ifndef _DEBUG //发送信息报告 if (st_ServiceConfig.st_XReport.bEnable && !bIsTest) { @@ -628,7 +638,7 @@ int main(int argc, char** argv) { XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_WARN, _X("启动服务中,信息报告给API服务器没有启用")); } - +#endif XLOG_PRINT(xhLog, XENGINE_HELPCOMPONENTS_XLOG_IN_LOGLEVEL_INFO, _X("所有服务成功启动,服务运行中,XEngine版本:%s,服务版本:%s,发行次数;%d。。。"), BaseLib_Version_XNumberStr(), st_ServiceConfig.st_XVer.pStl_ListVer->front().c_str(), st_ServiceConfig.st_XVer.pStl_ListVer->size()); @@ -695,6 +705,7 @@ int main(int argc, char** argv) ModuleHelp_SRTPCore_Destory(); HLSProtocol_M3u8Packet_Delete(xhHLSFile); + ManagePool_Memory_Destory(xhMemoryPool); HelpComponents_XLog_Destroy(xhLog); if (NULL != pSt_AFile) { diff --git a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_StreamMediaApp.vcxproj b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_StreamMediaApp.vcxproj index 67d6625..5f627b0 100644 --- a/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_StreamMediaApp.vcxproj +++ b/XEngine_Source/XEngine_ServiceApp/XEngine_StreamMediaApp/XEngine_StreamMediaApp.vcxproj @@ -1,10 +1,18 @@ + + Debug + ARM64 + Debug Win32 + + Release + ARM64 + Release Win32 @@ -45,6 +53,12 @@ v143 Unicode + + Application + true + v143 + Unicode + Application false @@ -52,6 +66,13 @@ true Unicode + + Application + false + v143 + true + Unicode + @@ -66,9 +87,15 @@ + + + + + + $(XEngine_Include);$(IncludePath) @@ -82,10 +109,18 @@ $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + $(XEngine_Include);$(IncludePath) $(XEngine_Lib64);$(LibraryPath) + + $(XEngine_Include);$(IncludePath) + $(XEngine_LibArm64);$(LibraryPath) + false @@ -136,6 +171,20 @@ true + + + Level3 + true + _DEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + stdcpp20 + stdc17 + + + Console + true + + Level3 @@ -155,6 +204,25 @@ true + + + Level3 + true + true + true + NDEBUG;_CONSOLE;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) + true + /utf-8 %(AdditionalOptions) + stdcpp20 + stdc17 + + + Console + true + true + true + +