summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@dside.dyndns.org>2012-07-27 13:54:32 +0200
committerSuren A. Chilingaryan <csa@dside.dyndns.org>2012-07-27 13:54:32 +0200
commit4d7dc1f258d94fb94ae473b483eb5a638b2ae119 (patch)
treef289bc7c0b61a0545a60a34de88558b712694c8e
parent1f407e269694ef01d05bf8ee3c0a345c06a4de6f (diff)
downloadipecamera-4d7dc1f258d94fb94ae473b483eb5a638b2ae119.tar.gz
ipecamera-4d7dc1f258d94fb94ae473b483eb5a638b2ae119.tar.bz2
ipecamera-4d7dc1f258d94fb94ae473b483eb5a638b2ae119.tar.xz
ipecamera-4d7dc1f258d94fb94ae473b483eb5a638b2ae119.zip
Bail out from ipecamera_get_next_event if camera is stopped during the wait
-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;
+ }
}