Skip to content

Commit a99a814

Browse files
committed
fakenect: replay index in an endless loop
When the last line has been handled then the index gets closed and any 'prev' state is reset so that the next call to freenect_process_events will re-open the index and start again from the first frame. Since the Kinect camera doesn't normally spontaneously stop this seems like a more natural behaviour. Signed-off-by: Robert Bragg <[email protected]>
1 parent bb09e3b commit a99a814

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

fakenect/fakenect.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,13 @@ int freenect_process_events(freenect_context *ctx)
211211
double record_cur_time;
212212
unsigned int timestamp, data_size;
213213
char *data = NULL;
214-
if (parse_line(&type, &record_cur_time, &timestamp, &data_size, &data))
215-
return -1;
214+
if (parse_line(&type, &record_cur_time, &timestamp, &data_size, &data)) {
215+
fclose(index_fp);
216+
index_fp = NULL;
217+
record_prev_time = 0;
218+
playback_prev_time = 0;
219+
return 0;
220+
}
216221
// Sleep an amount that compensates for the original and current delays
217222
// playback_ is w.r.t. the current time
218223
// record_ is w.r.t. the original time period during the recording

0 commit comments

Comments
 (0)