Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ofxaddons
ofxCloudLib
Commits
d5c0369f
Commit
d5c0369f
authored
Dec 14, 2017
by
artificiel
Browse files
CloudPlayerThread: gestion du off pour clearer le cloud a l'arret
parent
b86fe283
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ofxCloudLib/CloudPlayerThread.hpp
View file @
d5c0369f
...
...
@@ -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_
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment