Skip to content

Commit

Permalink
RtpServer返回更多信息
Browse files Browse the repository at this point in the history
  • Loading branch information
mtdxc authored and cqm committed Oct 31, 2024
1 parent 9814992 commit e69c0e6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 5 additions & 1 deletion server/WebApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,11 @@ void installWebApi() {
obj["vhost"] = vec[0];
obj["app"] = vec[1];
obj["stream_id"] = vec[2];
obj["port"] = pr.second->getPort();
auto& rtps = pr.second;
obj["port"] = rtps->getPort();
obj["ssrc"] = rtps->getSSRC();
obj["tcp_mode"] = rtps->getTcpMode();
obj["only_track"] = rtps->getOnlyTrack();
val["data"].append(obj);
}
});
Expand Down
8 changes: 8 additions & 0 deletions src/Rtp/RtpServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,5 +295,13 @@ void RtpServer::updateSSRC(uint32_t ssrc) {
}
}

uint32_t RtpServer::getSSRC() const {
if (_ssrc)
return *_ssrc;
else if (_tcp_server)
return (*_tcp_server)[RtpSession::kSSRC];
return 0;
}

}//namespace mediakit
#endif//defined(ENABLE_RTPPROXY)
3 changes: 3 additions & 0 deletions src/Rtp/RtpServer.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ class RtpServer : public std::enable_shared_from_this<RtpServer> {
*/
void updateSSRC(uint32_t ssrc);

uint32_t getSSRC() const;
int getOnlyTrack() const { return _only_track; }
TcpMode getTcpMode() const { return _tcp_mode; }
private:
// tcp主动模式连接服务器成功回调 [AUTO-TRANSLATED:0775844e]
// tcp active mode connection server success callback
Expand Down

0 comments on commit e69c0e6

Please sign in to comment.