Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions deflect/server/ServerWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ void ServerWorker::_handlePixelStreamMessage(const QByteArray& message)

const auto data = message.data();
const auto params = reinterpret_cast<const SegmentParameters*>(data);
tile.format = params->format;
tile.x = params->x;
tile.y = params->y;
tile.width = params->width;
Expand Down
2 changes: 2 additions & 0 deletions doc/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Changelog {#Changelog}
## Deflect 1.0

### 1.0.1 (master)
* [199](https://github.com/BlueBrain/Deflect/pull/199):
Fix receiving of uncompressed tiles
* [198](https://github.com/BlueBrain/Deflect/pull/198):
Fix unreliable server-side stream close.

Expand Down
37 changes: 37 additions & 0 deletions tests/cpp/ServerTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -408,4 +408,41 @@ BOOST_AUTO_TEST_CASE(compressionErrorForBigNullImage)
SAFE_BOOST_CHECK_THROW(stream.send(bigImage).get(), std::invalid_argument);
}

BOOST_AUTO_TEST_CASE(uncompressedImages)
{
const unsigned int width = 4;
const unsigned int height = 4;
const unsigned int byte = width * height * 4;
std::unique_ptr<uint8_t[]> pixels(new uint8_t[byte]);
::memset(pixels.get(), 0, byte);
deflect::ImageWrapper image(pixels.get(), width, height, deflect::RGBA);
image.compressionPolicy = deflect::COMPRESSION_OFF;

const size_t expectedFrames = 5;

setFrameReceivedCallback([&](deflect::server::FramePtr frame) {
SAFE_BOOST_REQUIRE_EQUAL(frame->tiles.size(), 1);
SAFE_BOOST_CHECK(frame->tiles[0].format == deflect::Format::rgba);
const auto dim = frame->computeDimensions();
SAFE_BOOST_CHECK_EQUAL(dim.width(), width);
SAFE_BOOST_CHECK_EQUAL(dim.height(), height);
});

deflect::Stream stream(testStreamId.toStdString(), "localhost",
serverPort());
BOOST_REQUIRE(stream.isConnected());

for (size_t i = 0; i < expectedFrames; ++i)
{
stream.sendAndFinish(image).wait();
requestFrame(testStreamId);

waitForMessage();

BOOST_CHECK_EQUAL(getReceivedFrames(), i + 1);
}

BOOST_CHECK_EQUAL(getReceivedFrames(), expectedFrames);
}

BOOST_AUTO_TEST_SUITE_END()