提前映射ssrc与rid的关系

This commit is contained in:
ziyue 2021-06-25 18:08:21 +08:00
parent 0f1d1ded7e
commit 8c670c652e
3 changed files with 16 additions and 0 deletions

View File

@ -579,6 +579,10 @@ string RtpExtContext::getRid(uint32_t ssrc) const{
return it->second;
}
void RtpExtContext::setRid(uint32_t ssrc, const string &rid) {
_ssrc_to_rid[ssrc] = rid;
}
void RtpExtContext::changeRtpExtId(const RtpHeader *header, bool is_recv, string *rid_ptr) {
string rid, repaired_rid;
auto ext_map = RtpExt::getExtValue(header);

View File

@ -119,6 +119,7 @@ public:
void setOnGetRtp(OnGetRtp cb);
string getRid(uint32_t ssrc) const;
void setRid(uint32_t ssrc, const string &rid);
void changeRtpExtId(const RtpHeader *header, bool is_recv, string *rid_ptr = nullptr);
private:

View File

@ -432,6 +432,17 @@ void WebRtcTransportImp::onStartWebRTC() {
_ssrc_to_track[ssrc] = track;
InfoL << "get rtp, pt:" << (int) pt << ", ssrc:" << ssrc << ", rid:" << rid;
});
int index = 0;
for (auto &ssrc : m_offer->rtp_ssrc_sim) {
//记录ssrc对应的MediaTrack
_ssrc_to_track[ssrc.ssrc] = track;
if (m_offer->rtp_rids.size() > index) {
//支持firefox的simulcast, 提前映射好ssrc和rid的关系
track->rtp_ext_ctx->setRid(ssrc.ssrc, m_offer->rtp_rids[index]);
}
++index;
}
}
}