Commit d5c0369f authored by artificiel's avatar artificiel
Browse files

CloudPlayerThread: gestion du off pour clearer le cloud a l'arret

parent b86fe283
......@@ -52,6 +52,7 @@ class CloudPlayerThread : public ofThread
void start()
{
decoded_frames_ = 0;
startThread();
}
......@@ -87,11 +88,13 @@ class CloudPlayerThread : public ofThread
bool is_cloud_new() { return new_cloud_; }
bool is_mesh_new() { return new_mesh_; }
ofMesh &get_mesh() { return mesh_; }
float offset_x_, offset_z_;
void stop()
{
ofLogNotice("CloudPlayerThread") << "stopped_thread is now true";
stop_thread_ = true;
}
......@@ -108,7 +111,25 @@ class CloudPlayerThread : public ofThread
while (1) {
if (stop_thread_) {
output_cloud_->clear();
ofMesh mesh;
ofLogNotice("CloudPlayerThread") << "sending empty datasets before stopping";
recorded_.send(std::move(*output_cloud_));
recorded_mesh_.send(std::move(mesh));
// ofLogNotice("CloudPlayerThread") << "closing the channels";
// recorded_.close();
// recorded_mesh_.close();
ofLogNotice("CloudPlayerThread") << "stopping the thread";
stop_thread_ = false;
stopThread();
ofLogNotice("CloudPlayerThread") << "thread stopped";
return;
}
......@@ -130,7 +151,9 @@ class CloudPlayerThread : public ofThread
cloudfile.open(filename_to_decode, ios::in | ios::binary);
if (!cloudfile) {
ofLogNotice("CloudPlayerThread") << filename_to_decode << " not found; looping";
ofLogNotice("CloudPlayerThread") << filename_to_decode << " not found";
stop_thread_ = true;
// if looping....
decoded_frames_ = 0;
} else {
......@@ -153,7 +176,7 @@ class CloudPlayerThread : public ofThread
previousCloudTimestamp = status_ms;
decodingFenceTimestamp = now + delay;
// ofLogNotice("CloudPlayerThread") << decoded_frames_ << " with " << output_cloud_->size() << " points from " << filename_to_decode << " with interval: " << delay;
// ofLogNotice("CloudPlayerThread") << decoded_frames_ << " with " << output_cloud_->size() << " points from " << filename_to_decode << " with interval: " << delay;
ofMesh mesh;
for (unsigned int qq = 0; qq < output_cloud_->size(); qq++) {
......@@ -172,7 +195,7 @@ class CloudPlayerThread : public ofThread
// std::cout << "DECODEUR: sleep" << std::endl;
std::this_thread::sleep_for(std::chrono::milliseconds(2));
}
}
// std::this_thread::sleep_for(std::chrono::milliseconds(2));
}
}
......@@ -184,16 +207,16 @@ class CloudPlayerThread : public ofThread
std::string filename_;
std::string playback_path_;
bool new_mesh_ = false;
bool new_cloud_ = false;
bool is_setup_ = false;
bool stop_thread_ = false;
bool new_mesh_ = false;
bool new_cloud_ = false;
bool is_setup_ = false;
bool stop_thread_ = false;
size_t decoded_frames_ = 0;
size_t total_frames_ = 0;
pcl::PointCloud<pcl::PointXYZ>::Ptr output_cloud_;
pcl::PointCloud<pcl::PointXYZ>::Ptr output_cloud_;
ofMesh mesh_;
pcl::PointCloud<pcl::PointXYZ> cloud_;
pcl::io::OctreePointCloudCompression<pcl::PointXYZ> *octree_coder_;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment