Skip to content
Snippets Groups Projects
Commit 3dd88305 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fix for duplicate stream pointers

parent 4329a615
Branches
No related tags found
1 merge request!316Resolves #343 GUI and Frame Refactor
Pipeline #28273 failed
...@@ -96,7 +96,7 @@ private: ...@@ -96,7 +96,7 @@ private:
std::map<uint32_t, ftl::data::FrameSetPtr> latest_; std::map<uint32_t, ftl::data::FrameSetPtr> latest_;
std::unordered_map<std::string, uint32_t> groups_; std::unordered_map<std::string, uint32_t> groups_;
std::unordered_map<uint32_t, ftl::stream::Stream*> streams_; std::unordered_map<uint32_t, std::list<ftl::stream::Stream*>> streams_;
std::unordered_map<uint32_t, ftl::rgbd::Source*> devices_; std::unordered_map<uint32_t, ftl::rgbd::Source*> devices_;
std::unordered_map<uint32_t, ftl::render::Source*> renderers_; std::unordered_map<uint32_t, ftl::render::Source*> renderers_;
std::unordered_map<uint32_t, ftl::operators::Graph*> pre_pipelines_; std::unordered_map<uint32_t, ftl::operators::Graph*> pre_pipelines_;
...@@ -109,6 +109,7 @@ private: ...@@ -109,6 +109,7 @@ private:
std::vector<Filter*> filters_; std::vector<Filter*> filters_;
uint32_t fs_counter_ = 0; uint32_t fs_counter_ = 0;
uint32_t file_counter_ = 0;
uint32_t allocateFrameSetId(const std::string &group); uint32_t allocateFrameSetId(const std::string &group);
......
...@@ -233,8 +233,10 @@ Feed::~Feed() { ...@@ -233,8 +233,10 @@ Feed::~Feed() {
interceptor_.reset(); interceptor_.reset();
stream_.reset(); stream_.reset();
for (auto &s : streams_) { for (auto &ls : streams_) {
delete s.second; for (auto *s : ls.second) {
delete s;
}
} }
} }
...@@ -375,7 +377,7 @@ ftl::operators::Graph* Feed::_addPipeline(uint32_t fsid) { ...@@ -375,7 +377,7 @@ ftl::operators::Graph* Feed::_addPipeline(uint32_t fsid) {
(renderers_[fsid], std::string("pipeline")); (renderers_[fsid], std::string("pipeline"));
} else if (streams_.count(fsid)) { } else if (streams_.count(fsid)) {
pre_pipelines_[fsid] = ftl::config::create<ftl::operators::Graph> pre_pipelines_[fsid] = ftl::config::create<ftl::operators::Graph>
(streams_[fsid], std::string("pipeline")); (streams_[fsid].front(), std::string("pipeline"));
} }
//pre_pipelines_[fsid] = ftl::config::create<ftl::operators::Graph> //pre_pipelines_[fsid] = ftl::config::create<ftl::operators::Graph>
...@@ -543,7 +545,7 @@ std::string Feed::getName(const std::string &puri) { ...@@ -543,7 +545,7 @@ std::string Feed::getName(const std::string &puri) {
void Feed::add(uint32_t fsid, const std::string &uri, ftl::stream::Stream* stream) { void Feed::add(uint32_t fsid, const std::string &uri, ftl::stream::Stream* stream) {
fsid_lookup_[uri] = fsid; fsid_lookup_[uri] = fsid;
streams_[fsid] = stream; streams_[fsid].push_back(stream);
_createPipeline(fsid); _createPipeline(fsid);
...@@ -574,7 +576,7 @@ uint32_t Feed::add(const std::string &path) { ...@@ -574,7 +576,7 @@ uint32_t Feed::add(const std::string &path) {
const int fsid = allocateFrameSetId(group); const int fsid = allocateFrameSetId(group);
auto* fstream = ftl::create<ftl::stream::File> auto* fstream = ftl::create<ftl::stream::File>
(this, std::string("ftlfile-") + std::to_string(fsid)); (this, std::string("ftlfile-") + std::to_string(file_counter_++));
if (scheme == ftl::URI::SCHEME_OTHER) { if (scheme == ftl::URI::SCHEME_OTHER) {
fstream->set("filename", path); fstream->set("filename", path);
...@@ -604,7 +606,7 @@ uint32_t Feed::add(const std::string &path) { ...@@ -604,7 +606,7 @@ uint32_t Feed::add(const std::string &path) {
return fsid; return fsid;
} }
else if (scheme == ftl::URI::SCHEME_DEVICE) { else if (scheme == ftl::URI::SCHEME_DEVICE) {
int fsid = allocateFrameSetId(group); int fsid = allocateFrameSetId(""); // TODO: Support groups with devices?
fsid_lookup_[uri.getBaseURI()] = fsid; // Manually add mapping fsid_lookup_[uri.getBaseURI()] = fsid; // Manually add mapping
std::string srcname = std::string("source") + std::to_string(fsid); std::string srcname = std::string("source") + std::to_string(fsid);
...@@ -728,7 +730,7 @@ std::string Feed::getURI(uint32_t fsid) { ...@@ -728,7 +730,7 @@ std::string Feed::getURI(uint32_t fsid) {
} }
std::string Feed::getSourceURI(ftl::data::FrameID id) { std::string Feed::getSourceURI(ftl::data::FrameID id) {
if (streams_.count(id.frameset())) { /*if (streams_.count(id.frameset())) {
auto i = streams_.find(id.frameset()); auto i = streams_.find(id.frameset());
return i->second->getID(); return i->second->getID();
} else if (devices_.count(id.frameset())) { } else if (devices_.count(id.frameset())) {
...@@ -737,7 +739,7 @@ std::string Feed::getSourceURI(ftl::data::FrameID id) { ...@@ -737,7 +739,7 @@ std::string Feed::getSourceURI(ftl::data::FrameID id) {
} else if (renderers_.count(id.frameset())) { } else if (renderers_.count(id.frameset())) {
auto i = renderers_.find(id.frameset()); auto i = renderers_.find(id.frameset());
return i->second->getID(); return i->second->getID();
} }*/
return ""; return "";
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment