[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

@@ -45,9 +45,10 @@ int RtpAudioSender::SendRtpPacket(std::shared_ptr<RtpPacket> rtp_packet) {
return -1;
}
if (0 != data_send_func_((const char*)rtp_packet->Buffer().data(),
rtp_packet->Size())) {
LOG_ERROR("Send rtp packet failed");
int ret = data_send_func_((const char*)rtp_packet->Buffer().data(),
rtp_packet->Size());
if (-2 == ret) {
rtp_packet_queue_.clear();
return -1;
}

View File

@@ -45,9 +45,10 @@ int RtpDataSender::SendRtpPacket(std::shared_ptr<RtpPacket> rtp_packet) {
return -1;
}
if (0 != data_send_func_((const char*)rtp_packet->Buffer().data(),
rtp_packet->Size())) {
LOG_ERROR("Send rtp packet failed");
int ret = data_send_func_((const char*)rtp_packet->Buffer().data(),
rtp_packet->Size());
if (-2 == ret) {
rtp_packet_queue_.clear();
return -1;
}

View File

@@ -85,9 +85,11 @@ int RtpVideoSender::SendRtpPacket(
}
last_rtp_timestamp_ = rtp_packet_to_send->capture_time().ms();
if (0 != data_send_func_((const char*)rtp_packet_to_send->Buffer().data(),
rtp_packet_to_send->Size())) {
// LOG_ERROR("Send rtp packet failed");
int ret = data_send_func_((const char*)rtp_packet_to_send->Buffer().data(),
rtp_packet_to_send->Size());
if (-2 == ret) {
rtp_packet_queue_.clear();
return -1;
}
@@ -131,8 +133,9 @@ int RtpVideoSender::SendRtcpSR(SenderReport& rtcp_sr) {
return -1;
}
if (data_send_func_((const char*)rtcp_sr.Buffer(), rtcp_sr.Size())) {
LOG_ERROR("Send SR failed");
int ret = data_send_func_((const char*)rtcp_sr.Buffer(), rtcp_sr.Size());
if (ret != 0) {
LOG_ERROR("Send rtcp sr failed");
return -1;
}