mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 19:00:01 +08:00
支持SDP munging方式simulicast (#1639)
This commit is contained in:
parent
ee15c571e0
commit
6cab65f7b0
@ -895,7 +895,7 @@ void RtcSession::loadFrom(const string &str) {
|
||||
CHECK(rtc_media.rtp_rtx_ssrc.size() <= 1);
|
||||
} else {
|
||||
//simulcast的情况下,要么没有指定ssrc,要么指定的ssrc个数与rid个数一致
|
||||
CHECK(rtc_media.rtp_ssrc_sim.empty() || rtc_media.rtp_ssrc_sim.size() == rtc_media.rtp_rids.size());
|
||||
//CHECK(rtc_media.rtp_ssrc_sim.empty() || rtc_media.rtp_ssrc_sim.size() == rtc_media.rtp_rids.size());
|
||||
}
|
||||
|
||||
auto rtpmap_arr = media.getAllItem<SdpAttrRtpMap>('a', "rtpmap");
|
||||
@ -1290,7 +1290,7 @@ void RtcMedia::checkValid() const{
|
||||
CHECK(type == TrackApplication || rtcp_mux, "只支持rtcp-mux模式");
|
||||
|
||||
bool send_rtp = (direction == RtpDirection::sendonly || direction == RtpDirection::sendrecv);
|
||||
if (rtp_rids.empty() && rtp_ssrc_sim.empty()) {
|
||||
if (!supportSimulcast()) {
|
||||
//非simulcast时,检查有没有指定rtp ssrc
|
||||
CHECK(!rtp_rtx_ssrc.empty() || !send_rtp);
|
||||
}
|
||||
@ -1594,7 +1594,6 @@ RETRY:
|
||||
#ifdef ENABLE_SCTP
|
||||
answer_media.direction = matchDirection(offer_media.direction, configure.direction);
|
||||
answer_media.candidate = configure.candidate;
|
||||
|
||||
#else
|
||||
answer_media.direction = RtpDirection::inactive;
|
||||
#endif
|
||||
@ -1640,7 +1639,10 @@ RETRY:
|
||||
answer_media.fingerprint = configure.fingerprint;
|
||||
answer_media.ice_lite = configure.ice_lite;
|
||||
answer_media.candidate = configure.candidate;
|
||||
// copy simulicast setting
|
||||
answer_media.rtp_rids = offer_media.rtp_rids;
|
||||
answer_media.rtp_ssrc_sim = offer_media.rtp_ssrc_sim;
|
||||
|
||||
answer_media.role = mathDtlsRole(offer_media.role);
|
||||
|
||||
//如果codec匹配失败,那么禁用该track
|
||||
|
@ -463,6 +463,13 @@ void WebRtcTransportImp::onStartWebRTC() {
|
||||
if (m_offer->rtp_rids.size() > index) {
|
||||
//支持firefox的simulcast, 提前映射好ssrc和rid的关系
|
||||
track->rtp_ext_ctx->setRid(ssrc.ssrc, m_offer->rtp_rids[index]);
|
||||
} else {
|
||||
// SDP munging没有rid, 它通过group-ssrc:SIM给出ssrc列表;
|
||||
// 系统又要有rid,这里手工生成rid,并为其绑定ssrc
|
||||
std::string rid = "r" + std::to_string(index);
|
||||
track->rtp_ext_ctx->setRid(ssrc.ssrc, rid);
|
||||
if(ssrc.rtx_ssrc)
|
||||
track->rtp_ext_ctx->setRid(ssrc.rtx_ssrc, rid);
|
||||
}
|
||||
++index;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user