1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-11-30 04:39:03 +01:00
This commit is contained in:
Daniil Gentili 2020-03-12 20:43:27 +01:00
parent 442326e814
commit 5367ab3e68
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -91,18 +91,18 @@ void JitterBuffer::PutInternal(jitter_packet_t &pkt, bool overwriteExisting)
return; return;
} }
if (overwriteExisting) auto existing = std::find_if(slots.begin(), slots.end(), [timestamp = pkt.timestamp](const jitter_packet_t &slot) -> bool {
return slot.timestamp == timestamp && !slot.buffer.IsEmpty();
});
if (existing != slots.end())
{ {
for (auto &slot : slots) if (overwriteExisting)
{ {
if (slot.timestamp == pkt.timestamp && !slot.buffer.IsEmpty()) existing->buffer.CopyFromOtherBuffer(pkt.buffer, pkt.size);
{ existing->size = pkt.size;
slot.buffer.CopyFromOtherBuffer(pkt.buffer, pkt.size); existing->isEC = pkt.isEC;
slot.size = pkt.size;
slot.isEC = pkt.isEC;
return;
}
} }
return;
} }
gotSinceReset++; gotSinceReset++;