修复webrtc多候选地址无法来回切换的bug (#2266)

最后一个连通的候选地址会被赋值并锁定为_selected_session,如果之前的候选地址再发送数据,将通过_selected_session回复,导致无法切换为旧的候选地址。
This commit is contained in:
mtdxc
2023-03-03 11:18:21 +08:00
committed by GitHub
parent 91efab281e
commit 4783ac0808
8 changed files with 84 additions and 91 deletions

View File

@@ -118,20 +118,15 @@ void WebRtcPusher::onStartWebRTC() {
}
void WebRtcPusher::onDestory() {
WebRtcTransportImp::onDestory();
auto duration = getDuration();
auto bytes_usage = getBytesUsage();
//流量统计事件广播
GET_CONFIG(uint32_t, iFlowThreshold, General::kFlowThreshold);
if (getSession()) {
WarnL << "RTC推流器("
<< _media_info.shortUrl()
<< ")结束推流,耗时(s):" << duration;
WarnL << "RTC推流器(" << _media_info.shortUrl() << ")结束推流,耗时(s):" << duration;
if (bytes_usage >= iFlowThreshold * 1024) {
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastFlowReport, _media_info, bytes_usage, duration,
false, static_cast<SockInfo &>(*getSession()));
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastFlowReport, _media_info, bytes_usage, duration, false, static_cast<SockInfo &>(*getSession()));
}
}
@@ -142,6 +137,7 @@ void WebRtcPusher::onDestory() {
auto push_src = std::move(_push_src);
getPoller()->doDelayTask(_continue_push_ms, [push_src]() { return 0; });
}
WebRtcTransportImp::onDestory();
}
void WebRtcPusher::onRtcConfigure(RtcConfigure &configure) const {