保留 WebRtcTransport::onCheckSdp 接口。

This commit is contained in:
Johnny 2021-10-12 17:04:21 +08:00
parent 0f4289a584
commit 2a906ad04a
2 changed files with 16 additions and 3 deletions

View File

@ -188,6 +188,7 @@ std::string WebRtcTransport::getAnswerSdp(const string &offer){
_offer_sdp->loadFrom(offer); _offer_sdp->loadFrom(offer);
_offer_sdp->checkSdp(); _offer_sdp->checkSdp();
_offer_sdp->checkValidSSRC(); _offer_sdp->checkValidSSRC();
// onCheckSdp(SdpType::offer, *_offer_sdp);
setRemoteDtlsFingerprint(*_offer_sdp); setRemoteDtlsFingerprint(*_offer_sdp);
//// sdp 配置 //// //// sdp 配置 ////
@ -202,7 +203,7 @@ 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(); _answer_sdp->checkSdp();
onCheckAnswer(*_answer_sdp); onCheckSdp(SdpType::answer, *_answer_sdp);
return _answer_sdp->toString(); return _answer_sdp->toString();
} catch (exception &ex) { } catch (exception &ex) {
onShutdown(SockException(Err_shutdown, ex.what())); 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 { void WebRtcTransportImp::onRtcConfigure(RtcConfigure &configure) const {
WebRtcTransport::onRtcConfigure(configure); WebRtcTransport::onRtcConfigure(configure);

View File

@ -106,7 +106,7 @@ protected:
protected: protected:
virtual void onStartWebRTC() = 0; virtual void onStartWebRTC() = 0;
virtual void onRtcConfigure(RtcConfigure &configure) const; 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 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; virtual void onRtp(const char *buf, size_t len, uint64_t stamp_ms) = 0;
@ -184,7 +184,7 @@ public:
protected: protected:
void onStartWebRTC() override; void onStartWebRTC() override;
void onSendSockData(const char *buf, size_t len, struct sockaddr_in *dst, bool flush = true) 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 onRtcConfigure(RtcConfigure &configure) const override;
void onRtp(const char *buf, size_t len, uint64_t stamp_ms) override; void onRtp(const char *buf, size_t len, uint64_t stamp_ms) override;
@ -222,6 +222,7 @@ private:
void registerSelf(); void registerSelf();
void unregisterSelf(); void unregisterSelf();
void unrefSelf(); void unrefSelf();
void onCheckAnswer(RtcSession &sdp);
private: private:
bool _simulcast = false; bool _simulcast = false;