mirror of
https://github.com/kunkundi/crossdesk.git
synced 2025-10-26 20:25:34 +08:00
1.Fix rtp packet memory leakage; 2.Retry candidates gathering when failed
This commit is contained in:
@@ -62,7 +62,7 @@ RtpPacket::RtpPacket(RtpPacket &&rtp_packet)
|
|||||||
RtpPacket &RtpPacket::operator=(const RtpPacket &rtp_packet) {
|
RtpPacket &RtpPacket::operator=(const RtpPacket &rtp_packet) {
|
||||||
if (&rtp_packet != this) {
|
if (&rtp_packet != this) {
|
||||||
if (buffer_) {
|
if (buffer_) {
|
||||||
delete buffer_;
|
delete[] buffer_;
|
||||||
buffer_ = nullptr;
|
buffer_ = nullptr;
|
||||||
}
|
}
|
||||||
buffer_ = new uint8_t[rtp_packet.size_];
|
buffer_ = new uint8_t[rtp_packet.size_];
|
||||||
@@ -88,13 +88,13 @@ RtpPacket &RtpPacket::operator=(RtpPacket &&rtp_packet) {
|
|||||||
|
|
||||||
RtpPacket::~RtpPacket() {
|
RtpPacket::~RtpPacket() {
|
||||||
if (buffer_) {
|
if (buffer_) {
|
||||||
delete buffer_;
|
delete[] buffer_;
|
||||||
buffer_ = nullptr;
|
buffer_ = nullptr;
|
||||||
}
|
}
|
||||||
size_ = 0;
|
size_ = 0;
|
||||||
|
|
||||||
if (extension_data_) {
|
if (extension_data_) {
|
||||||
delete extension_data_;
|
delete[] extension_data_;
|
||||||
extension_data_ = nullptr;
|
extension_data_ = nullptr;
|
||||||
}
|
}
|
||||||
extension_len_ = 0;
|
extension_len_ = 0;
|
||||||
|
|||||||
@@ -197,7 +197,11 @@ int IceTransmission::JoinTransmission() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int IceTransmission::GatherCandidates() {
|
int IceTransmission::GatherCandidates() {
|
||||||
ice_agent_->GatherCandidates();
|
int ret = ice_agent_->GatherCandidates();
|
||||||
|
while (ret) {
|
||||||
|
LOG_ERROR("Gather candidates failed, retry");
|
||||||
|
ret = ice_agent_->GatherCandidates();
|
||||||
|
}
|
||||||
LOG_INFO("[{}] Gather candidates", user_id_);
|
LOG_INFO("[{}] Gather candidates", user_id_);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user