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

Fix timestamp to grab frame

parent f4dabfb1
No related branches found
No related tags found
No related merge requests found
Pipeline #12290 passed
...@@ -118,7 +118,7 @@ class Source : public ftl::Configurable { ...@@ -118,7 +118,7 @@ class Source : public ftl::Configurable {
void writeFrames(const ftl::cuda::TextureObject<uchar4> &rgb, const ftl::cuda::TextureObject<uint> &depth, cudaStream_t stream); void writeFrames(const ftl::cuda::TextureObject<uchar4> &rgb, const ftl::cuda::TextureObject<uint> &depth, cudaStream_t stream);
void writeFrames(const ftl::cuda::TextureObject<uchar4> &rgb, const ftl::cuda::TextureObject<float> &depth, cudaStream_t stream); void writeFrames(const ftl::cuda::TextureObject<uchar4> &rgb, const ftl::cuda::TextureObject<float> &depth, cudaStream_t stream);
int64_t timestamp() const { return (impl_) ? impl_->timestamp_ : 0; } int64_t timestamp() const { return timestamp_; }
/** /**
* Directly upload source RGB and Depth to GPU. * Directly upload source RGB and Depth to GPU.
...@@ -204,6 +204,7 @@ class Source : public ftl::Configurable { ...@@ -204,6 +204,7 @@ class Source : public ftl::Configurable {
bool bullet_; bool bullet_;
channel_t channel_; channel_t channel_;
cudaStream_t stream_; cudaStream_t stream_;
int64_t timestamp_;
detail::Source *_createImplementation(); detail::Source *_createImplementation();
detail::Source *_createFileImpl(const ftl::URI &uri); detail::Source *_createFileImpl(const ftl::URI &uri);
......
...@@ -30,6 +30,7 @@ Source::Source(ftl::config::json_t &cfg) : Configurable(cfg), pose_(Eigen::Matri ...@@ -30,6 +30,7 @@ Source::Source(ftl::config::json_t &cfg) : Configurable(cfg), pose_(Eigen::Matri
impl_ = nullptr; impl_ = nullptr;
params_ = {0}; params_ = {0};
stream_ = 0; stream_ = 0;
timestamp_ = 0;
reset(); reset();
on("uri", [this](const ftl::config::Event &e) { on("uri", [this](const ftl::config::Event &e) {
...@@ -42,6 +43,7 @@ Source::Source(ftl::config::json_t &cfg, ftl::net::Universe *net) : Configurable ...@@ -42,6 +43,7 @@ Source::Source(ftl::config::json_t &cfg, ftl::net::Universe *net) : Configurable
impl_ = nullptr; impl_ = nullptr;
params_ = {0}; params_ = {0};
stream_ = 0; stream_ = 0;
timestamp_ = 0;
reset(); reset();
on("uri", [this](const ftl::config::Event &e) { on("uri", [this](const ftl::config::Event &e) {
...@@ -228,6 +230,7 @@ bool Source::grab() { ...@@ -228,6 +230,7 @@ bool Source::grab() {
stream_ = 0; stream_ = 0;
return true; return true;
} else if (impl_ && impl_->grab(-1,-1)) { } else if (impl_ && impl_->grab(-1,-1)) {
timestamp_ = impl_->timestamp_;
impl_->rgb_.copyTo(rgb_); impl_->rgb_.copyTo(rgb_);
impl_->depth_.copyTo(depth_); impl_->depth_.copyTo(depth_);
return true; return true;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment