mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 03:24:00 +02:00
add segment calls to PacketList
This commit is contained in:
parent
2ab2888260
commit
3ae8ba2922
2 changed files with 5 additions and 1 deletions
|
@ -77,6 +77,8 @@ qint64 writeData(const char* data, qint64 maxSize) {
|
|||
// set our current packet to the new packet
|
||||
_currentPacket = newPacket;
|
||||
|
||||
// return the number of bytes written to the new packet
|
||||
return maxSize;
|
||||
} else {
|
||||
// we're an ordered PacketList - let's fit what we can into the current packet and then put the leftover
|
||||
// into a new packet
|
||||
|
@ -89,7 +91,7 @@ qint64 writeData(const char* data, qint64 maxSize) {
|
|||
_packets.insert(std::move(_currentPacket));
|
||||
|
||||
// recursively call our writeData method for the remaining data to write to a new packet
|
||||
writeData(data + numBytesToEnd, maxSize - numBytesToEnd);
|
||||
return numBytesToEnd + writeData(data + numBytesToEnd, maxSize - numBytesToEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,8 @@ public:
|
|||
|
||||
virtual bool isSequential() const { return true; }
|
||||
|
||||
void startSegment() { _segmentStartIndex = currentPacket->payload().pos(); }
|
||||
void endSegment() { _segmentStartIndex = -1; }
|
||||
protected:
|
||||
qint64 writeData(const char* data, qint64 maxSize);
|
||||
qint64 readData(const char* data, qint64 maxSize) { return 0 };
|
||||
|
|
Loading…
Reference in a new issue