支持单独的datachannel通道 (#1894)

* 支持单独的datachannel 通道

* 当仅有datachannel时 ,忽略rtp和rtcp超时

* 单独开启datachannel时,通过dtls包维持心跳

Co-authored-by: xiongziliang <771730766@qq.com>
This commit is contained in:
Dw9
2022-08-20 10:28:19 +08:00
committed by GitHub
parent 39d2255771
commit b7ef766701
4 changed files with 24 additions and 1 deletions

View File

@@ -377,7 +377,7 @@ void WebRtcTransportImp::onCreate() {
return false;
}
if (strong_self->_alive_ticker.elapsedTime() > timeoutSec * 1000) {
strong_self->onShutdown(SockException(Err_timeout, "接受rtprtcp超时"));
strong_self->onShutdown(SockException(Err_timeout, "接受rtp/rtcp/datachannel超时"));
}
return true;
},
@@ -386,6 +386,15 @@ void WebRtcTransportImp::onCreate() {
_twcc_ctx.setOnSendTwccCB([this](uint32_t ssrc, string fci) { onSendTwcc(ssrc, fci); });
}
void WebRtcTransportImp::OnDtlsTransportApplicationDataReceived(const RTC::DtlsTransport *dtlsTransport, const uint8_t *data, size_t len) {
WebRtcTransport::OnDtlsTransportApplicationDataReceived(dtlsTransport, data, len);
#ifdef ENABLE_SCTP
if (_answer_sdp->isOnlyDatachannel()) {
_alive_ticker.resetTime();
}
#endif
}
WebRtcTransportImp::WebRtcTransportImp(const EventPoller::Ptr &poller)
: WebRtcTransport(poller) {
InfoL << getIdentifier();