Skip to content

Commit 54acc85

Browse files
author
Matevz Morato
committed
Don't serialize assets in remote connection
1 parent 6f55df1 commit 54acc85

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

include/depthai/pipeline/Pipeline.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class PipelineImpl : public std::enable_shared_from_this<PipelineImpl> {
7171
std::vector<std::shared_ptr<Node>> getSourceNodes();
7272

7373
void serialize(PipelineSchema& schema, Assets& assets, std::vector<std::uint8_t>& assetStorage, SerializationType type = DEFAULT_SERIALIZATION_TYPE) const;
74-
nlohmann::json serializeToJson() const;
74+
nlohmann::json serializeToJson(bool includeAssets) const;
7575
void remove(std::shared_ptr<Node> node);
7676

7777
std::vector<Node::Connection> getConnections() const;
@@ -294,8 +294,8 @@ class Pipeline {
294294
}
295295

296296
/// Returns whole pipeline represented as JSON
297-
nlohmann::json serializeToJson() const {
298-
return impl()->serializeToJson();
297+
nlohmann::json serializeToJson(bool includeAssests=true) const {
298+
return impl()->serializeToJson(includeAssests);
299299
}
300300

301301
/**

src/pipeline/Pipeline.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ void PipelineImpl::serialize(PipelineSchema& schema, Assets& assets, std::vector
128128
assets = mutableAssets;
129129
}
130130

131-
nlohmann::json PipelineImpl::serializeToJson() const {
131+
nlohmann::json PipelineImpl::serializeToJson(bool includeAssets) const {
132132
PipelineSchema schema;
133133
Assets assets;
134134
std::vector<uint8_t> assetStorage;
@@ -139,9 +139,10 @@ nlohmann::json PipelineImpl::serializeToJson() const {
139139
for(auto& node : j["pipeline"]["nodes"]) {
140140
node[1]["properties"] = nlohmann::json::parse(node[1]["properties"].get<std::vector<uint8_t>>());
141141
}
142-
143-
j["assets"] = assets;
144-
j["assetStorage"] = assetStorage;
142+
if(includeAssets) {
143+
j["assets"] = assets;
144+
j["assetStorage"] = assetStorage;
145+
}
145146
return j;
146147
}
147148

src/remote_connection/RemoteConnectionImpl.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ void RemoteConnectionImpl::exposePipelineService(const Pipeline& pipeline) {
411411
assert(ids.size() == 1);
412412
auto id = ids[0];
413413

414-
auto serializedPipeline = pipeline.serializeToJson();
414+
auto serializedPipeline = pipeline.serializeToJson(false);
415415
auto serializedPipelineStr = serializedPipeline.dump();
416416
serviceMap[id] = [serializedPipelineStr](foxglove::ServiceResponse request) {
417417
(void)request;

0 commit comments

Comments
 (0)