From bd40c247457c351aba79a1b4f333a7ad876c9f8f Mon Sep 17 00:00:00 2001 From: wEnchanters <110988056+wEnchanters@users.noreply.github.com> Date: Thu, 22 Aug 2024 19:50:29 +0800 Subject: [PATCH] =?UTF-8?q?startSendRtp=E6=8E=A5=E5=8F=A3=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E6=8C=87=E5=AE=9A=E6=8E=A5=E6=94=B6=E6=B5=81=E7=9A=84?= =?UTF-8?q?app=E5=92=8Cvhost=E5=8F=82=E6=95=B0=20(#3841)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/WebApi.cpp | 3 +++ src/Common/MediaSource.h | 3 +++ src/Rtp/RtpSender.cpp | 3 +++ 3 files changed, 9 insertions(+) diff --git a/server/WebApi.cpp b/server/WebApi.cpp index 3f7e18fd..48b58d55 100755 --- a/server/WebApi.cpp +++ b/server/WebApi.cpp @@ -1404,6 +1404,9 @@ void installWebApi() { args.udp_rtcp_timeout = allArgs["udp_rtcp_timeout"]; args.recv_stream_id = allArgs["recv_stream_id"]; args.close_delay_ms = allArgs["close_delay_ms"]; + // 记录发送流的app和vhost + args.recv_stream_app = allArgs["app"]; + args.recv_stream_app = allArgs["vhost"]; src->getOwnerPoller()->async([=]() mutable { try { src->startSendRtp(args, [val, headerOut, invoker](uint16_t local_port, const SockException &ex) mutable { diff --git a/src/Common/MediaSource.h b/src/Common/MediaSource.h index 06499698..c1c5610b 100644 --- a/src/Common/MediaSource.h +++ b/src/Common/MediaSource.h @@ -140,6 +140,9 @@ public: // 发送rtp同时接收,一般用于双向语言对讲, 如果不为空,说明开启接收 std::string recv_stream_id; + + std::string recv_stream_app; + std::string recv_stream_vhost; }; // 开始发送ps-rtp diff --git a/src/Rtp/RtpSender.cpp b/src/Rtp/RtpSender.cpp index 3012dda7..244a107e 100644 --- a/src/Rtp/RtpSender.cpp +++ b/src/Rtp/RtpSender.cpp @@ -239,6 +239,9 @@ void RtpSender::onConnect() { if (!_args.recv_stream_id.empty()) { mINI ini; ini[RtpSession::kStreamID] = _args.recv_stream_id; + // 强制同步接收流和发送流的app和vhost + ini[RtpSession::kApp] = _args.recv_stream_app; + ini[RtpSession::kVhost] = _args.recv_stream_vhost; _rtp_session = std::make_shared(_socket_rtp); _rtp_session->setParams(ini);