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,19 +91,19 @@ void JitterBuffer::PutInternal(jitter_packet_t &pkt, bool overwriteExisting)
return; return;
} }
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())
{
if (overwriteExisting) if (overwriteExisting)
{ {
for (auto &slot : slots) existing->buffer.CopyFromOtherBuffer(pkt.buffer, pkt.size);
{ existing->size = pkt.size;
if (slot.timestamp == pkt.timestamp && !slot.buffer.IsEmpty()) existing->isEC = pkt.isEC;
{ }
slot.buffer.CopyFromOtherBuffer(pkt.buffer, pkt.size);
slot.size = pkt.size;
slot.isEC = pkt.isEC;
return; return;
} }
}
}
gotSinceReset++; gotSinceReset++;
if (wasReset) if (wasReset)