summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ipecamera/events.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ipecamera/events.c b/ipecamera/events.c
index b00f724..33a1e7f 100644
--- a/ipecamera/events.c
+++ b/ipecamera/events.c
@@ -123,17 +123,18 @@ int ipecamera_next_event(pcilib_context_t *vctx, pcilib_timeout_t timeout, pcili
pcilib_calc_deadline(&tv, timeout);
#ifdef IPECAMERA_ANNOUNCE_READY
- while ((pcilib_calc_time_to_deadline(&tv) > 0)&&(((!ctx->preproc)&&(ctx->reported_id == ctx->event_id))||((ctx->preproc)&&(ctx->reported_id == ctx->preproc_id)))) {
+ while ((ctx->started)&&(pcilib_calc_time_to_deadline(&tv) > 0)&&(((!ctx->preproc)&&(ctx->reported_id == ctx->event_id))||((ctx->preproc)&&(ctx->reported_id == ctx->preproc_id)))) {
#else /* IPECAMERA_ANNOUNCE_READY */
- while ((pcilib_calc_time_to_deadline(&tv) > 0)&&(ctx->reported_id == ctx->event_id)) {
+ while ((ctx->started)&&(pcilib_calc_time_to_deadline(&tv) > 0)&&(ctx->reported_id == ctx->event_id)) {
#endif /* IPECAMERA_ANNOUNCE_READY */
- usleep(IPECAMERA_NOFRAME_SLEEP);
+ usleep(IPECAMERA_NOFRAME_SLEEP);
}
}
-
}
- if (ctx->reported_id == ctx->event_id) return PCILIB_ERROR_TIMEOUT;
+ if (ctx->reported_id == ctx->event_id) {
+ return PCILIB_ERROR_TIMEOUT;
+ }
}