修复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

@@ -70,21 +70,17 @@ void WebRtcPlayer::onStartWebRTC() {
}
}
void WebRtcPlayer::onDestory() {
WebRtcTransportImp::onDestory();
auto duration = getDuration();
auto bytes_usage = getBytesUsage();
//流量统计事件广播
GET_CONFIG(uint32_t, iFlowThreshold, General::kFlowThreshold);
if (_reader && 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,
true, static_cast<SockInfo &>(*getSession()));
NoticeCenter::Instance().emitEvent(Broadcast::kBroadcastFlowReport, _media_info, bytes_usage, duration, true, static_cast<SockInfo &>(*getSession()));
}
}
WebRtcTransportImp::onDestory();
}
void WebRtcPlayer::onRtcConfigure(RtcConfigure &configure) const {