diff --git a/components/rgbd-sources/include/ftl/rgbd/source.hpp b/components/rgbd-sources/include/ftl/rgbd/source.hpp index 64321d36a073ef214fc24192b2d0c45baaa3213f..c11bc83fefeccde69d989d8b800da33cf6f4daf0 100644 --- a/components/rgbd-sources/include/ftl/rgbd/source.hpp +++ b/components/rgbd-sources/include/ftl/rgbd/source.hpp @@ -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<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. @@ -204,6 +204,7 @@ class Source : public ftl::Configurable { bool bullet_; channel_t channel_; cudaStream_t stream_; + int64_t timestamp_; detail::Source *_createImplementation(); detail::Source *_createFileImpl(const ftl::URI &uri); diff --git a/components/rgbd-sources/src/source.cpp b/components/rgbd-sources/src/source.cpp index d2ab4e416f122f49f5485e4939b0ee380b7d93a8..c2b5dc5a91d98f2384727abf9f84e44d94e2dab0 100644 --- a/components/rgbd-sources/src/source.cpp +++ b/components/rgbd-sources/src/source.cpp @@ -30,6 +30,7 @@ Source::Source(ftl::config::json_t &cfg) : Configurable(cfg), pose_(Eigen::Matri impl_ = nullptr; params_ = {0}; stream_ = 0; + timestamp_ = 0; reset(); on("uri", [this](const ftl::config::Event &e) { @@ -42,6 +43,7 @@ Source::Source(ftl::config::json_t &cfg, ftl::net::Universe *net) : Configurable impl_ = nullptr; params_ = {0}; stream_ = 0; + timestamp_ = 0; reset(); on("uri", [this](const ftl::config::Event &e) { @@ -228,6 +230,7 @@ bool Source::grab() { stream_ = 0; return true; } else if (impl_ && impl_->grab(-1,-1)) { + timestamp_ = impl_->timestamp_; impl_->rgb_.copyTo(rgb_); impl_->depth_.copyTo(depth_); return true;