1
0
mirror of https://github.com/danog/libtgvoip.git synced 2025-01-22 13:01:21 +01:00
libtgvoip/PacketReassembler.h

32 lines
688 B
C
Raw Normal View History

2018-06-04 22:37:43 +03:00
//
// Created by Grishka on 19.03.2018.
//
#ifndef TGVOIP_PACKETREASSEMBLER_H
#define TGVOIP_PACKETREASSEMBLER_H
#include <vector>
#include <functional>
#include "Buffers.h"
2018-06-04 22:37:43 +03:00
namespace tgvoip {
class PacketReassembler{
2018-06-04 22:37:43 +03:00
public:
PacketReassembler();
virtual ~PacketReassembler();
void Reset();
void AddFragment(Buffer pkt, unsigned int fragmentIndex, unsigned int fragmentCount, uint32_t pts);
void SetCallback(std::function<void(Buffer packet, uint32_t pts)> callback);
2018-06-04 22:37:43 +03:00
private:
uint32_t currentTimestamp;
unsigned int currentPacketPartCount=0;
std::vector<Buffer> parts;
std::function<void(Buffer, uint32_t)> callback;
2018-06-04 22:37:43 +03:00
};
}
#endif //TGVOIP_PACKETREASSEMBLER_H