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