mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-23 03:10:04 +08:00
完善
This commit is contained in:
parent
868b379a12
commit
83208b0b31
@ -468,6 +468,33 @@ string SdpAttrRtcp::toString() const {
|
|||||||
return SdpItem::toString();
|
return SdpItem::toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SdpAttrIceOption::parse(const string &str){
|
||||||
|
auto vec = split(str, " ");
|
||||||
|
for (auto &v : vec) {
|
||||||
|
if (!strcasecmp(v.data(), "trickle")) {
|
||||||
|
trickle = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!strcasecmp(v.data(), "renomination")) {
|
||||||
|
renomination = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
string SdpAttrIceOption::toString() const{
|
||||||
|
if (value.empty()) {
|
||||||
|
if (trickle && renomination) {
|
||||||
|
value = "trickle renomination";
|
||||||
|
} else if (trickle) {
|
||||||
|
value = "trickle";
|
||||||
|
} else if (renomination) {
|
||||||
|
value = "renomination";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
void SdpAttrFingerprint::parse(const string &str) {
|
void SdpAttrFingerprint::parse(const string &str) {
|
||||||
auto vec = split(str, " ");
|
auto vec = split(str, " ");
|
||||||
if (vec.size() != 2) {
|
if (vec.size() != 2) {
|
||||||
@ -751,9 +778,10 @@ void RtcSession::loadFrom(const string &str) {
|
|||||||
rtc_media.ice_pwd = media.getStringItem('a', "ice-pwd");
|
rtc_media.ice_pwd = media.getStringItem('a', "ice-pwd");
|
||||||
rtc_media.role = media.getItemClass<SdpAttrSetup>('a', "setup").role;
|
rtc_media.role = media.getItemClass<SdpAttrSetup>('a', "setup").role;
|
||||||
rtc_media.fingerprint = media.getItemClass<SdpAttrFingerprint>('a', "fingerprint");
|
rtc_media.fingerprint = media.getItemClass<SdpAttrFingerprint>('a', "fingerprint");
|
||||||
rtc_media.ice_trickle = media.getItem('a', "ice-trickle").operator bool();
|
|
||||||
rtc_media.ice_lite = media.getItem('a', "ice-lite").operator bool();
|
rtc_media.ice_lite = media.getItem('a', "ice-lite").operator bool();
|
||||||
rtc_media.ice_renomination = media.getItem('a', "ice-renomination").operator bool();
|
auto ice_options = media.getItemClass<SdpAttrIceOption>('a', "ice-options");
|
||||||
|
rtc_media.ice_trickle = ice_options.trickle;
|
||||||
|
rtc_media.ice_renomination = ice_options.renomination;
|
||||||
rtc_media.candidate = media.getAllItem<SdpAttrCandidate>('a', "candidate");
|
rtc_media.candidate = media.getAllItem<SdpAttrCandidate>('a', "candidate");
|
||||||
|
|
||||||
if (mline.type == TrackType::TrackApplication) {
|
if (mline.type == TrackType::TrackApplication) {
|
||||||
@ -922,15 +950,15 @@ string RtcSession::toString() const{
|
|||||||
sdp_media.items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrIcePwd>(m.ice_pwd)));
|
sdp_media.items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrIcePwd>(m.ice_pwd)));
|
||||||
sdp_media.items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrFingerprint>(m.fingerprint)));
|
sdp_media.items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrFingerprint>(m.fingerprint)));
|
||||||
sdp_media.items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrSetup>(m.role)));
|
sdp_media.items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrSetup>(m.role)));
|
||||||
if (m.ice_trickle) {
|
if (m.ice_trickle || m.ice_renomination) {
|
||||||
sdp_media.items.emplace_back(wrapSdpAttr(std::make_shared<SdpCommon>("ice-trickle")));
|
auto attr = std::make_shared<SdpAttrIceOption>();
|
||||||
|
attr->trickle = m.ice_trickle;
|
||||||
|
attr->renomination = m.ice_renomination;
|
||||||
|
sdp_media.items.emplace_back(wrapSdpAttr(attr));
|
||||||
}
|
}
|
||||||
if (m.ice_lite) {
|
if (m.ice_lite) {
|
||||||
sdp_media.items.emplace_back(wrapSdpAttr(std::make_shared<SdpCommon>("ice-lite")));
|
sdp_media.items.emplace_back(wrapSdpAttr(std::make_shared<SdpCommon>("ice-lite")));
|
||||||
}
|
}
|
||||||
if (m.ice_renomination) {
|
|
||||||
sdp_media.items.emplace_back(wrapSdpAttr(std::make_shared<SdpCommon>("ice-renomination")));
|
|
||||||
}
|
|
||||||
for (auto &ext : m.extmap) {
|
for (auto &ext : m.extmap) {
|
||||||
sdp_media.items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrExtmap>(ext)));
|
sdp_media.items.emplace_back(wrapSdpAttr(std::make_shared<SdpAttrExtmap>(ext)));
|
||||||
}
|
}
|
||||||
@ -1215,8 +1243,8 @@ shared_ptr<RtcSession> RtcConfigure::createAnswer(const RtcSession &offer){
|
|||||||
ret->session_info = "zlmediakit_webrtc_session";
|
ret->session_info = "zlmediakit_webrtc_session";
|
||||||
ret->connection.parse("IN IP4 0.0.0.0");
|
ret->connection.parse("IN IP4 0.0.0.0");
|
||||||
ret->msid_semantic.parse("WMS *");
|
ret->msid_semantic.parse("WMS *");
|
||||||
matchMedia(ret, TrackVideo, offer.media, video);
|
|
||||||
matchMedia(ret, TrackAudio, offer.media, audio);
|
matchMedia(ret, TrackAudio, offer.media, audio);
|
||||||
|
matchMedia(ret, TrackVideo, offer.media, video);
|
||||||
matchMedia(ret, TrackApplication, offer.media, application);
|
matchMedia(ret, TrackApplication, offer.media, application);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -282,6 +282,10 @@ public:
|
|||||||
class SdpAttrIceOption : public SdpItem {
|
class SdpAttrIceOption : public SdpItem {
|
||||||
public:
|
public:
|
||||||
//a=ice-options:trickle
|
//a=ice-options:trickle
|
||||||
|
bool trickle{false};
|
||||||
|
bool renomination{false};
|
||||||
|
void parse(const string &str) override;
|
||||||
|
string toString() const override;
|
||||||
const char* getKey() const override { return "ice-options";}
|
const char* getKey() const override { return "ice-options";}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ string getFingerprint(const string &algorithm_str, const std::shared_ptr<RTC::Dt
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string WebRtcTransport::getAnswerSdp(const string &offer){
|
std::string WebRtcTransport::getAnswerSdp(const string &offer){
|
||||||
InfoL << offer;
|
// InfoL << offer;
|
||||||
_offer_sdp = std::make_shared<RtcSession>();
|
_offer_sdp = std::make_shared<RtcSession>();
|
||||||
_offer_sdp->loadFrom(offer);
|
_offer_sdp->loadFrom(offer);
|
||||||
|
|
||||||
|
46
webrtc/answer.sdp
Normal file
46
webrtc/answer.sdp
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
v=0
|
||||||
|
o=- 0 0 IN IP4 0.0.0.0
|
||||||
|
s=zlmediakit_webrtc_session
|
||||||
|
i=zlmediakit_webrtc_session
|
||||||
|
t=0 0
|
||||||
|
c=IN IP4 0.0.0.0
|
||||||
|
a=msid-semantic: WMS *
|
||||||
|
a=group:BUNDLE 0 1
|
||||||
|
m=audio 0 UDP/TLS/RTP/SAVPF 111
|
||||||
|
a=mid:0
|
||||||
|
c=IN IP4 0.0.0.0
|
||||||
|
a=ice-ufrag:PdK3
|
||||||
|
a=ice-pwd:PdK31zZ1sKhPU2ACzP5av37f
|
||||||
|
a=fingerprint:sha-256 D1:4F:7B:70:86:99:BE:1E:7E:B8:C7:0F:13:BC:78:C4:6A:F9:2C:F6:F3:5E:42:11:0F:1C:74:18:F6:DD:95:75
|
||||||
|
a=setup:passive
|
||||||
|
a=ice-options:trickle
|
||||||
|
a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level
|
||||||
|
a=recvonly
|
||||||
|
a=rtcp-mux
|
||||||
|
a=rtpmap:111 opus/48000/2
|
||||||
|
a=rtcp-fb:111 transport-cc
|
||||||
|
a=fmtp:111 minptime=10;useinbandfec=1
|
||||||
|
m=video 0 UDP/TLS/RTP/SAVPF 102 121
|
||||||
|
a=mid:1
|
||||||
|
c=IN IP4 0.0.0.0
|
||||||
|
a=ice-ufrag:PdK3
|
||||||
|
a=ice-pwd:PdK31zZ1sKhPU2ACzP5av37f
|
||||||
|
a=fingerprint:sha-256 D1:4F:7B:70:86:99:BE:1E:7E:B8:C7:0F:13:BC:78:C4:6A:F9:2C:F6:F3:5E:42:11:0F:1C:74:18:F6:DD:95:75
|
||||||
|
a=setup:passive
|
||||||
|
a=ice-options:trickle
|
||||||
|
a=extmap:14 urn:ietf:params:rtp-hdrext:toffset
|
||||||
|
a=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time
|
||||||
|
a=extmap:13 urn:3gpp:video-orientation
|
||||||
|
a=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01
|
||||||
|
a=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay
|
||||||
|
a=recvonly
|
||||||
|
a=rtcp-mux
|
||||||
|
a=rtpmap:102 H264/90000
|
||||||
|
a=rtcp-fb:102 goog-remb
|
||||||
|
a=rtcp-fb:102 transport-cc
|
||||||
|
a=rtcp-fb:102 ccm fir
|
||||||
|
a=rtcp-fb:102 nack
|
||||||
|
a=rtcp-fb:102 nack pli
|
||||||
|
a=fmtp:102 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42001f
|
||||||
|
a=rtpmap:121 rtx/90000
|
||||||
|
a=fmtp:121 apt=102
|
Loading…
Reference in New Issue
Block a user