From 0cd269632e3bd9ea5e4bc4bd8bbd31d307fd5a45 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Sun, 24 Nov 2013 17:49:10 -0800 Subject: [PATCH] fix bug where some parts of scene weren't sent, turned out it was in the octal code not fitting voxels getting ignored --- libraries/voxel-server-library/src/VoxelSendThread.cpp | 7 +++++++ libraries/voxels/src/VoxelPacket.h | 8 ++++++-- libraries/voxels/src/VoxelTree.cpp | 1 + 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/libraries/voxel-server-library/src/VoxelSendThread.cpp b/libraries/voxel-server-library/src/VoxelSendThread.cpp index 82fc8a8d05..980108eddb 100644 --- a/libraries/voxel-server-library/src/VoxelSendThread.cpp +++ b/libraries/voxel-server-library/src/VoxelSendThread.cpp @@ -375,6 +375,13 @@ int VoxelSendThread::deepestLevelVoxelDistributor(Node* node, VoxelNodeData* nod _myServer->getServerTree().lockForRead(); nodeData->stats.encodeStarted(); bytesWritten = _myServer->getServerTree().encodeTreeBitstream(subTree, &_tempPacket, nodeData->nodeBag, params); + + if (_tempPacket.hasContent() && bytesWritten == 0 && _tempPacket.getFinalizedSize() < 1450) { + printf(">>>>>>>>>>>>>>> got bytesWritten==0 _tempPacket.getFinalizedSize()=%d <<<<<<<<<<<<<<<\n", + _tempPacket.getFinalizedSize()); + + } + if (bytesWritten > 0) { _encodedSomething = true; } diff --git a/libraries/voxels/src/VoxelPacket.h b/libraries/voxels/src/VoxelPacket.h index f083a0f657..a636e8aae3 100644 --- a/libraries/voxels/src/VoxelPacket.h +++ b/libraries/voxels/src/VoxelPacket.h @@ -6,10 +6,14 @@ // // TO DO: // -// * further testing of compression to determine optimal configuration for performance and compression -// // * add stats tracking for number of bytes of octal code, bitmasks, and colors in a packet. // +// * determine why we sometimes don't fill packets very well (rarely) mid-scene... sometimes it appears as if +// the "next node" would encode with more bytes than can fit in the remainder of the packet. this might be +// several tens or hundreds of bytes, but theoretically other voxels would have fit. This happens in the 0100 +// scene a couple times. +// +// * further testing of compression to determine optimal configuration for performance and compression // * improve semantics for "reshuffle" - current approach will work for now and with compression // but wouldn't work with RLE because the colors in the levels would get reordered and RLE would need // to be recalculated diff --git a/libraries/voxels/src/VoxelTree.cpp b/libraries/voxels/src/VoxelTree.cpp index 8ef2cd7d66..6cbc25880b 100644 --- a/libraries/voxels/src/VoxelTree.cpp +++ b/libraries/voxels/src/VoxelTree.cpp @@ -1062,6 +1062,7 @@ int VoxelTree::encodeTreeBitstream(VoxelNode* node, // If the octalcode couldn't fit, then we can return, because no nodes below us will fit... if (!roomForOctalCode) { doneEncoding(node); + bag.insert(node); // add the node back to the bag so it will eventually get included return bytesWritten; }