Showing the changes to assignment-client/src/entities/EntityTreeSendThread.cpp (1 of 1 file). Show all
Unified · Split
| @@ -362,9 +362,11 @@ bool EntityTreeSendThread::traverseTreeAndBuildNextPacketPayload(EncodeBitstream · 361 unmodified lines | ||
| 362 | 362 | nodeData->stats.encodeStarted(); |
| 363 | 363 | auto entityNode = _node.toStrongRef(); |
| 364 | 364 | auto entityNodeData = static_cast<EntityNodeData*>(entityNode->getLinkedData()); |
| 365 | + EntityItemPointer lastEntity; | |
| 365 | 366 | while(!_sendQueue.empty()) { |
| 366 | 367 | PrioritizedEntity queuedItem = _sendQueue.top(); |
| 367 | 368 | EntityItemPointer entity = queuedItem.getEntity(); |
| 369 | + lastEntity = entity; | |
| 368 | 370 | if (entity) { |
| 369 | 371 | const QUuid& entityID = entity->getID(); |
| 370 | 372 | // Only send entities that match the jsonFilters, but keep track of everything we've tried to send so we don't try to send it again; |
| @@ -407,6 +409,16 @@ bool EntityTreeSendThread::traverseTreeAndBuildNextPacketPayload(EncodeBitstream · 36 unmodified lines | ||
| 407 | 409 | _extraEncodeData->entities.clear(); |
| 408 | 410 | } |
| 409 | 411 | |
| 412 | + // This is a workaround for case where entity property is too big to be transmitted at all. | |
| 413 | + // The issue only happens when maximum packet size is lowered after the server was already created, since normally | |
| 414 | + // such properties will not be possible to be created in the first place. | |
| 415 | + // TODO: This can be safely removed once multi-packet entity properties get implemented. | |
| 416 | + if (_numEntities == 0 && params.stopReason == EncodeBitstreamParams::DIDNT_FIT) { | |
| 417 | + qDebug() << "EntityTreeSendThread::traverseTreeAndBuildNextPacketPayload: One of the entities has a property " | |
| 418 | + " that is too large to be transmitted. Entity UUID: " | |
| 419 | + << lastEntity->getID() << " type: " << lastEntity->getType() << " name: " << lastEntity->getName(); | |
| 420 | + params.stopReason = EncodeBitstreamParams::FINISHED; | |
| 421 | + } | |
| 410 | 422 | if (_numEntities == 0) { |
| 411 | 423 | _packetData.discardLevel(entitiesLevel); |
| 412 | 424 | OctreeServer::trackEncodeTime((float)(usecTimestampNow() - encodeStart)); |