合并webrtc相关pr:#1154

This commit is contained in:
ziyue 2021-10-12 17:32:22 +08:00
parent 2a906ad04a
commit fbc5378058
2 changed files with 6 additions and 12 deletions

View File

@ -666,8 +666,8 @@ public:
void loadFrom(const string &sdp, bool check = true); void loadFrom(const string &sdp, bool check = true);
void checkValid() const; void checkValid() const;
//offer sdp,如果指定了发送rtp,那么应该指定ssrc
void checkSdp() const; void checkSdp() const;
//offer sdp,如果指定了发送rtp,那么应该指定ssrc
void checkValidSSRC() const; void checkValidSSRC() const;
string toString() const; string toString() const;
string toRtspSdp() const; string toRtspSdp() const;

View File

@ -174,7 +174,6 @@ void WebRtcTransport::setRemoteDtlsFingerprint(const RtcSession &remote){
_dtls_transport->SetRemoteFingerprint(remote_fingerprint); _dtls_transport->SetRemoteFingerprint(remote_fingerprint);
} }
void WebRtcTransport::onRtcConfigure(RtcConfigure &configure) const { void WebRtcTransport::onRtcConfigure(RtcConfigure &configure) const {
//开启remb后关闭twcc因为开启twcc后remb无效 //开启remb后关闭twcc因为开启twcc后remb无效
GET_CONFIG(size_t, remb_bit_rate, RTC::kRembBitRate); GET_CONFIG(size_t, remb_bit_rate, RTC::kRembBitRate);
@ -186,9 +185,7 @@ std::string WebRtcTransport::getAnswerSdp(const string &offer){
//// 解析offer sdp //// //// 解析offer sdp ////
_offer_sdp = std::make_shared<RtcSession>(); _offer_sdp = std::make_shared<RtcSession>();
_offer_sdp->loadFrom(offer); _offer_sdp->loadFrom(offer);
_offer_sdp->checkSdp(); onCheckSdp(SdpType::offer, *_offer_sdp);
_offer_sdp->checkValidSSRC();
// onCheckSdp(SdpType::offer, *_offer_sdp);
setRemoteDtlsFingerprint(*_offer_sdp); setRemoteDtlsFingerprint(*_offer_sdp);
//// sdp 配置 //// //// sdp 配置 ////
@ -202,7 +199,6 @@ std::string WebRtcTransport::getAnswerSdp(const string &offer){
//// 生成answer sdp //// //// 生成answer sdp ////
_answer_sdp = configure.createAnswer(*_offer_sdp); _answer_sdp = configure.createAnswer(*_offer_sdp);
_answer_sdp->checkSdp();
onCheckSdp(SdpType::answer, *_answer_sdp); onCheckSdp(SdpType::answer, *_answer_sdp);
return _answer_sdp->toString(); return _answer_sdp->toString();
} catch (exception &ex) { } catch (exception &ex) {
@ -551,13 +547,11 @@ void WebRtcTransportImp::onCheckAnswer(RtcSession &sdp) {
} }
void WebRtcTransportImp::onCheckSdp(SdpType type, RtcSession &sdp) { void WebRtcTransportImp::onCheckSdp(SdpType type, RtcSession &sdp) {
sdp.checkSdp();
switch (type) { switch (type) {
case SdpType::answer: case SdpType::answer: onCheckAnswer(sdp); break;
onCheckAnswer(sdp); case SdpType::offer: sdp.checkValidSSRC(); break;
break; default: /*不可达*/ assert(0); break;
default:
// TODO for offer and other
break;
} }
} }