diff options
author | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-12-12 15:27:13 +0100 |
---|---|---|
committer | Suren A. Chilingaryan <csa@dside.dyndns.org> | 2011-12-12 15:27:13 +0100 |
commit | d2dc73cab5b1c08822ce0066251e362f01525f10 (patch) | |
tree | 7ee30f3670a1df1d2acd0b84e64e8f3fdf7b47a3 /ipecamera/events.c | |
parent | d1a0a2e0322e6c5b05ba7817c1c0405dc20e5414 (diff) | |
download | pcitool-d2dc73cab5b1c08822ce0066251e362f01525f10.tar.gz pcitool-d2dc73cab5b1c08822ce0066251e362f01525f10.tar.bz2 pcitool-d2dc73cab5b1c08822ce0066251e362f01525f10.tar.xz pcitool-d2dc73cab5b1c08822ce0066251e362f01525f10.zip |
Minor fixes and improvements
Diffstat (limited to 'ipecamera/events.c')
-rw-r--r-- | ipecamera/events.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ipecamera/events.c b/ipecamera/events.c index 173423b..a6cf57e 100644 --- a/ipecamera/events.c +++ b/ipecamera/events.c @@ -21,6 +21,7 @@ #include "events.h" int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, void *user) { + int run_flag = 1; int res, err = 0; int do_stop = 0; @@ -46,7 +47,7 @@ int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, v } // This loop iterates while the generation - while ((ctx->run_streamer)||(ctx->reported_id != ctx->event_id)) { + while ((run_flag)&&((ctx->run_streamer)||(ctx->reported_id != ctx->event_id))) { while (ctx->reported_id != ctx->event_id) { if ((ctx->event_id - ctx->reported_id) > (ctx->buffer_size - IPECAMERA_RESERVE_BUFFERS)) ctx->reported_id = ctx->event_id - (ctx->buffer_size - 1) - IPECAMERA_RESERVE_BUFFERS; else ++ctx->reported_id; @@ -57,6 +58,7 @@ int ipecamera_stream(pcilib_context_t *vctx, pcilib_event_callback_t callback, v res = callback(ctx->reported_id, (pcilib_event_info_t*)&info, user); if (res <= 0) { if (res < 0) err = -res; + run_flag = 0; break; } } |