Showing the changes to interface/src/VoxelSystem.cpp (1 of 4 files). Show all
Unified · Split
| @@ -610,25 +610,32 @@ int VoxelSystem::parseData(unsigned char* sourceBuffer, int numBytes) { · 609 unmodified lines | ||
| 610 | 610 | VOXEL_PACKET_SENT_TIME sentAt = (*(VOXEL_PACKET_SENT_TIME*)dataAt); |
| 611 | 611 | dataAt += sizeof(VOXEL_PACKET_SENT_TIME); |
| 612 | 612 | |
| 613 | − unsigned char* voxelData = dataAt; | |
| 614 | − | |
| 615 | 613 | bool packetIsColored = oneAtBit(flags, PACKET_IS_COLOR_BIT); |
| 616 | 614 | bool packetIsCompressed = oneAtBit(flags, PACKET_IS_COMPRESSED_BIT); |
| 617 | 615 | |
| 618 | 616 | VOXEL_PACKET_SENT_TIME arrivedAt = usecTimestampNow(); |
| 619 | 617 | int flightTime = arrivedAt - sentAt; |
| 620 | 618 | |
| 619 | + VOXEL_PACKET_INTERNAL_SECTION_SIZE sectionLength = 0; | |
| 621 | 620 | int dataBytes = numBytes - VOXEL_PACKET_HEADER_SIZE; |
| 621 | + | |
| 622 | + if (packetIsCompressed && dataBytes > sizeof(VOXEL_PACKET_INTERNAL_SECTION_SIZE)) { | |
| 623 | + sectionLength = (*(VOXEL_PACKET_INTERNAL_SECTION_SIZE*)dataAt); | |
| 624 | + dataAt += sizeof(VOXEL_PACKET_INTERNAL_SECTION_SIZE); | |
| 625 | + } else { | |
| 626 | + sectionLength = dataBytes; | |
| 627 | + } | |
| 628 | + unsigned char* voxelData = dataAt; | |
| 622 | 629 | |
| 623 | 630 | // ask the VoxelTree to read the bitstream into the tree |
| 624 | 631 | ReadBitstreamToTreeParams args(packetIsColored ? WANT_COLOR : NO_COLOR, WANT_EXISTS_BITS, NULL, getDataSourceUUID()); |
| 625 | 632 | lockTree(); |
| 626 | 633 | VoxelPacketData packetData(packetIsCompressed); |
| 627 | − packetData.loadFinalizedContent(voxelData, dataBytes); | |
| 628 | − if (Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging)) { | |
| 629 | − qDebug("Got Packet color:%s compressed:%s sequence: %u flight:%d usec size:%d data:%d uncompressed:%d\n", | |
| 634 | + packetData.loadFinalizedContent(voxelData, sectionLength); | |
| 635 | + if (true || Menu::getInstance()->isOptionChecked(MenuOption::ExtraDebugging)) { | |
| 636 | + qDebug("Got Packet color:%s compressed:%s sequence: %u flight:%d usec size:%d data:%d sectionLength:%d uncompressed:%d\n", | |
| 630 | 637 | debug::valueOf(packetIsColored), debug::valueOf(packetIsCompressed), |
| 631 | − sequence, flightTime, numBytes, dataBytes, packetData.getUncompressedSize()); | |
| 638 | + sequence, flightTime, numBytes, dataBytes, sectionLength, packetData.getUncompressedSize()); | |
| 632 | 639 | } |
| 633 | 640 | _tree->readBitstreamToTree(packetData.getUncompressedData(), packetData.getUncompressedSize(), args); |
| 634 | 641 | unlockTree(); |