mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 04:31:37 +08:00
Refine: 精简webrtc sdp生成ssrc line相关代码
This commit is contained in:
parent
f7963a9032
commit
daa06ffd4f
@ -1022,7 +1022,33 @@ string RtcSession::toRtspSdp() const{
|
|||||||
return sdp->toString();
|
return sdp->toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
void addSdpAttrSSRC(const RtcSSRC &rtp_ssrc, vector<SdpItem::Ptr> &items, uint32_t ssrc_num);
|
void addSdpAttrSSRC(const RtcSSRC &rtp_ssrc, vector<SdpItem::Ptr> &items, uint32_t ssrc_num) {
|
||||||
|
assert(ssrc_num);
|
||||||
|
SdpAttrSSRC ssrc;
|
||||||
|
ssrc.ssrc = ssrc_num;
|
||||||
|
|
||||||
|
ssrc.attribute = "cname";
|
||||||
|
ssrc.attribute_value = rtp_ssrc.cname;
|
||||||
|
items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrSSRC>(ssrc)));
|
||||||
|
|
||||||
|
if (!rtp_ssrc.msid.empty()) {
|
||||||
|
ssrc.attribute = "msid";
|
||||||
|
ssrc.attribute_value = rtp_ssrc.msid;
|
||||||
|
items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrSSRC>(ssrc)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rtp_ssrc.mslabel.empty()) {
|
||||||
|
ssrc.attribute = "mslabel";
|
||||||
|
ssrc.attribute_value = rtp_ssrc.mslabel;
|
||||||
|
items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrSSRC>(ssrc)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!rtp_ssrc.label.empty()) {
|
||||||
|
ssrc.attribute = "label";
|
||||||
|
ssrc.attribute_value = rtp_ssrc.label;
|
||||||
|
items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrSSRC>(ssrc)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
RtcSessionSdp::Ptr RtcSession::toRtcSessionSdp() const{
|
RtcSessionSdp::Ptr RtcSession::toRtcSessionSdp() const{
|
||||||
RtcSessionSdp::Ptr ret = std::make_shared<RtcSessionSdp>();
|
RtcSessionSdp::Ptr ret = std::make_shared<RtcSessionSdp>();
|
||||||
@ -1185,33 +1211,6 @@ RtcSessionSdp::Ptr RtcSession::toRtcSessionSdp() const{
|
|||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
void addSdpAttrSSRC(const RtcSSRC &rtp_ssrc, vector<SdpItem::Ptr> &items, uint32_t ssrc_num) {
|
|
||||||
assert(ssrc_num);
|
|
||||||
SdpAttrSSRC ssrc;
|
|
||||||
ssrc.ssrc = ssrc_num;
|
|
||||||
|
|
||||||
ssrc.attribute = "cname";
|
|
||||||
ssrc.attribute_value = rtp_ssrc.cname;
|
|
||||||
items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrSSRC>(ssrc)));
|
|
||||||
|
|
||||||
if (!rtp_ssrc.msid.empty()) {
|
|
||||||
ssrc.attribute = "msid";
|
|
||||||
ssrc.attribute_value = rtp_ssrc.msid;
|
|
||||||
items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrSSRC>(ssrc)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!rtp_ssrc.mslabel.empty()) {
|
|
||||||
ssrc.attribute = "mslabel";
|
|
||||||
ssrc.attribute_value = rtp_ssrc.mslabel;
|
|
||||||
items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrSSRC>(ssrc)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!rtp_ssrc.label.empty()) {
|
|
||||||
ssrc.attribute = "label";
|
|
||||||
ssrc.attribute_value = rtp_ssrc.label;
|
|
||||||
items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrSSRC>(ssrc)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
string RtcSession::toString() const{
|
string RtcSession::toString() const{
|
||||||
return toRtcSessionSdp()->toString();
|
return toRtcSessionSdp()->toString();
|
||||||
|
Loading…
Reference in New Issue
Block a user