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