Skip to content

Commit

Permalink
Refactored asset sending RPC
Browse files Browse the repository at this point in the history
  • Loading branch information
themarpe committed Aug 23, 2022
1 parent f19964a commit 65a86fd
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmake/Depthai/DepthaiDeviceSideConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set(DEPTHAI_DEVICE_SIDE_MATURITY "snapshot")

# "full commit hash of device side binary"
set(DEPTHAI_DEVICE_SIDE_COMMIT "602822fe9eaca68a72c666497dc4979b29291b3e")
set(DEPTHAI_DEVICE_SIDE_COMMIT "0f02e98b07c988a0bcf95da20046b87f3fa8df7a")

# "version if applicable"
set(DEPTHAI_DEVICE_SIDE_VERSION "")
9 changes: 1 addition & 8 deletions src/device/DeviceBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1095,9 +1095,6 @@ bool DeviceBase::startPipelineImpl(const Pipeline& pipeline) {
if(!assetStorage.empty()) {
pimpl->rpcClient->call("setAssets", assets);

// allocate, returns a pointer to memory on device side
auto memHandle = pimpl->rpcClient->call("memAlloc", static_cast<std::uint32_t>(assetStorage.size())).as<uint32_t>();

// Transfer the whole assetStorage in a separate thread
const std::string streamAssetStorage = "__stream_asset_storage";
std::thread t1([this, &streamAssetStorage, &assetStorage]() {
Expand All @@ -1110,12 +1107,8 @@ bool DeviceBase::startPipelineImpl(const Pipeline& pipeline) {
} while(offset < static_cast<int64_t>(assetStorage.size()));
});

// Open a channel to transfer AssetStorage
pimpl->rpcClient->call("readFromXLink", streamAssetStorage, memHandle, assetStorage.size());
pimpl->rpcClient->call("readAssetStorageFromXLink", streamAssetStorage, assetStorage.size());
t1.join();

// After asset storage is transfers, set the asset storage
pimpl->rpcClient->call("setAssetStorage", memHandle, assetStorage.size());
}

// print assets on device side for test
Expand Down

0 comments on commit 65a86fd

Please sign in to comment.