Commit ed930c17 authored by artificiel's avatar artificiel
Browse files

CloudPlayerThread: correction sur les conditions de fin de thread

parent 470a60d5
......@@ -78,7 +78,7 @@ class CloudPlayerThread : public ofThread
new_mesh_ = false;
while (recorded_mesh_.tryReceive(mesh_[(ready_mesh_buffer_ + 1) % NUM_CLOUD_BUFFERS])) {
new_mesh_ = true;
new_mesh_ = true;
ready_mesh_buffer_ = (ready_mesh_buffer_ + 1) % NUM_CLOUD_BUFFERS;
}
if (new_mesh_) {
......@@ -88,21 +88,27 @@ class CloudPlayerThread : public ofThread
bool is_cloud_new() { return new_cloud_; }
bool is_mesh_new() { return new_mesh_; }
ofMesh &get_mesh() { return mesh_[ready_mesh_buffer_]; }
ofMesh &get_mesh()
{
if (!isThreadRunning() && mesh_[ready_mesh_buffer_].getNumVertices()!=0) {
mesh_[ready_mesh_buffer_].clear();
}
return mesh_[ready_mesh_buffer_];
}
float offset_x_, offset_z_;
void stop()
{
if (isThreadRunning())
{
if (isThreadRunning()) {
ofLogNotice("CloudPlayerThread") << "stopped_thread is now true";
stop_thread_ = true;
} else {
ofLogNotice("CloudPlayerThread") << "double-stop prevented";
}
}
}
std::string get_filename()
......@@ -110,6 +116,8 @@ class CloudPlayerThread : public ofThread
return filename_;
}
bool is_done_ = false;
private:
void threadedFunction()
{
......@@ -133,6 +141,8 @@ class CloudPlayerThread : public ofThread
ofLogNotice("CloudPlayerThread") << "stopping the thread";
stop_thread_ = false;
new_cloud_ = false;
stopThread();
ofLogNotice("CloudPlayerThread") << "thread stopped";
return;
......@@ -158,6 +168,7 @@ class CloudPlayerThread : public ofThread
stop();
// stop_thread_ = true;
// if looping....
is_done_ = true;
decoded_frames_ = 0;
} else {
......@@ -209,6 +220,7 @@ class CloudPlayerThread : public ofThread
uint64_t decodingFenceTimestamp = 0;
uint64_t delay;
std::string filename_;
std::string playback_path_;
bool new_mesh_ = false;
......
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