[feat] clean rtp packet buffer queue when ice destroyed

This commit is contained in:
dijunkun
2025-03-05 17:48:33 +08:00
parent 0dbc0236bf
commit 02f00642e9
11 changed files with 82 additions and 82 deletions

View File

@@ -23,25 +23,23 @@ void VideoChannelReceive::Initialize(rtp::PAYLOAD_TYPE payload_type) {
on_receive_complete_frame_(video_frame);
});
rtp_video_receiver_->SetSendDataFunc(
[this](const char *data, size_t size) -> int {
if (!ice_agent_) {
LOG_ERROR("ice_agent_ is nullptr");
return -1;
}
rtp_video_receiver_->SetSendDataFunc([this](const char *data,
size_t size) -> int {
if (!ice_agent_) {
LOG_ERROR("ice_agent_ is nullptr");
return -1;
}
auto ice_state = ice_agent_->GetIceState();
auto ice_state = ice_agent_->GetIceState();
if (ice_state != NICE_COMPONENT_STATE_CONNECTED &&
ice_state != NICE_COMPONENT_STATE_READY) {
LOG_ERROR("Ice is not connected, state = [{}]",
nice_component_state_to_string(ice_state));
return -2;
}
if (ICE_STATE_NULLPTR == ice_state || ICE_STATE_DESTROYED == ice_state) {
LOG_ERROR("Ice is not connected, state = [{}]", (int)ice_state);
return -2;
}
ice_io_statistics_->UpdateVideoOutboundBytes((uint32_t)size);
return ice_agent_->Send(data, size);
});
ice_io_statistics_->UpdateVideoOutboundBytes((uint32_t)size);
return ice_agent_->Send(data, size);
});
rtp_video_receiver_->Start();
}