openRtpServer接口新增only_audio参数,优化语音对讲场景

This commit is contained in:
xiongziliang
2023-02-17 22:43:45 +08:00
parent 5cdaf982f3
commit 8f0ba6988b
10 changed files with 80 additions and 17 deletions

View File

@@ -22,6 +22,7 @@ namespace mediakit{
const string RtpSession::kStreamID = "stream_id";
const string RtpSession::kSSRC = "ssrc";
const string RtpSession::kOnlyAudio = "only_audio";
void RtpSession::attachServer(const Server &server) {
setParams(const_cast<Server &>(server));
@@ -30,6 +31,7 @@ void RtpSession::attachServer(const Server &server) {
void RtpSession::setParams(mINI &ini) {
_stream_id = ini[kStreamID];
_ssrc = ini[kSSRC];
_only_audio = ini[kOnlyAudio];
}
RtpSession::RtpSession(const Socket::Ptr &sock) : Session(sock) {
@@ -101,6 +103,7 @@ void RtpSession::onRtpPacket(const char *data, size_t len) {
}
//tcp情况下一个tcp链接只可能是一路流不需要通过多个ssrc来区分所以不需要频繁getProcess
_process = RtpSelector::Instance().getProcess(_stream_id, true);
_process->setOnlyAudio(_only_audio);
_process->setDelegate(dynamic_pointer_cast<RtpSession>(shared_from_this()));
}
try {