- if (Config::instance()->enable_gpu ()) {
- boost::filesystem::path folder(_dcpomatic_context->_location);
- boost::filesystem::path binaryPath = folder / "grk_compress";
- if (!boost::filesystem::exists(binaryPath)) {
- getMessengerLogger()->error(
- "Invalid binary location %s", _dcpomatic_context->_location.c_str()
- );
- return;
- }
- auto proc = [this](const std::string& str) {
- try {
- Msg msg(str);
- auto tag = msg.next();
- if(tag == GRK_MSGR_BATCH_SUBMIT_COMPRESSED)
- {
- auto clientFrameId = msg.nextUint();
- auto compressedFrameId = msg.nextUint();
- (void)compressedFrameId;
- auto compressedFrameLength = msg.nextUint();
- auto processor =
- [this](FrameProxy srcFrame, uint8_t* compressed, uint32_t compressedFrameLength)
- {
- auto compressed_data = std::make_shared<dcp::ArrayData>(compressed, compressedFrameLength);
- _dcpomatic_context->writer_.write(compressed_data, srcFrame.index(), srcFrame.eyes());
- frame_done ();
- };
- int const minimum_size = 16384;
- bool needsRecompression = compressedFrameLength < minimum_size;
- messenger_->processCompressed(str, processor, needsRecompression);
- if (needsRecompression) {
- auto fp = messenger_->retrieve(clientFrameId);
- if (!fp) {
- return;
- }
-
- auto encoded = std::make_shared<dcp::ArrayData>(fp->vf.encode_locally());
- _dcpomatic_context->writer_.write(encoded, fp->vf.index(), fp->vf.eyes());
- frame_done ();
+ if (!Config::instance()->enable_gpu()) {
+ return;
+ }
+
+ boost::filesystem::path folder(_dcpomatic_context->location);
+ boost::filesystem::path binary_path = folder / "grk_compress";
+ if (!boost::filesystem::exists(binary_path)) {
+ getMessengerLogger()->error(
+ "Invalid binary location %s", _dcpomatic_context->location.c_str()
+ );
+ return;
+ }
+
+ auto proc = [this](const std::string& str) {
+ try {
+ Msg msg(str);
+ auto tag = msg.next();
+ if (tag == GRK_MSGR_BATCH_SUBMIT_COMPRESSED) {
+ auto clientFrameId = msg.nextUint();
+ msg.nextUint(); // compressed frame ID
+ auto compressedFrameLength = msg.nextUint();
+ auto processor = [this](FrameProxy srcFrame, uint8_t* compressed, uint32_t compressedFrameLength) {
+ auto compressed_data = std::make_shared<dcp::ArrayData>(compressed, compressedFrameLength);
+ _dcpomatic_context->writer.write(compressed_data, srcFrame.index(), srcFrame.eyes());
+ frame_done ();
+ };
+
+ int const minimum_size = 16384;
+
+ bool needsRecompression = compressedFrameLength < minimum_size;
+ _messenger->processCompressed(str, processor, needsRecompression);
+
+ if (needsRecompression) {
+ auto fp = _messenger->retrieve(clientFrameId);
+ if (!fp) {
+ return;