From 2a906ad04a183ef343916971274dbf2835d7e77d Mon Sep 17 00:00:00 2001 From: Johnny Date: Tue, 12 Oct 2021 17:04:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=9D=E7=95=99=20WebRtcTransport::onCheckSd?= =?UTF-8?q?p=20=E6=8E=A5=E5=8F=A3=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- webrtc/WebRtcTransport.cpp | 14 +++++++++++++- webrtc/WebRtcTransport.h | 5 +++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/webrtc/WebRtcTransport.cpp b/webrtc/WebRtcTransport.cpp index 50acad51..6a7865c8 100644 --- a/webrtc/WebRtcTransport.cpp +++ b/webrtc/WebRtcTransport.cpp @@ -188,6 +188,7 @@ std::string WebRtcTransport::getAnswerSdp(const string &offer){ _offer_sdp->loadFrom(offer); _offer_sdp->checkSdp(); _offer_sdp->checkValidSSRC(); + // onCheckSdp(SdpType::offer, *_offer_sdp); setRemoteDtlsFingerprint(*_offer_sdp); //// sdp 配置 //// @@ -202,7 +203,7 @@ std::string WebRtcTransport::getAnswerSdp(const string &offer){ //// 生成answer sdp //// _answer_sdp = configure.createAnswer(*_offer_sdp); _answer_sdp->checkSdp(); - onCheckAnswer(*_answer_sdp); + onCheckSdp(SdpType::answer, *_answer_sdp); return _answer_sdp->toString(); } catch (exception &ex) { onShutdown(SockException(Err_shutdown, ex.what())); @@ -549,6 +550,17 @@ void WebRtcTransportImp::onCheckAnswer(RtcSession &sdp) { } } +void WebRtcTransportImp::onCheckSdp(SdpType type, RtcSession &sdp) { + switch (type) { + case SdpType::answer: + onCheckAnswer(sdp); + break; + default: + // TODO for offer and other + break; + } +} + void WebRtcTransportImp::onRtcConfigure(RtcConfigure &configure) const { WebRtcTransport::onRtcConfigure(configure); diff --git a/webrtc/WebRtcTransport.h b/webrtc/WebRtcTransport.h index 081ff196..2ce8866b 100644 --- a/webrtc/WebRtcTransport.h +++ b/webrtc/WebRtcTransport.h @@ -106,7 +106,7 @@ protected: protected: virtual void onStartWebRTC() = 0; virtual void onRtcConfigure(RtcConfigure &configure) const; - virtual void onCheckAnswer(RtcSession &sdp) = 0; + virtual void onCheckSdp(SdpType type, RtcSession &sdp) = 0; virtual void onSendSockData(const char *buf, size_t len, struct sockaddr_in *dst, bool flush = true) = 0; virtual void onRtp(const char *buf, size_t len, uint64_t stamp_ms) = 0; @@ -184,7 +184,7 @@ public: protected: void onStartWebRTC() override; void onSendSockData(const char *buf, size_t len, struct sockaddr_in *dst, bool flush = true) override; - void onCheckAnswer(RtcSession &sdp) override; + void onCheckSdp(SdpType type, RtcSession &sdp) override; void onRtcConfigure(RtcConfigure &configure) const override; void onRtp(const char *buf, size_t len, uint64_t stamp_ms) override; @@ -222,6 +222,7 @@ private: void registerSelf(); void unregisterSelf(); void unrefSelf(); + void onCheckAnswer(RtcSession &sdp); private: bool _simulcast = false;