mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-22 10:40:05 +08:00
生成answer sdp失败时,立即销毁对象
This commit is contained in:
parent
fb9eefca69
commit
1650f63af5
@ -154,24 +154,30 @@ void WebRtcTransport::onCheckSdp(SdpType type, RtcSession &sdp){
|
||||
}
|
||||
|
||||
std::string WebRtcTransport::getAnswerSdp(const string &offer){
|
||||
//// 解析offer sdp ////
|
||||
_offer_sdp = std::make_shared<RtcSession>();
|
||||
_offer_sdp->loadFrom(offer);
|
||||
onCheckSdp(SdpType::offer, *_offer_sdp);
|
||||
setRemoteDtlsFingerprint(*_offer_sdp);
|
||||
try {
|
||||
//// 解析offer sdp ////
|
||||
_offer_sdp = std::make_shared<RtcSession>();
|
||||
_offer_sdp->loadFrom(offer);
|
||||
onCheckSdp(SdpType::offer, *_offer_sdp);
|
||||
setRemoteDtlsFingerprint(*_offer_sdp);
|
||||
|
||||
//// sdp 配置 ////
|
||||
SdpAttrFingerprint fingerprint;
|
||||
fingerprint.algorithm = _offer_sdp->media[0].fingerprint.algorithm;
|
||||
fingerprint.hash = getFingerprint(fingerprint.algorithm, _dtls_transport);
|
||||
RtcConfigure configure;
|
||||
configure.setDefaultSetting(_ice_server->GetUsernameFragment(), _ice_server->GetPassword(), RtpDirection::sendrecv, fingerprint);
|
||||
onRtcConfigure(configure);
|
||||
//// sdp 配置 ////
|
||||
SdpAttrFingerprint fingerprint;
|
||||
fingerprint.algorithm = _offer_sdp->media[0].fingerprint.algorithm;
|
||||
fingerprint.hash = getFingerprint(fingerprint.algorithm, _dtls_transport);
|
||||
RtcConfigure configure;
|
||||
configure.setDefaultSetting(_ice_server->GetUsernameFragment(), _ice_server->GetPassword(),
|
||||
RtpDirection::sendrecv, fingerprint);
|
||||
onRtcConfigure(configure);
|
||||
|
||||
//// 生成answer sdp ////
|
||||
_answer_sdp = configure.createAnswer(*_offer_sdp);
|
||||
onCheckSdp(SdpType::answer, *_answer_sdp);
|
||||
return _answer_sdp->toString();
|
||||
//// 生成answer sdp ////
|
||||
_answer_sdp = configure.createAnswer(*_offer_sdp);
|
||||
onCheckSdp(SdpType::answer, *_answer_sdp);
|
||||
return _answer_sdp->toString();
|
||||
} catch (exception &ex) {
|
||||
onShutdown(SockException(Err_shutdown, ex.what()));
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
bool is_dtls(char *buf) {
|
||||
|
Loading…
Reference in New Issue
Block a user